Ok, I tried this no doubt naive attempt to create a new thread with a new window and message loop.
I have a function that must open a window & process its messages, and must run in environments where it may be called from application with no existing message loop (and no other windows) or the usual mfc message loop or a WTL message loop.
I saw some stuff about AddMessageLoop and Modules? but it appeared that was for the main application. In any case, there may or may not be a WTL module out there. Need a stand alone window with a basic message loop.
Passing in a WTL class with window not yet opened, so Window opens in same thread as loop.
static DWORD WINAPI MyRunThread(__in LPVOID lpParameter)
{
CMessageLoop theLoop;
WTLclass *nav = (WTLclass *) lpParameter;
nav->CreateWindow();
int nRet = theLoop.Run();
return nRet;
}
CreateThread(0,0,MyRunThread,&nav,0,0);