C++ Question How to query a key?

Topper

Addon Developer
Addon Developer
Donator
Joined
Mar 28, 2008
Messages
666
Reaction score
20
Points
33
Hi,

it's possible that i'm a bit stupid sometimes,
but my question is, how can i query a keyboard key in an orbiter dll?

I've tryed to inserd this in the orbiter module, but it's not working.

Is it called automaticly by pressing a key or when it will be called?

I have not so much expirince with the Windows API...

Code:
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
        case WM_KEYDOWN:
            switch (wParam)
            {
                case VK_LEFT:
                    left = true;
                    sprintf(oapiDebugString(),"LEFT ARROW PRESSED");
                    break;
            }
            
    }
    return 0;
}
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,654
Reaction score
2,376
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Did you try using the standard orbiter API functions first? WM_KEYDOWN is only created for windows and goes to the focus window first.
 

Topper

Addon Developer
Addon Developer
Donator
Joined
Mar 28, 2008
Messages
666
Reaction score
20
Points
33
Did you try using the standard orbiter API functions first? WM_KEYDOWN is only created for windows and goes to the focus window first.

Yes, but orbiter IS the focused window right?

I will query some keys in the

DLLCLBK void opcPreStep(...)

for example, without a MFD.
The "ConsumeKey" functions are only for MFD's...
 
Top