²é¿´: 2399  |  »Ø¸´: 15
µ±Ç°Ö»ÏÔʾÂú×ãÖ¸¶¨Ìõ¼þµÄ»ØÌû£¬µã»÷ÕâÀï²é¿´±¾»°ÌâµÄËùÓлØÌû

leafmavis

ľ³æ (ÎÄ̳¾«Ó¢)

[ÇóÖú] VC++ÖÐÈçºÎÓ¦ÓÃporttalk

ÓиöʵÑ飬ÊÇ¿ØÖÆÒ»¸öµç¶¯Ì¨×öÐýתÔ˶¯£¨Õⲿ·ÖVC++Ô´´úÂëÓɲúÆ·µÄÖÆÔìÉÌÌṩ£©£¬´Ó¶ø¸øÊµÑ鶯Îï´Ì¼¤£¬Í¬Ê±²É¼¯¶¯ÎïµÄÄԵ硣ÎÒÃÇÏëÔÚÐýתÔ˶¯µÄ¿ªÊ¼ºÍ½áÊøµÄʱºò£¬·Ö±ð¸ø²¢¿ÚÒ»ÃëÖÓµÄ¸ßµçÆ½£¬ÒÔ±ãÔÚÄÔµçÐźŲɼ¯ÏµÍ³ÉÏ´òÉÏͬ²½±ê¼Ç¡£ÎÒÃÇ×öÁËÒ»¸ö²¢¿ÚµÄÁ÷Ë®µÆÒÔÑéÖ¤²¢¿Ú²Ù×÷µÄ¿É¿¿ÐÔ¡£ÓÃC++bulider 6.0ʱ£¬ÀûÓÃPortTalkÄÜ¿ØÖÆÁ÷Ë®µÆ¹¤×÷£»µ«ÓÃVC++ 6.0ʱ£¬±¨´í¡£Òòµç¶¯Ì¨µÄÔ´ÂëÊÇVC++ 6.0£¬ËùÒÔÏëÇë½Ì¸ßÊÖ¡£Ð»Ð»£¡
     ÏÂÃæÊǵ¥´¿µÄ²¢¿Ú²Ù×÷ÑéÖ¤£º
1¡¢ÓÃC++buliderʱ£¬ÔÚ¹¤³ÌĿ¼Ï¿½½øÕâÁ½¸öÎļþ£ºPortTalk.sys; PortTalk.h¡£ÔÚFormÖÐÌí¼ÓÒ»¸ö°´¼ü£¨¹¦ÄÜΪ£ºÊ¹²¢¿ÚÊä³öÂö¿íΪ1ÃëµÄ¸ßµçƽ£©£¬²¢ÔÚFormÖÐÌí¼ÓÁ˲¢¿Ú³õʼ»¯£¨ÒòΪ¼ÆËã»ú¿ª»úʱ²¢¿Ú¸÷Êý¾ÝλÊÇ¸ßµçÆ½£¬³õʼ»¯¾ÍÊǽ«ËùÓÐÊý¾ÝλÖõͣ©¡£³ÌÐòÔËÐÐÕý³££¬Á÷Ë®µÆµÄ¿ª±ÕÕý³£¡£

2¡¢ÓÃVC++ʱ£¬²Ù×÷ͬÉÏ£¬µ«±àÒëʱ±¨´í¡£ÏëÇëÎÊһϣ¬ÔÚVC++ÏÂÈçºÎʹÓÃPortTalk £¿ÍøÉÏû˵PortTalk²»ÄÜÓÃÓÚVC++ѽ

--------------------Configuration: fang1 - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
fang1.cpp
fang1Dlg.cpp
e:\work\vc\learn1\fang1\porttalk.h(41) : error C2065: 'ShowMessage' : undeclared identifier
e:\work\vc\learn1\fang1\porttalk.h(80) : error C2065: 'SC_HANDLE' : undeclared identifier
e:\work\vc\learn1\fang1\porttalk.h(80) : error C2146: syntax error : missing ';' before identifier 'SchSCManager'
e:\work\vc\learn1\fang1\porttalk.h(80) : error C2065: 'SchSCManager' : undeclared identifier
e:\work\vc\learn1\fang1\porttalk.h(81) : error C2146: syntax error : missing ';' before identifier 'schService'
e:\work\vc\learn1\fang1\porttalk.h(81) : error C2065: 'schService' : undeclared identifier
e:\work\vc\learn1\fang1\porttalk.h(85) : error C2065: 'OpenSCManager' : undeclared identifier
e:\work\vc\learn1\fang1\porttalk.h(85) : error C2065: 'SC_MANAGER_ALL_ACCESS' : undeclared identifier
e:\work\vc\learn1\fang1\porttalk.h(94) : error C2065: 'OpenService' : undeclared identifier
e:\work\vc\learn1\fang1\porttalk.h(94) : error C2065: 'SERVICE_ALL_ACCESS' : undeclared identifier
e:\work\vc\learn1\fang1\porttalk.h(110) : error C2065: 'StartService' : undeclared identifier
e:\work\vc\learn1\fang1\porttalk.h(112) : error C2065: 'CloseServiceHandle' : undeclared identifier
e:\work\vc\learn1\fang1\porttalk.h(118) : error C2146: syntax error : missing ';' before identifier 'SchSCManager'
e:\work\vc\learn1\fang1\porttalk.h(119) : error C2146: syntax error : missing ';' before identifier 'schService'
e:\work\vc\learn1\fang1\porttalk.h(129) : error C2065: 'CreateService' : undeclared identifier
Generating Code...
Error executing cl.exe.

