473,323 Members | 1,570 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,323 software developers and data experts.

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 1215

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: 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: 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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.