To catch the altkey when pressing it, I added this code in winMain() :
Code:
while (!done)
{
//zoek boodschap
if(PeekMessage(&msg, hwnd, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
{
done = 1;
}
else if (msg.message == WM_SYSKEYDOWN){
G->ev->syskey |= SKY_ALT;
}
else if (msg.message == WM_SYSKEYUP){
G->ev->key &= ~SKY_ALT;
}
else if (~(G->ev->syskey & SKY_ALT) )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
//...
A few lines further I added this code :
Code:
switch (G->ev->key)
{
case SKY_S:
if (G->ev->syskey & SKY_SHIFT){
//...
}
else if (G->ev->syskey & SKY_ALT){
//...
}
else if (G->ev->syskey & SKY_CTRL){
//...
}
break;
When CTRL and SHIFT are used, ther is no problem, everything works as supposed. But when ALT is used, there is a problem.
First of all, the code only works when I press 'S' first, and then 'ALT' .
Not when I press ALT first.
When it works, it works well, but when I release either 'S' or 'ALT', the program quits. Does anyone know how to resolve that ?
Thanks in advance