Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A window handle is guaranteed to be valid and not get reused for as long as the window lives. It's index like in nature, valid globally and generally behaves more like a global ID than like a kernel handle(which are only valid in one process and pointer like in nature). Once the window gets closed the window handle might get reused and now points to another window.</p> <p>But what's not obvious is if the lifetime of the <code>Form</code> and the underlying windows <code>window</code> are the same. I vaguely remember that in Delphi's VCL(Which is the spiritual predecessor of Windows.Forms) certain property changes recreated the window in the background.</p> <p>The existence of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.recreatinghandle.aspx" rel="noreferrer">Control.RecreatingHandle</a> property seems like a strong indication that indeed the lifetime of the underlying window can be shorter than the lifetime of the .net control. Which could lead to the handle of a <code>Form</code> changing during its lifetime.</p> <blockquote> <p><strong>Control.RecreateHandle</strong><br/> The RecreateHandle method is called whenever parameters are needed for a new control, but using a call from UpdateStyles to CreateParams is insufficient. This method also calls DestroyHandle and CreateHandle and sets RecreatingHandle to true.<br/> <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.recreatehandle.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.control.recreatehandle.aspx</a></p> </blockquote> <p>From the description of this method I conclude that the window handle can indeed change during the lifetime of the form.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload