Accepting a value form another program

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am creating a popup window based on a value that is sent to me. Another
program is calling the popup windows.

Basically by calling the popup program: C:\screenpop UUI: XXXXXXXX

My question is how do I accept that value into a search text field in my
popup app when the popup app opens
 
Sounds like your interested in input arguements to the windows program....

This is ONE way of doing it:
public class FrmMain : System.Windows.Forms.Form
{
public static string[] Args = null;

#region Main entry point
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
FrmMain.Args = args;

Application.Run(new FrmMain());
}
#endregion

#region Form Events
private void FrmMain_Load(object sender, System.EventArgs e)
{
if ((Args.Length == 2) && System.IO.Directory.Exists(Args[0]) &&
System.IO.Directory.Exists(Args[1]))
{
// I received to arguements which are files that exist...
// Do something with them....
}
else
{
if (Args.Length > 1)
{
if (System.IO.Directory.Exists(Args[0]) == false)
MessageBox.Show(this, string.Format("'{0}' does not exist",
Args[0]), "Directory does not exist",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
if (System.IO.Directory.Exists(Args[1]) == false)
MessageBox.Show(this, string.Format("'{0}' does not exist",
Args[1]), "Directory does not exist",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
#endregion

}
 
I added this code and it doesn't seem to do what I need.

What I need is one the popup windows is called C:\Screenpop UUI: XXXXXXXX

I need the UUI: values of XXXXXXX to populate my Search field in the POPUP
window.

This will initiate a search of a database.

Thanks
Joe
 
Joe,

The example assumes that the calling program is running your popup program
like this:

using System.Diagnostics;


// Note: no space between UUI and XXXXX unless you want them as 2
separate arguments
ProcessStartInfo info = new ProcessStartInfo(
@"C:\Temp\MyPopupProgram.exe", "UUI:XXXXXXXX");
Process proc = Process.Start(info);

UUI:XXXXXX would then be one of the input arguments (i.e. Args[0]), which
you would then parse or whatever you want to do with it.....

Hope this helps.

Dave


JoeD said:
I added this code and it doesn't seem to do what I need.

What I need is one the popup windows is called C:\Screenpop UUI:
XXXXXXXX

I need the UUI: values of XXXXXXX to populate my Search field in the POPUP
window.

This will initiate a search of a database.

Thanks
Joe

D. Yates said:
Sounds like your interested in input arguements to the windows
program....

This is ONE way of doing it:
public class FrmMain : System.Windows.Forms.Form
{
public static string[] Args = null;

#region Main entry point
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
FrmMain.Args = args;

Application.Run(new FrmMain());
}
#endregion

#region Form Events
private void FrmMain_Load(object sender, System.EventArgs e)
{
if ((Args.Length == 2) && System.IO.Directory.Exists(Args[0]) &&
System.IO.Directory.Exists(Args[1]))
{
// I received to arguements which are files that exist...
// Do something with them....
}
else
{
if (Args.Length > 1)
{
if (System.IO.Directory.Exists(Args[0]) == false)
MessageBox.Show(this, string.Format("'{0}' does not
exist",
Args[0]), "Directory does not exist",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
if (System.IO.Directory.Exists(Args[1]) == false)
MessageBox.Show(this, string.Format("'{0}' does not
exist",
Args[1]), "Directory does not exist",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
#endregion

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top