2011-12-25 81 views
0

我想知道哪些按鍵在我的C++/windows應用程序中按下。在C++ windows應用程序中捕獲按下的按鍵

我應該把什麼放在WM_KEYDOWN

switch (message) 
    { 
     case WM_KEYDOWN: 
      // for example, what should i write to know if "F" key was pressed? 
    } 

謝謝!

+1

請RTFM - http://msdn.microsoft.com/en-us/library/windows/desktop/ms646280%28v=vs.85%29.aspx – Abyx 2011-12-25 22:16:00

+0

有沒有實際的字符鍵那裏,只是像輸入或選項卡的東西 – 2011-12-25 22:17:27

+0

我需要字母鍵像A或B – 2011-12-25 22:19:06

回答

1

嘗試folloiwng:

switch (message) 
{ 
    case WM_KEYDOWN: 
    switch (wParam) 
    { 
     // ... 
     case 'F': DoSomething(); break; 
     // ... 
     case VK_RETURN: DoSomethingElse(); break; 
     // ... 
    } 
    break; 
} 
+0

sagol杜斯塔姆:) – 2011-12-25 22:27:22

+0

哥斯達黎加ederim :)埃格爾isini cozduyse cevabi onaylamayi unutmazsan sevinirim :) – 2011-12-25 22:29:22

+0

bekleme suresi瓦爾達Øyuzden basamadim – 2011-12-25 22:30:17

相關問題