Link to home
Start Free TrialLog in
Avatar of DJ_AM_Juicebox
DJ_AM_Juicebox

asked on

VK_SPACE

Hi,

I want to make some hotkeys for my application. I want to bind the space bar. - but space bar doesn't have an ascii code, it has a virtual key code. Is that virtual key code value consistent for all keyboards? I'm trying something like:

    // VK_SPACE on my machine is defined on 0x20.

    LRESULT ViewBase::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
    {
        switch (message) {
            case 0x20:
                 AfxMessageBox("User pressed space bar.");
                 break;
        }
}

Thanks




Avatar of Priyesh
Priyesh

Yes it is. AFAIK.
ASKER CERTIFIED SOLUTION
Avatar of Priyesh
Priyesh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think you are wanting to make accelerators. Try editing your accelerator in your resources. Add the keys you want commands for there. Then you can add ON_COMMAND handlers for those in your view.