I'm trying to create a little program that has a macro playback-style facility which may be invoked from the command line. The main part of the program runs in a separate thread to that which calls WinMain. So:-
This separate thread begins by creating all the windows associated with the program.
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
// application initialization
g_hThread = CreateThread(NULL, 0, MainThread, NULL, 0, &dwThreadID);
Now, as I want to be able to interact with these windows while I am playing back macro data I want to make sure that they exist. There are lots of ways of doing this, including waiting until a global variable contains something other than 0 or NULL (the other thread has finished processing and set it). However, what I would like to know is whether there is a function that will block until a given thread has become idle.
When MainThread has finished initialization it should go into the usual message pumping loop, so I am hoping that there is a way of detecting it blocking on GetMesssage?