Can a Window Handle in .NET change it's value? -
during lifetime of .net process, handle of system.windows.forms.form
, lets main form used in application.run(form)
change it's value, i.e. if using value of handle in different process, e.g. intptr handle = user32.findwindow(null, "name")
, there case handle might invalidated .net runtime?
edit
i need know handles because want use sendmessage
, wm_copydata
, ipc.
a window handle guaranteed valid , not reused long window lives. it's index in nature, valid globally , behaves more global id kernel handle(which valid in 1 process , pointer in nature). once window gets closed window handle might reused , points window.
but what's not obvious if lifetime of form
, underlying windows window
same. vaguely remember in delphi's vcl(which spiritual predecessor of windows.forms) property changes recreated window in background.
the existence of control.recreatinghandle property seems strong indication indeed lifetime of underlying window can shorter lifetime of .net control. lead handle of form
changing during lifetime.
control.recreatehandle
recreatehandle method called whenever parameters needed new control, using call updatestyles createparams insufficient. method calls destroyhandle , createhandle , sets recreatinghandle true.
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.recreatehandle.aspx
from description of method conclude window handle can indeed change during lifetime of form.
Comments
Post a Comment