473,466 Members | 1,395 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 1219

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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.