views:

441

answers:

3

Hello there!

I have two screens. one created in vb and the second is in WPF.

I must embed the vb inside the wpf.

Therefore i had an idea to firstly create a new Windows Form's form, and to use win32 API function "SetParent" in order to embed the vb screen inside the windows form. Secondly, host the winform inside the wpf form using the wpf WindowsFormsHost control.

Everything is going just fine in an seperated test application. but when i'm trying to do it in the complete huge wpf application, the winform is loaded empty, and the vb screen is flashes and then disappear immediately.

is there's some posible solution???

please help.. it's really rush.

Thanks.

P.S: if someone have better way to embed vb6 in wpf ... i whould like to hear it.

Neria

+1  A: 

Is is possible to expose the VB6 screen as an ActiveX control? If so, it would probably be cleaner to add import the ActiveX control, and then add it to an instance of WindowsFormsHost. You can then treat the WindowsFormsHost as a normal WPF control and add it to your WPF application.

Andy
A: 

the result of windowsformshost.handle.int32 is 0, so, i can't use setparent to embed vb6 application to wpf interface. any idea ?

my mistake, i get it before Window_Loaded

fatah
A: 

Must add: WindowsFormsHost?.Child = New System.Windows.Forms.Control before use SetParent to pass hWnd

fatah