this is most likely a very stupid question but i am a beginer to win32 api, where would you write code so that it is constantly being active because writing it in WndProc it only works when a message is sent (non constant)?
Printable View
this is most likely a very stupid question but i am a beginer to win32 api, where would you write code so that it is constantly being active because writing it in WndProc it only works when a message is sent (non constant)?
Acting on the receipt of a message is the core design rationale of Windows. Your WinMain function is always active, it is, however in a tight loop Getting message, Translating messages and Dispatching message. If you want to do something simple, you could do it in this loop, but I would strongly advise you not to as the performance of your application will be drastically affected.
If, as I suspect, you want to have your task doing something, at the same time as servicing your messages, you need to create a "worker thread". Look up the _beginthread() API function in the help. Don't use CreateThread().