fang1.exe - 15 error(s), 0 warning(s)
»Ø¸´´ËÂ¥

» ²ÂÄãϲ»¶

» ±¾Ö÷ÌâÏà¹Ø¼ÛÖµÌùÍÆ¼ö£¬¶ÔÄúͬÑùÓаïÖú:

´ºÈç±­ÖÐË®
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

sudo

ľ³æ (ÕýʽдÊÖ)

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

¡ï ¡ï
ÓàÔó³É(½ð±Ò+2): ÐÁ¿àÁË£¡ 2011-05-04 22:54:12
²»±£Ö¤ÄÜÓ㬰ÑÏÂÃæµÄ´úÂëÌùµ½PortTalk.hÀïÃæµÄ#include ÄÇÐеÄÏÂÃæ
CODE:
#include
#include

#ifdef _MFC_VER
#define ShowMessage MessageBox
#else
#define ShowMessage printf
#endif

ÄãÔÙ±àÒë¿´¿´ÓÐʲô´íÎ󣬴ó¼ÒÔÙÌÖÂÛ~


¡¾ÆÀÂÛ¡¿

porttalkÕâ¸ö.h¿âдµÃºÜ²»ºÃ

Èç¹ûÔÚÁ½¸ö²»Í¬µÄ.c/.cppÎļþÀïÃæincludeµÄ»°£¬×÷Ϊһ¸ö¹¤³Ì£¬»áÓÐÖØ¶¨ÒåerrorµÄ

²»¹ýÏȾÍÕâôµØ°É£¬µÈÂ¥Ö÷ÒÔºóÊìϤ±à³ÌÖ®ºó£¬×Ô¼ºÐ´¶¼²»ÊÇÎÊÌâ
8Â¥2011-05-04 14:56:34
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
²é¿´È«²¿ 16 ¸ö»Ø´ð

yalefield

½ð³æ (ÎÄ̳¾«Ó¢)

ÀϺºÒ»Ã¶

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

¡ï ¡ï
ÓàÔó³É(½ð±Ò+2): лл²ÎÓëÓ¦Öú£¡ 2011-05-04 22:51:48
leafmavis(½ð±Ò+2): ллÈÈÇéÏàÖú 2011-05-05 09:08:35
(1) ÔÚÄúÓõ½PortTalkÖеĺ¯Êýʱ£¬Ê×ÏÈÒª
#include "PortTalk.h"

(2) µÈÏÂÒ»²½ÄúÓöµ½¸ü¶à´íÎóʱ£¬ÔÙ˵¿©¡£
2Â¥2011-05-04 08:42:37
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

leafmavis

ľ³æ (ÎÄ̳¾«Ó¢)

ллÄúµÄ»Ø¸´£¬²»¹ýÍ·ÎļþÊǼÓÉÏÁ˵ġ£¸½ÉÏC++Ô´Â룬³ý #include "PortTalk.h" ºÍ×îºóÃæµÄ°´¼üÏìÓ¦º¯Êý£¬ÆäËûµÄ¶¼ÊÇ×Ô¶¯Éú³ÉµÄ¡£Çë°ïæ·ÖÎö£¬Ð»Ð»£¡


// fang1Dlg.cpp : implementation file
//

#include "stdafx.h"
#include "fang1.h"
#include "fang1Dlg.h"
#include "PortTalk.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
        CAboutDlg();

// Dialog Data
        //{{AFX_DATA(CAboutDlg)
        enum { IDD = IDD_ABOUTBOX };
        //}}AFX_DATA

        // ClassWizard generated virtual function overrides
        //{{AFX_VIRTUAL(CAboutDlg)
        protected:
        virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
        //}}AFX_VIRTUAL

// Implementation
protected:
        //{{AFX_MSG(CAboutDlg)
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
        //{{AFX_DATA_INIT(CAboutDlg)
        //}}AFX_DATA_INIT
}

