hawkdernacht
Programmer
For those of you in other forums, please forgive the cross-post but this does touch multiple topics.
I am a VB.Net developer, creating a vb.net application that "hooks" into a VB6 application. When the VB6 application starts up it calls my dll via COM, and my code opens up a form. That is all well and good, but I want my form to act as a child of the VB6 app. My goal is to have a floating tool window similar to the Find window in Visual Studio. The simple thing to do would be to set my form's TopMost property to true, but I don't want it to be on top of every form, just on top of the VB6 app.
I have tried using the SetParent Win32 API call. Here is an example of the pseudo code I have used:
Dim hVb6App as IntPtr = win32.FindWindow(IntPtr.Zero, IntPtr.Zero, strClassName, strApplicationName)
dim hDotNetForm as IntPtr = myForm.Handle
SetWindowLong(hDotNetForm, GWL_STYLE, WS_CHILD Or WS_VISIBLE)
SetParent(hDotNetForm, hVb6App)
This seems to successfully set my form to be a child, as my form no longer shows up in the Task Bar or Task Switcher (Alt Tab), but all I see is a brief flash of my form and then it is hidden.
I have played around with every combination of setting on the .net form and/or win api calls that I can think of, so I leave it to you my excellent peers, to tell me what I am doing wrong.
I thank you all in advance for any help you can offer. Please let me know if there is anything else I can elaborate on to make my situation more clear.
Regaurds
The Nighthawk,
"Don't try to reinvent the wheel, unless you can make it better.
I am a VB.Net developer, creating a vb.net application that "hooks" into a VB6 application. When the VB6 application starts up it calls my dll via COM, and my code opens up a form. That is all well and good, but I want my form to act as a child of the VB6 app. My goal is to have a floating tool window similar to the Find window in Visual Studio. The simple thing to do would be to set my form's TopMost property to true, but I don't want it to be on top of every form, just on top of the VB6 app.
I have tried using the SetParent Win32 API call. Here is an example of the pseudo code I have used:
Dim hVb6App as IntPtr = win32.FindWindow(IntPtr.Zero, IntPtr.Zero, strClassName, strApplicationName)
dim hDotNetForm as IntPtr = myForm.Handle
SetWindowLong(hDotNetForm, GWL_STYLE, WS_CHILD Or WS_VISIBLE)
SetParent(hDotNetForm, hVb6App)
This seems to successfully set my form to be a child, as my form no longer shows up in the Task Bar or Task Switcher (Alt Tab), but all I see is a brief flash of my form and then it is hidden.
I have played around with every combination of setting on the .net form and/or win api calls that I can think of, so I leave it to you my excellent peers, to tell me what I am doing wrong.
I thank you all in advance for any help you can offer. Please let me know if there is anything else I can elaborate on to make my situation more clear.
Regaurds
The Nighthawk,
"Don't try to reinvent the wheel, unless you can make it better.