Answer the question
In order to leave comments, you need to log in
How to get messages using GetMessage?
WINAPI has a GetMessage function for receiving messages, but the trouble is that there is some subtlety between the console and window applications that affects the operation of this function.
Those. if you create a program as a window application with the main WinMain function, then GetMessage works as it should, but you need a console program, not a window program, and when I create a console program, GetMessage stops working, while the main function is main.
What is the subtlety here and can a CONSOLE program receive messages using the GetMessage call?
Answer the question
In order to leave comments, you need to log in
Making an invisible window created without dwStyle : WS_VISIBLE and with ShowWindow(hWnd,SW_HIDE) is the traditional way of catching window system messages, even for services. In this case, it is not at all necessary to compile the application as a graphical one. After all, no one bothers to call the RegisterClassEx and CreateWindowEx functions in a console application or service.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question