472,800 Members | 1,226 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,800 software developers and data experts.

embed a VB Standard EXE in a .Net Windows app - in-place activatio

I am having an existing VB 6 standard .EXE application. Now I am developing a
wrapper application in .Net and I want to launch the VB 6 exe app embedded
with
in the .Net App window. That is, the standard EXE application should be
activated in-place within the .Net window and should be confined within the
..Net app window.

Any suggestions on how I go about doing this stuff?

This is a repeat post for the new visitors.
Jul 21 '05 #1
2 1910
A good place to start is probably this codeproject article:

http://www.codeproject.com/cs/miscctrl/AppControl.asp

Note that it doesn't work out of the box with VB6 exes, though. I know
a guy who figured that part out, though, so I'll ask him about it.
Raghavendran Muraleetharan wrote:
I am having an existing VB 6 standard .EXE application. Now I am developing a
wrapper application in .Net and I want to launch the VB 6 exe app embedded
with
in the .Net App window. That is, the standard EXE application should be
activated in-place within the .Net window and should be confined within the
.Net app window.

Any suggestions on how I go about doing this stuff?

This is a repeat post for the new visitors.

Jul 21 '05 #2
Okay, here goes.

To launch a vb6 exe as a child of a winform, you can make the following
changes to the control in the CodeProject article:

Where it grabs the window handle to the child app:
// Start the process
p = System.Diagnostics.Process.Start(this.exeName);
// Wait for process to be created and enter idle condition
p.WaitForInputIdle();
// Get the main handle
appWin = p.MainWindowHandle;

Replace the last line with this method call:

// Note, p.MainWindowHandle points to the hidden VB main application
// window (classname ThunderRT6Main)
// that own's the VB Main form window. We need to find the VB Main Form
// window (classname ThunderRT6FormDC)
appWin = FindMainVBForm(p.MainWindowHandle);

And, of course, add the method. This finds the window handle to the
real VB6 form instead of the hidden one that is the mainwindowhandle of
the process.

/// <summary>
/// VB Applications have a hidden top window which own's the window that
/// is the main VB form. The OwnerWindow is a pointer to this hidden
/// window.
/// This window is not the parent of the main VB form (classname
/// ThunderRT6FormDC). So we need to loop through all the windows to
/// find the window that has the OwnerWindow as it's owner.
/// </summary>
/// <param name="OwnerWindow">Pointer to OwnerWindow (classname
/// ThunderFormRT6Main</param>
/// <returns></returns>
private IntPtr FindMainVBForm( IntPtr OwnerWindow )
{
IntPtr pCurWindow = GetWindow(OwnerWindow, GW_HWNDFIRST );
while( pCurWindow != IntPtr.Zero )
{
// Check
if( GetWindow( pCurWindow, GW_OWNER ) == OwnerWindow )
{
break;
}
pCurWindow = GetWindow(pCurWindow, GW_HWNDNEXT );
}
return pCurWindow;
}

Craig Vermeer wrote:
A good place to start is probably this codeproject article:

http://www.codeproject.com/cs/miscctrl/AppControl.asp

Note that it doesn't work out of the box with VB6 exes, though. I know
a guy who figured that part out, though, so I'll ask him about it.
Raghavendran Muraleetharan wrote:
I am having an existing VB 6 standard .EXE application. Now I am
developing a wrapper application in .Net and I want to launch the VB 6
exe app embedded with
in the .Net App window. That is, the standard EXE application should
be activated in-place within the .Net window and should be confined
within the .Net app window.

Any suggestions on how I go about doing this stuff?

This is a repeat post for the new visitors.

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: gsb | last post by:
I'd like to get the offset coordinates, top & left, of an embedded Flash movie. <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ...
11
by: Anna | last post by:
Hi all. I want to embed the EMBED tag in the object tag. I understood that I need to provide a PARAM tag inside the OBJECT whose value will hold the content of EMBED src attribute, but after...
10
by: Anna | last post by:
Hi all. I don't have a very deep understanding of CSS and this question might sound stupid for you. Sorry for that. Can the overflow CSS property be applied to the embed tag? I have an embed...
1
by: Frances Del Rio | last post by:
I have this tag to embed a video: <EMBED type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" SRC="video.wmv" name="Video"...
0
by: Peter | last post by:
Hi Windows application embed IE control embed applet <--- this is the way i know that emebd a java app into a windows app, but the disadvantage is slow, because applet take a longer time to load...
2
by: Annu | last post by:
Hi I need help on <enbed> tag. Following code(No 1) is working properly on windows but on linux code no.2 is not working Code No 1: <EMBED type='application/x-mplayer2' ...
13
by: Lloyd Dupont | last post by:
In the good old days I believe people were using the arcane technology which came to be known as COM+ to embed other application's document in their own document. Like a Word with document a...
4
by: yawnmoth | last post by:
I'm currious - how do applet, object, and embed compare to one another? They seem to me to mostly do the same thing, so why would one chose one over another?
2
dream party
by: dream party | last post by:
Inserting a Flash (SWF, FLV) file into HTML web page is already an old and familiar thing to all of us. It is a rather non-flexible thing that just to edit some options in the template. However, I...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.