I'm still kind of new to C++ and WinAPI and I've come across an issue. I can't make use of an infinite while loop (while(true) in this case) in WinAPI but I can do exactly what I want to do in a console application without the crashing.
I'm trying to detect a key-press so I believe that I need this loop unless someone can provide other means of doing this.
while (true) {
if (GetAsyncKeyState(MIDDLEMOUSEBUTTON)) {
//my code here
}
}

Any help or advice with this is appreciated, thanks.