Kersten 0 Newbie Poster

Hello,

this question is related to an older post of mine (Click Here). In this question i stated that my program freezes at the execution of GetOpenFileName.

After struggeling a while with that problem and doing other more important stuff first, i came back to the original problem and found some details which caused me to open up a new thread for this problem:

It's not longer about GetOpenFileName which freezes, it is more of a general problem the GUI has to open up any additional window.
So whats the situation?

Im working on older code so not anything can be changed that easily.
The program is a win32 console application.

After the program starts some initialisations are made, and than a GUI is started.
In Order to do this i obtain a HINSTANCE first and start the GUI window afterwards.

So basically it is:

int  main(int argc, char *argv[])
{
         // initialize variables and stuff
         OnInit();

         // get a module handle to (needed to start gui since this is an console application)
         HINSTANCE hInstance = GetModuleHandle(NULL);

         // check for command line arguments
         if (parse_command_line_arguments(argc, argv)) 
         {
            // start simulation if command line arguments are present
            startGUI(hInstance, NULL, NULL, 10,1);
         }
}

where startGUI(...) contains all code necessary for starting the GUI. (Basically just modified code of any win32 tutorial)
This is what the call to startGUI(...) looks like:

int startGUI(_In_ HINSTANCE hInstance,
   _In_opt_ HINSTANCE hPrevInstance,
   _In_ LPSTR     lpCmdLine,
   _In_ int       nCmdShow,
   int start_sim)

Which is just a renamed WinMain(...)

Doing this the GUI starts fine and behaves like expected. After executing its algorithm it (sometimes, almost always) is not possible to open up any new window. For instance opening an OpenFileDialog with getOpenFileName, but also just a MessageBox will hang.
In all cases the new (but empty )window shows up in the taskview(alt+tab) but nowhere else. The program will hang there forever.

Im sure there isn't enough information to solve my problem, but since this is work related i cannot post all code here so please be kind, i try to provide every information which is necessary. Also i know that mixing GUI and console application might not be a very good idea but this is old code, as already mentioned.

Thanks in advance.
Kersten