F
Fitzgerald,Greg
I am trying to launch a Windoze application and then wait for the app to
close before continuing. If I were on a Unix variant I'd do this:
fork { exec("myApp") }
Process.wait
But unfortunately, fork is not implemented for Ruby on Windows. A DOS
limitation I assume?
Using the raw Win32 API, I can do this (in C):
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = "myApp.exe";
ShExecInfo.lpParameters = "";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = NULL;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx( &ShExecInfo );
WaitForSingleObject( ShExecInfo );
Is there a way on Windows that I can wait for the app to close that's as
elegant as the Unix way? I only need it to work on Windows but just out
of curiosity, is there a platform independent way?
Thanks,
Greg
P.S. I apologize for the message at the bottom here. It automatically
gets tacked onto the end of all outgoing mail, and I just love getting
Ruby email at work.
CONFIDENTIALITY NOTICE
This message and any included attachments
are from Cerner Corporation and are intended
only for the addressee. The information
contained in this message is confidential and
may constitute inside or non-public information
under international, federal, or state
securities laws. Unauthorized forwarding,
printing, copying, distribution, or use of such
information is strictly prohibited and may be
unlawful. If you are not the addressee, please
promptly delete this message and notify the
sender of the delivery error by e-mail or you
may call Cerner's corporate offices in Kansas
City, Missouri, U.S.A at (+1) (816)221-1024.
---------------------------------------- --
close before continuing. If I were on a Unix variant I'd do this:
fork { exec("myApp") }
Process.wait
But unfortunately, fork is not implemented for Ruby on Windows. A DOS
limitation I assume?
Using the raw Win32 API, I can do this (in C):
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = "myApp.exe";
ShExecInfo.lpParameters = "";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = NULL;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx( &ShExecInfo );
WaitForSingleObject( ShExecInfo );
Is there a way on Windows that I can wait for the app to close that's as
elegant as the Unix way? I only need it to work on Windows but just out
of curiosity, is there a platform independent way?
Thanks,
Greg
P.S. I apologize for the message at the bottom here. It automatically
gets tacked onto the end of all outgoing mail, and I just love getting
Ruby email at work.
CONFIDENTIALITY NOTICE
This message and any included attachments
are from Cerner Corporation and are intended
only for the addressee. The information
contained in this message is confidential and
may constitute inside or non-public information
under international, federal, or state
securities laws. Unauthorized forwarding,
printing, copying, distribution, or use of such
information is strictly prohibited and may be
unlawful. If you are not the addressee, please
promptly delete this message and notify the
sender of the delivery error by e-mail or you
may call Cerner's corporate offices in Kansas
City, Missouri, U.S.A at (+1) (816)221-1024.
---------------------------------------- --