Both EnumchildWindows and GetWindow return NULL for a ChildWindow modeless dialogbox
-
Hi, I have a console application that spawns a childprocess I am initially able to get the MainFrame Window in the console app thru EnumThreadWindows Later I create a modeless Dialog in the childprocess for which I would like the to get the HWND handle I am running this code (both apps) under the Visual Studio debugger So I can see when the child process creates the modeless dialogbox I then step thru (under VS debugger) both GetWindow(MainFrame,GW_CHILD) and EnumChildWindows and neither API return anything
-
Hi, I have a console application that spawns a childprocess I am initially able to get the MainFrame Window in the console app thru EnumThreadWindows Later I create a modeless Dialog in the childprocess for which I would like the to get the HWND handle I am running this code (both apps) under the Visual Studio debugger So I can see when the child process creates the modeless dialogbox I then step thru (under VS debugger) both GetWindow(MainFrame,GW_CHILD) and EnumChildWindows and neither API return anything
What on Earth are you trying to Achieve! Writing a Console Program trying to spawn an MFC Wnd App is not really possible, or desirable! The only practical way this is possible is by the Console Program calling the Standard 'C' 'system(...)' function to launch the Windows App. If you are looking for tooling to restart a misbehaving Windows Program, you came to the right door. I have just that. The actual code is proprietary, but I can explain how it works. Regards, Bram. :)
Bram van Kampen
-
What on Earth are you trying to Achieve! Writing a Console Program trying to spawn an MFC Wnd App is not really possible, or desirable! The only practical way this is possible is by the Console Program calling the Standard 'C' 'system(...)' function to launch the Windows App. If you are looking for tooling to restart a misbehaving Windows Program, you came to the right door. I have just that. The actual code is proprietary, but I can explain how it works. Regards, Bram. :)
Bram van Kampen
First of I apologize maybe I should spent more time looking up critical section As all it is thread synchronization I am a MainFrame assembler programmer by trade and was trying to learn new technology I picked windows I wrote a front end for this C console program originally the code was C then I re-wrote it in MFC C++ I am sure a more experienced C++ programmer could have done a better job. But this was my way of learning I created the Windows MFC C++ program with CreateProcess
-
Hi, I have a console application that spawns a childprocess I am initially able to get the MainFrame Window in the console app thru EnumThreadWindows Later I create a modeless Dialog in the childprocess for which I would like the to get the HWND handle I am running this code (both apps) under the Visual Studio debugger So I can see when the child process creates the modeless dialogbox I then step thru (under VS debugger) both GetWindow(MainFrame,GW_CHILD) and EnumChildWindows and neither API return anything
-
First of I apologize maybe I should spent more time looking up critical section As all it is thread synchronization I am a MainFrame assembler programmer by trade and was trying to learn new technology I picked windows I wrote a front end for this C console program originally the code was C then I re-wrote it in MFC C++ I am sure a more experienced C++ programmer could have done a better job. But this was my way of learning I created the Windows MFC C++ program with CreateProcess
ForNow wrote:
I ended up having the debugging modeless dialog box HWND being returned to me from the SendMessage to the main window as both LRESULT and HWND are both 64 bits wide running 64 bit mode as I don't want the console program to sit around and wait for a response (and hold it up) I do a PostMessage from the console program Thanks
I (like Bram) am confused as to what you are trying to do here. Or indeed what your point is of using a console application to launch a Windows application, to launch a modeless dialog.
-
Hi, I have a console application that spawns a childprocess I am initially able to get the MainFrame Window in the console app thru EnumThreadWindows Later I create a modeless Dialog in the childprocess for which I would like the to get the HWND handle I am running this code (both apps) under the Visual Studio debugger So I can see when the child process creates the modeless dialogbox I then step thru (under VS debugger) both GetWindow(MainFrame,GW_CHILD) and EnumChildWindows and neither API return anything
I have three suggestion/comments: 1.) You said quote: "Later I create a modeless Dialog in the childprocess for which I would like the to get the HWND handle." Doesn't matter which create method you use you get the handle back right then ... so why don't you hold it?????? 2.) Like others I wonder why you are using MFC at all which will be problematic why would you not just use the WIN32 API. 3.) If GetWindow(MainFrame,GW_CHILD) and EnumChildWindows are returning false the your created window isn't parented to the window at all. It's most likely parented to the desktop and again go back to number 1 above show us the how you created the modeless dialog and check you gave it a parent. The key point here is a show use the lines of code around the modeless dialog creation call.
In vino veritas
-
I have three suggestion/comments: 1.) You said quote: "Later I create a modeless Dialog in the childprocess for which I would like the to get the HWND handle." Doesn't matter which create method you use you get the handle back right then ... so why don't you hold it?????? 2.) Like others I wonder why you are using MFC at all which will be problematic why would you not just use the WIN32 API. 3.) If GetWindow(MainFrame,GW_CHILD) and EnumChildWindows are returning false the your created window isn't parented to the window at all. It's most likely parented to the desktop and again go back to number 1 above show us the how you created the modeless dialog and check you gave it a parent. The key point here is a show use the lines of code around the modeless dialog creation call.
In vino veritas