Prev: Setting Service ACL in Win7 Not Working All the Time?
Next: ReadFile hangs on reading from child process.
From: ikkejij on 2 Mar 2010 06:13 Arkady Frenkel wrote on 03/03/2006 06:11 ET : > Just a hint : process can be windowless ( console or window application ) > but never v.v. :) window without process. Windows handle is pointer to the > struct defining the window and table of GDI objects you can see in process > environment block (PEB) > Arkady > > "Peter Olcott" wrote in message > news:ytRNf.109656$ >> It looks like HWND consistently identifies every window, even including >> child controls such as TextBoxes. How does MS Windows connect these >> windows to the running process? Does the process store the Main Window >> Handle, or does the Main Window store the Process ID, or both, or some >> other way? >> >> You wrote that a window could not exist without a process. However i had an console application running in visual studio 2008 which opened a window. The application crashed, activating the debugger in visual studio. When i stopped debugging (pressing the stop button in visual studio), the created window was killed, and the process of my application was killed, but my console window stayed open without a process. My question is: how can i kill the window when it is not attached to a process. I am able to get the handle, but sending close, quit or destrow messages to it will not kill the window. The window also doesn't respont to clicking the close button, or pressing the close option in the application menu. I hope you or someone else know how to close the window. I would really appreciate it if I get an answer soon. Kind regards, ikkejij
From: Leo Davidson on 2 Mar 2010 07:23 On Mar 2, 11:13 am, ikkejij <ikke...(a)domain-xyz.in> wrote: > You wrote that a window could not exist without a process. However i had an > console application running in visual studio 2008 which opened a window. The > application crashed, activating the debugger in visual studio. When i stopped > debugging (pressing the stop button in visual studio), the created window was > killed, and the process of my application was killed, but my console window > stayed open without a process. Are you sure that console window was created by your application? When you run or debug a console-app, Visual Studio usually creates a console process/window for it to run within. In that situation, the console window doesn't belong to your process. It's like if you open a cmd.exe window and then run your process within it. You can use Spy++ or Process Explorer to find out which process owns a window by dragging the crosshair icon over windows. (The icon is on the toolbar in Process Explorer and in the Find Window dialog of Spy+ +).
From: Jonathan de Boyne Pollard on 4 Mar 2010 07:36 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=windows-1252" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> <blockquote cite="mid:7MudnXMiAqFvbxHWRVn_vwA(a)giganews.com" type="cite"> <blockquote type="cite"> <p>Just a hint : process can be windowless ( console or window application ) but never v.v. :) window without process. Windows handle is pointer to the struct defining the window and table of GDI objects you can see in process environment block (PEB)</p> </blockquote> <p>You wrote that a window could not exist without a process. However i had an console application running in visual studio 2008 which opened a window. The application crashed, activating the debugger in visual studio. When i stopped debugging (pressing the stop button in visual studio), the created window was killed, and the process of my application was killed, but my console window stayed open without a process.</p> </blockquote> <p>What xe wrote was correct, and matches what you experienced.� You yourself say that "the created window was killed".� There you go.� The window that your process created ceased to exist when the process that created it terminated.</p> <p>Of course the console window isn't a window created by your process at all, so your last statement is a falsehood.� The console window stayed open because <em>its</em> process <em>hasn't terminated</em>.� The console window is a window created by the Client-Server Runtime SubSystem.� Since the Client-Server Runtime SubSystem process has not terminated (which would cause your system to ABEND, incidentally), that window hasn't been automatically destroyed.� It is destroyed when the Client-Server Runtime SubSystem closes it, which in turn happens when the last handle to the console that it displays is closed.� My educated guess is that your development/debugging tools still have an open handle to that console.</p> </body> </html>
From: Stefan Kuhr on 4 Mar 2010 08:46
Jonathan, On 3/4/2010 1:36 PM, Jonathan de Boyne Pollard wrote: >> <snip> >> You wrote that a window could not exist without a process. However i >> had an console application running in visual studio 2008 which opened >> a window. The application crashed, activating the debugger in visual >> studio. When i stopped debugging (pressing the stop button in visual >> studio), the created window was killed, and the process of my >> application was killed, but my console window stayed open without a >> process. >> > [...] My educated guess is that your > development/debugging tools still have an open handle to that console. > Another possibility is that he is a victim of the crappy patch that came with KB978037. -- S |