|
-
June 8th, 2008, 08:03 AM
#1
Random questions / issues (mostly API)
I've a done a lot of stuff, but API is confusing as hell and poorly documented, IMO. Anyway, I'm writing an editor of sorts and I'm having trouble getting certain things to work.
Ok, my current concern is how to catch key presses globally. I want the key press, regardless of which control has focus. Is an accelerator the only way? I didn't really understand how to use those.
This is how I setup the main dialog in mine:
Code:
BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
LVCOLUMN LvCol; // Make Column struct for ListView
HWND hEditBox;
char txtInput[256];
HWND hListData = GetDlgItem(hwnd, LST_DATA);
switch(Message)
{
case WM_KEYDOWN:
{
//This doesn't seem to catch keys when any control has focus.
}
case WM_CLOSE:
EndDialog(hwnd, 0);
break;
default:
return FALSE;
}
return TRUE;
}
Code:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
return DialogBox(hInstance, MAKEINTRESOURCE(ELF_MAIN), NULL, DlgProc);
}
Last edited by Viper187; June 8th, 2008 at 08:08 AM.
-
June 8th, 2008, 12:30 PM
#2
Re: Random questions / issues (mostly API)
I've a done a lot of stuff, but API is confusing as hell and poorly documented, IMO.
"You don't like cats??? You just have no idea how to cook them properly." (A very old joke )
In contrary, as for me the Windows API is the only part of Windows technologies that deserves for "well documented" nomination category. Just because it had enough time to become this.
Ok, my current concern is how to catch key presses globally.
Look at WH_MSGFILTER and WH_GETMESSAGE local hooks if you're looking for a really global solution..
Last edited by Igor Vartanov; June 8th, 2008 at 12:34 PM.
Best regards,
Igor
-
June 9th, 2008, 10:36 AM
#3
Re: Random questions / issues (mostly API)
Also take a look at WM_GETDLGCODE.
-Erik
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|