WinAPI::shellExecute() Method
Today I wanted to continue my post about the WinAPI class, and it's different methods. Something that is Very useful, and can be incorporated with launching websites, or other applications, etc. is the WinAPI::shellExecute() method. This method take variables, and based on what you send will launch as application, through the OS shell execute.
If anyone has every done any windows development, prior to or outside of X++, then most likely you have used the ShellExecute before.
Below is sample code that shows you how to launch IE, and feed IE a web site to launch, which happens to be a static HTML page in my c:\temp folder.
server static void WinAPITest(Args _args)
{
;
// WinAPI::shellExecute() returns an int value. 1 being that everything launched ok, 0 being a problem. (usually path, etc.)
// WinAPI::shellExecute(FileName _lpFile,[str _lpParameters, str _lpDirectory, str _lpOperation, int _show]);
// example
WinAPI::shellExecute("explorer.exe","c:\\temp\\TempInv.html","c:\\","",1);
}
If you copy and paste the above into a job, you will see the comments, and see it run like a champ! Of course instead of sending the static HTML page to launch you could also send an UNC path, or http:// path.
Well that's all for now!
Visit Hillstar Business Intelligence (www.HillstarBI.com) in order to truly unlock your data trapped in your Microsoft Dynamics investment. With our value driven business intelligence strategy Hillstar help you transform into a data informed company.
Find a job at: www.DynamicsAXJobs.com
If anyone has every done any windows development, prior to or outside of X++, then most likely you have used the ShellExecute before.
Below is sample code that shows you how to launch IE, and feed IE a web site to launch, which happens to be a static HTML page in my c:\temp folder.
server static void WinAPITest(Args _args)
{
;
// WinAPI::shellExecute() returns an int value. 1 being that everything launched ok, 0 being a problem. (usually path, etc.)
// WinAPI::shellExecute(FileName _lpFile,[str _lpParameters, str _lpDirectory, str _lpOperation, int _show]);
// example
WinAPI::shellExecute("explorer.exe","c:\\temp\\TempInv.html","c:\\","",1);
}
If you copy and paste the above into a job, you will see the comments, and see it run like a champ! Of course instead of sending the static HTML page to launch you could also send an UNC path, or http:// path.
Well that's all for now!
Visit Hillstar Business Intelligence (www.HillstarBI.com) in order to truly unlock your data trapped in your Microsoft Dynamics investment. With our value driven business intelligence strategy Hillstar help you transform into a data informed company.
Find a job at: www.DynamicsAXJobs.com
0 Comments:
Post a Comment
<< Home