Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.Net/VB6/Win32 Question

Status
Not open for further replies.

hawkdernacht

Programmer
Mar 10, 2005
15
US
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.
 
Brian,
Thanks for the follow up. Perhaps I should clarify that I do not have access to the VB6 application code, therefore .Net interop controls don't really apply.

Regaurds

The Nighthawk,
"Don't try to reinvent the wheel, unless you can make it better.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top