fabiocannizzo Level: Guest

|
HowTo: Open a non-modal VB form (activex dll) from a C# client
I am trying to open a form defined in a VB activeX DLL from a C# client in non modal way.
On the VB side I have a form (myForm) and an exposed class (myVBclass):
public function getFormHandle() as long
getFormHandle = myForm.hWnd
end function
public sub showForm()
myForm.show
end function
On the C# side I instantiate the ActiveX dll (converted with tlbimp), create an object of type myVBclass:
myVBclass vbClass = new myVBclass();
long hwnd = vbClass.getFormHandle(); // this works!
vbClass.showForm(); // this does not works, only modal show is allowed 
In C++ there was the same problem, but you could get around that via attaching an MFC CWnd object to the HWND returned by VB, then doing Show of the CWnd object.
CWnd pWnd;
pWnd.Attach(hWnd);
pWnd.ShowWindow(SW_SHOW);
How can I do the same thing in C#?
Thanks
Regards,
Fabio
|