use a loop
Code:
#include <Windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR CmdShow, int CmdLine)
{
MessageBox(NULL, TEXT("SUP"), TEXT("SUP"), NULL);
while (true)
{
if(GetAsyncKeyState(int (VK_NUMPAD9)) & 0)
{
MessageBox(NULL, TEXT("YES"), TEXT("SKD"), NULL);
return 0;
}
}
}
this way, the code will wait untill you press numpad9, shows messagebox and will return from main (exit the program).
a better way:
while(!(GetAsyncKeyState(int (VK_NUMPAD9)) & 0)); // will till the key is pressed
MessageBox(NULL, TEXT("YES"), TEXT("SKD"), NULL); // after the key is pressed the messagebox will appear
return 0; //exit the program