Thanks, it works, here the C# version:
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint="SetParent")]
public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
SetParent( (IntPtr)this.Handle, (IntPtr)this.vfpParentHandle );
Only one more question, my winform alway appear on top of any VFP native windows contained in _screen, is there any way to change this ?
>>>I am trying to make a winform stick to a VFP _screen handle, but i can't figure out how to do it.
>>>
>>>Basically the VFP app starts my winform app with "run /n" and sends it's whnd as an argument. I'd like to use the VFP windows handle i received to host my winform just as it was a native VFP form. Is this possible ?
>>
>>All I can say is that I think it is possible. I remember this thread before. There is a Win API call that lets you make an hwind a child of another hwind.
>>
>>Sorry I don't have the exact details.
>>
>>BOb
>
>Try the SetParent API call:
>
>
>DECLARE INTEGER SetParent IN user32 INTEGER hWndChild, INTEGER hWndNewParent
>SetParent(netFormHWnd, _screen.HWnd)
>
>
>
>netFormHwnd is the handle to your .NET window. To find this handle you could for example use the FindWindow API function.
>
>Regards,
>
>Eyvind.