void CAboutDlg:oDataExchange(CDataExchange* pDX)
{
        CDialog:oDataExchange(pDX);
        //{{AFX_DATA_MAP(CAboutDlg)
        //}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
        //{{AFX_MSG_MAP(CAboutDlg)
                // No message handlers
        //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFang1Dlg dialog

CFang1Dlg::CFang1Dlg(CWnd* pParent /*=NULL*/)
        : CDialog(CFang1Dlg::IDD, pParent)
{
        //{{AFX_DATA_INIT(CFang1Dlg)
                // NOTE: the ClassWizard will add member initialization here
        //}}AFX_DATA_INIT
        // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
        m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CFang1Dlg:oDataExchange(CDataExchange* pDX)
{
        CDialog:oDataExchange(pDX);
        //{{AFX_DATA_MAP(CFang1Dlg)
                // NOTE: the ClassWizard will add DDX and DDV calls here
        //}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CFang1Dlg, CDialog)
        //{{AFX_MSG_MAP(CFang1Dlg)
        ON_WM_SYSCOMMAND()
        ON_WM_PAINT()
        ON_WM_QUERYDRAGICON()
        ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
        //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFang1Dlg message handlers

BOOL CFang1Dlg::OnInitDialog()
{
        CDialog::OnInitDialog();

        // Add "About..." menu item to system menu.

        // IDM_ABOUTBOX must be in the system command range.
        ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
        ASSERT(IDM_ABOUTBOX < 0xF000);

        CMenu* pSysMenu = GetSystemMenu(FALSE);
        if (pSysMenu != NULL)
        {
                CString strAboutMenu;
                strAboutMenu.LoadString(IDS_ABOUTBOX);
                if (!strAboutMenu.IsEmpty())
                {
                        pSysMenu->AppendMenu(MF_SEPARATOR);
                        pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
                }
        }

        // Set the icon for this dialog.  The framework does this automatically
        //  when the application's main window is not a dialog
        SetIcon(m_hIcon, TRUE);                        // Set big icon
        SetIcon(m_hIcon, FALSE);                // Set small icon
       
        // TODO: Add extra initialization here
       
        return TRUE;  // return TRUE  unless you set the focus to a control
}

void CFang1Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
        if ((nID & 0xFFF0) == IDM_ABOUTBOX)
        {
                CAboutDlg dlgAbout;
                dlgAbout.DoModal();
        }
        else
        {
                CDialog::OnSysCommand(nID, lParam);
        }
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CFang1Dlg::OnPaint()
{
        if (IsIconic())
        {
                CPaintDC dc(this); // device context for painting

                SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

                // Center icon in client rectangle
                int cxIcon = GetSystemMetrics(SM_CXICON);
                int cyIcon = GetSystemMetrics(SM_CYICON);
                CRect rect;
                GetClientRect(&rect);
                int x = (rect.Width() - cxIcon + 1) / 2;
                int y = (rect.Height() - cyIcon + 1) / 2;

                // Draw the icon
                dc.DrawIcon(x, y, m_hIcon);
        }
        else
        {
                CDialog::OnPaint();
        }
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CFang1Dlg::OnQueryDragIcon()
{
        return (HCURSOR) m_hIcon;
}

void CFang1Dlg::OnButton1()
{
        // TODO: Add your control notification handler code here
        OpenPortTalk();  //´ò¿ªµØÖ·²Ù×÷
        outportb(0x378,0xFF);
        Sleep(1000);
        outportb(0x378,0x00);
        ClosePortTalk();  //¹Ø±ÕµØÖ·²Ù×÷
}
´ºÈç±­ÖÐË®
3Â¥2011-05-04 09:12:39
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

sudo

ľ³æ (ÕýʽдÊÖ)

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

¡ï ¡ï
ÓàÔó³É(½ð±Ò+2): лл²ÎÓëÓ¦Öú£¡ 2011-05-04 22:52:12
leafmavis(½ð±Ò+7): ллÈÈÇéÏàÖú£¬VS2010ϱàÒëͨ¹ýµÄhÎļþ£¬ÓÃC++6.0»¹ÓÐ14¸ö´íÎó£¬ÎÒÔÙ×ÐϸÑо¿Ï£¬Ð»Ð»£¡ 2011-05-05 09:12:29
½çÃæµÄ²¿·Ö¶¼Ã»ÓÐÎÊÌ⣨»°ËµÕâô¼òµ¥µÄ¶«Î÷Ö±½ÓÓÃconsole application²»ºÃÂ

ÓÚÊÇÂ¥Ö÷Äܲ»ÄÜÌùÒ»ÏÂPortTalk.hÕâ¸öÎļþµÄÄÚÈÝÄØ£¿

¿´Ñù×ÓÏñÊǰѺ¯Êý¶¨Òå·Åµ½.hÎļþÀïÃæÁË£¨²»ÊÇÀàÄ£°åµÈÌØÊâÇé¿öµÄ»°Õâô×öÆäʵ²»ºÃµÄ£©£¬¶÷£¬ËùÒÔÏÈ¿´¿´°É

PS£º
Ìù´úÂëµÄʱºò£¬·Åµ½
CODE:
Õâ¸öÀïÃæ

»á±È½ÏºÃ¿´Ò»µã
4Â¥2011-05-04 10:27:47
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] 305·ÖÇóµ÷¼Á£¨Ê³Æ·¹¤³Ì£© +3 Sxy112 2026-03-21 5/250 2026-03-22 11:35 by ÑîÑîÑî×Ï
[¿¼ÑÐ] 354Çóµ÷¼Á +7 Tyoumou 2026-03-18 10/500 2026-03-22 11:11 by ÈËÀ´Ê¢
[¿¼ÑÐ] 08¹¤¿Æ 320×Ü·Ö Çóµ÷¼Á +7 À滨çóÍí·ç 2026-03-17 7/350 2026-03-22 10:03 by 2026paper
[¿¼ÑÐ] Çóµ÷¼Á +5 Ê®Èý¼ÓÓÍ 2026-03-21 5/250 2026-03-21 18:48 by ѧԱ8dgXkO
[¿¼ÑÐ] ²ÄÁÏ 271Çóµ÷¼Á +5 Õ¹ÐÅÔÃ_ 2026-03-21 5/250 2026-03-21 17:29 by ѧԱ8dgXkO
[¿¼ÑÐ] 310Çóµ÷¼Á +3 baibai1314 2026-03-16 3/150 2026-03-21 03:56 by JourneyLucky
[¿¼ÑÐ] 265Çóµ÷¼Á +3 Jack?k?y 2026-03-17 3/150 2026-03-21 03:17 by JourneyLucky
[¿¼ÑÐ] 083200ѧ˶321·ÖÒ»Ö¾Ô¸ôßÄÏ´óѧÇóµ÷¼Á +3 innocenceF 2026-03-17 3/150 2026-03-21 02:35 by JourneyLucky
[¿¼ÑÐ] 321Çóµ÷¼Á +9 ºÎÈó²É123 2026-03-18 11/550 2026-03-20 23:19 by JourneyLucky
[¿¼ÑÐ] Ò»Ö¾Ô¸ÄϾ©Àí¹¤´óѧ085701×ÊÔ´Óë»·¾³302·ÖÇóµ÷¼Á +4 ¿ûè÷ÎÀ¶Ó 2026-03-18 6/300 2026-03-20 23:02 by JourneyLucky
[¿¼ÑÐ] 288Çóµ÷¼Á +16 ÓÚº£º£º£º£ 2026-03-19 16/800 2026-03-20 22:28 by JourneyLucky
[¿¼ÑÐ] ²ÄÁÏÓ뻯¹¤ 322Çóµ÷¼Á +4 È»11 2026-03-19 4/200 2026-03-20 22:12 by luoyongfeng
[¿¼ÑÐ] Ò»Ö¾Ô¸ÄÏÀí¹¤085701»·¾³302Çóµ÷¼ÁԺУ +3 ¿ûè÷ÎÀ¶Ó 2026-03-20 3/150 2026-03-20 19:28 by zhukairuo
[¿¼ÑÐ] ²ÄÁÏѧ˶318Çóµ÷¼Á +5 February_Feb 2026-03-19 5/250 2026-03-19 23:51 by 23Postgrad
[¿¼ÑÐ] ²ÄÁÏ¿¼Ñе÷¼Á +3 xwt¡£ 2026-03-19 3/150 2026-03-19 11:22 by wãåÑôw
[¿¼ÑÐ] 344Çóµ÷¼Á +6 knight344 2026-03-16 7/350 2026-03-18 20:13 by walc
[¿¼ÑÐ] 0854¿É¿çµ÷¼Á£¬Ò»×÷Ò»ÏîºËÐÄÂÛÎÄÎåÏîרÀû£¬Ê¡¡¢¹ú¼¶Ö¤Êé40+ÊýÒ»Ó¢Ò»287 +8 СÀî0854 2026-03-16 8/400 2026-03-18 14:35 by ²«»÷518
[¿¼ÑÐ] ²ÄÁÏ£¬·ÄÖ¯£¬ÉúÎ0856¡¢0710£©£¬»¯Ñ§ÕÐÉúÀ² +3 Eember. 2026-03-17 9/450 2026-03-18 10:28 by Eember.
[¿¼ÑÐ] 334Çóµ÷¼Á +3 Ö¾´æ¸ßÔ¶ÒâÔÚ»úÐ 2026-03-16 3/150 2026-03-18 08:34 by lm4875102
[¿¼ÑÐ] 283Çóµ÷¼Á +3 Ìý·ç¾ÍÊÇÓꣻ 2026-03-16 3/150 2026-03-17 07:41 by ÈÈÇéɳĮ
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û