Why SetWindowLong(myForm.hWnd, GWL_HWNDPARENT, parentHwnd)does it freeze?
I can recreate this problem sequentially by following these three steps.
- Create a .NET Form
- Initialize the WaitWindow COM object, call ShowWindow on the COM object when passing the .NET form descriptor
- In VB6, call the SetWindowLong method
C # Windows app (freezes)
private static void Main(string[] args)
{
Form form = new Form();
form.Show();
Interop.WaitWindow waitWindow = new Interop.WaitWindow();
waitWindow.ShowWindow(form.Handle.ToInt32(), Language.RISEnglish);
}
C # console application (does not freeze)
private static void Main(string[] args)
{
IntPtr handle = Process.GetCurrentProcess().MainWindowHandle;
Interop.WaitWindow waitWindow = new Interop.WaitWindow();
waitWindow.ShowWindow(handle.ToInt32(), Language.RISEnglish);
}
VB6 code snippet
Public Sub ShowWindow(ByVal parentHwnd As Long, ByVal language As Language)
SetWindowLong(myForm.hWnd, GWL_HWNDPARENT, parentHwnd) 'Hangs Here
CenterWindow (parentHwnd)
myForm.ShowRetrieving (language)
myForm.Show (vbModal)
End Sub
Really would appreciate your help :)
EDIT
I understand that SetWIndowLong should not be called to change the parent, but I'm trying to understand why it hangs only when using the .NET form descriptor.
EDIT2
, SetWindowLong, . , , VB6 .NET, RPC. , , - .