回覆列表
  • 1 # 吾心願比之如

    C語言模擬鍵盤程式碼如下:

    int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR szCmdLine,int iCmdShow)

    {

    MSG msg;

    if(!MyRegisterClass(hInstance))

    {

    return FALSE;

    }

    if(!InitInstance(hInstance,iCmdShow))

    {

    return FALSE;

    }

    while (GetMessage (&msg, NULL, 0, 0))

    {

    TranslateMessage (&msg);

    DispatchMessage (&msg);

    }

    return msg.wParam;

    }

    //函式:ShowKey

    //作用:實現在視窗中顯示按鍵資訊

    void ShowKey (HWND hwnd, int iType,char *szMessage,WPARAM wParam,LPARAM lParam)

    {

    static char *szFormat[2] ={"%-14s %3d %c %6u %4d %5s %5s %6s %6s",

    "%-14s %3d %c %6u %4d %5s %5s %6s %6s" };

    char szBuffer[80];

    HDC hdc;

    ScrollWindowEx(hwnd, 0, -yChar, &rc,&rc,NULL,NULL,SW_INVALIDATE);

    hdc = GetDC (hwnd);

    SelectObject (hdc, GetStockObject (SYSTEM_FIXED_FONT));

    TextOut (hdc,

    xChar,

    rc.bottom - yChar,

    szBuffer,

    wsprintf szBuffer,

    szFormat[iType]。

  • 中秋節和大豐收的關聯?
  • 數碼寶貝新劇場版的預告公佈了嗎?