473,471 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Accessing Launched Process's UI

Hello,

I need to control a launched app for auto testing purposes. So I have the
following driver program "A" that launches simple app "B".

Driver program A launches app B successfully & sets a reference to app B's
Dll.
It has a button control event handler to initiate the controlling of App B
as follows:

private void btnControlApp_Click(object sender, System.EventArgs e)
{

Form OtherAppMainUI = null;

CScripting.GetMainAppUI(ref OtherAppMainUI);

MessageBox.Show(OtherAppMainUI.ToString());

}

Launched app B is a simple EXE & DLL where the EXE has a reference to the
DLL.

Inside app B's DLL, it exposes exactly this one object, containing a static
variable to hold a reference to the main app B's UI form:

public class CScripting

{

public static Form m_MainUI = null;

public CScripting(ref Form MainUI)

{

m_MainUI = MainUI;

}

public static void GetMainAppUI(ref Form OutForm)

{

OutForm = m_MainUI;

}

}

The main form in app B's EXE declares a variable from the app B's dll:

private CScripting m_DllObj = null;

and in constructor of app B's main form, we have the following code which
instantiates the object from app B's dll, passing in the reference to the
main app B's form:
public TstAutoControl()

{

InitializeComponent();

Form CurrentUI = this;

m_DllObj = new CScripting(ref CurrentUI);

}
The question is, why doesn't this work? When the code in the driver
program's button click event runs, the variable OtherAppMainUI never gets
the reference and the MessageBox.Show() method crashes because the object
reference is not set. I thought this would work since app B's dll object's
variable in question is static ... and therefore be available accross object
instantiations, what gives? How can I make the driver program A receive a
reference to the main form in app B? I realize I'm trying to pass this form
reference accross processes, so how do I pass info from 1 process to
another?

TIA,

--
John C. Bowman
Software Engineer
Thermo Electron Scientific Instruments Div.
<Remove this before reply> jo*********@thermo.com
Nov 16 '05 #1
0 1119

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

Similar topics

0
by: John Bowman | last post by:
Hello, I need to control a launched app for auto testing purposes. So I have the following driver program "A" that launches simple app "B". Driver program A launches app B successfully & sets...
0
by: Erik Herje via .NET 247 | last post by:
Hi, I have a Windows Service written in C# whos purpose is to sniff a folder to look for changes in the folder. If a file is created or changed, it should get its name and start an object the...
1
by: chief tent | last post by:
Basic question: Two C# programs A and B. Program A is launched by the user, then program A launches program B. From program B, I want to get the filename and path of program A (the process that...
3
by: AdamM | last post by:
Hi all, When I run my VbScript, I get the error: "ActiveX component can't create object: 'getobject'. Error 800A01AD". Any ideas what I did wrong? Here's my VBScript: dim o set...
2
by: Ken Stealth | last post by:
Hi, I had to fix this problem once before - after allowing microsoft to install a patch on my XP box. It's been working great for a month and now I'm back searching google, reading books, and...
0
by: PokerJoker | last post by:
I created a monitor program that checks for certain critera and then launches other executables to perform maintenence tasks. One of these executables uses a DLL, when launched by double...
8
by: nkrisraj | last post by:
Hi, I have a following structure: typedef struct { RateData rdr; int RateID; char RateBalance; } RateInfo;
3
by: mayur_hirpara | last post by:
Hi, I am writing a VB.NET application. It is a Windows application at the moment. The application contains a button. the click event of button perform a long running task. It needs to be started...
2
by: siddharthkhare | last post by:
Hi All, I am launching a IE using following code. ======================================================================= m_IeProcess = new Process(); m_IeProcess.StartInfo.WindowStyle =...
2
by: poe | last post by:
Hello, I have a process I want to launch from my application. Here is the current code I'm using to do so: MenuProcess = New Process() MenuProcess.StartInfo.FileName = MenuExecutablePath...
0
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
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
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
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.