Re: Problem in using Win32::Process::Create



On Jul 24, 4:06 pm, "Sisyphus" <sisyph...@xxxxxxxxxxxxxxxxx> wrote:
"sachin" <sachinahuj...@xxxxxxxxx> wrote in message

news:1185272719.207893.142110@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
.
.





Following is the code I have written,
***************************************************************************­*****************
use Win32::Process;
use Win32;

$GPIBPath = "C:\\Project\\GPIB\\GPIB.V2\\bin\\GPIB.exe";
@GPIBArg = ("5","3.2","10","2","1");

Win32::Process::Create($GPIBObj,
$GPIBPath,
@GPIBArg,
0,
NORMAL_PRIORITY_CLASS,
".") || die ErrorReport();

$GPIBObj->Wait(INFINITE);

sub ErrorReport{
print Win32::FormatMessage( Win32::GetLastError() );
}
***************************************************************************­*******************
When I execute this pl file using command prompt, i get the following
error
Usage: Win32::Process::Create(cP , appname , cmdline , inherit ,
flags , curdir) at file_handling.pl line 7

When you get a "Usage: ..." error, that generally means there is something
wrong with the arguments you supplied.
In this case it's the third argument (@GPIBArg) that's the problem.
I think that replacing that third arg to Win32::Process::Create() with
either:
"GPIB @GPIBArg",
or
"$GPIBPath @GPIBArg",
or
"GPIB 5 3.2 10 2 1",
or
"$GPIBPath 5 3.2 10 2 1",
should work.

See the example given at the start of 'perldoc Win32::Process'. Note that
the 3rd arg needs to be the actual command line command that you want to
run.
It's one of the strange quirks of Win32::Process that the 3rd arg needs to
repeat something that can be derived from the 2nd arg.

Cheers,
Rob- Hide quoted text -

- Show quoted text -




Thanks for your advice.
I have used the following parameter sequence.
$GPIBPath = "5 3.2 10 2 1";
And it is running fine.

.



Relevant Pages