Home > Enterprise Portal > Calling external applications from User control in EP

Calling external applications from User control in EP

During EP development , sometimes we need to call third party or external applications. If you need more control over this third party call, for example you want to make sure that the application starts in an invisible mode or the process needs to be killed after a certain time. This way you can hide  the window in case a success message ( 1 file successfully exported) is returned. You can do the same with using WinAPI::shellExecute from X++ and call this code from Visual Studio , but you will not find it as flexible as calling a process from Visual Studio to invoke the external application.

Following is the code to call an external application :

System.Diagnostics.Process  my process = new System.Diagnostics.Process();

myProcess.StartInfo.Filename = "gswin32.exe";

myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden ;

myProcess.StartInfo.CreateNoWindow = True


//Kill the process if it doesn’t finish in one minute.

myProcess.WaitForExit(1000) ;

If(!myProcess.HasExited )





Categories: Enterprise Portal
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: