• Advertisement
Sign in to follow this  

accel question

This topic is 4255 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do i bind an accelrators key into a function for exemple if i want the specfic key to trigger something how do i do that? so far i got main.cpp extern void PaintRoutine (HWND, HDC, int, int); LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); HINSTANCE hInst; HACCEL hAccelTable; hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR1)); while (msg.message!=WM_QUIT) { if ( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } else { // Render(Device); using Windows programming/c++ } } return (int) msg.wParam; } now i dont think my code is good can any1 show me how do i make an accelrator that triggers a function plz? [Edited by - Nikita21 on June 27, 2006 4:32:17 PM]

Share this post


Link to post
Share on other sites
Advertisement

You have a WndProc somewhere which contains switch statement and huge amount of case this and case that. That is the place where to place your accelerator handling. So, your accelerator has a some ID I presume, so you'll just add a new line to the WndProc saying:

case ID_SOMEKEY:
{
DoSomethingElse();
}
break;

It isn't perhaps this simple, but works like this basically.

Cheers

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement