Ok guys, i'm newbie in perl si i've got one question. Look at that code
#!perl -w
use Win32::API;
$CreateProcess = new Win32::API('Kernel32', 'CreateProcess', 'PPSSIDIPSS', 'N');
if(not defined $CreateProcess) {
die "Failed to load library CreateProcess: $!\n";
}
my $strup = Win32::API::Struct->typedef('STARTUPINFO', qw(
DWORD cb;
LPTSTR lpReserved;
LPTSTR lpDesktop;
LPTSTR lpTitle;
DWORD dwX;
DWORD dwY;
DWORD dwXSize;
DWORD dwYSize;
DWORD dwXCountChars;
DWORD dwYCountChars;
DWORD dwFillAttribute;
DWORD dwFlags;
WORD wShowWindow;
WORD cbReserved2;
LPBYTE lpReserved2;
HANDLE hStdInput;
HANDLE hStdOutput;
HANDLE hStdError;
));
my $procinfo = Win32::API::Struct->typedef('PROCESS_INFORMATION', qw(
HANDLE hProcess;
HANDLE hThread;
DWORD dwProcessId;
DWORD dwThreadId;
));
$CreateProcess->Call(
'explorer.exe',
0,
0,
0,
0,
16,
0,
0,
$strup,
$procinfo);
The number 16 in the CreateProcess parameters is CREATE_NEW_CONSOLE = 0x00000010 as is described in the msdn.
The problem is when i start the script there is an error. Why ?!