473,500 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1944
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
4253
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
4462
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
6282
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
3172
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
1215
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
3269
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
3125
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
10609
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
8047
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
7136
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7018
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7182
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7232
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
4923
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4611
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3106
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
672
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
316
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.