473,322 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 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 1937
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.