I know it's not a GUI question, but I don't have any other choice:
This is regading the Desktop functions in the AdminMisc Module.
I have simplified the example that came with the module,
but I still can't get it to work.
The original example doesn't work either.
The problem is with the CreateProcess function.
For some reason, it isn't running the process.
GetLastError is returning "The handle is invalid"
I think I have tried everything, what have I missed???
------------------------
Output:
Creating test:
Created the test desktop at 76!
?=The operation completed successfully.
Switched to test:
?=The operation completed successfully.
Creating Process on test:
?=The handle is invalid.
pid for test=0
Removing test:
?=The system cannot find the file specified.
done...
--------------------------
Code:
use Win32;
use Win32::AdminMisc;
$DT = "test";
print "Creating $DT:\n";
$DeskTopHandle = Win32::AdminMisc::CreateDeskTop( $DT );
print "\tCreated the $DT desktop at $DeskTopHandle!\n";
print "\t?=" . Win32::FormatMessage( Win32::GetLastError() ) . "\n";
print "Switched to $DT:\n";
Win32::AdminMisc::SwitchDeskTop( $DT );
print "\t?=",Win32::FormatMessage( Win32::GetLastError() ), "\n";
print "Creating Process on $DT:\n";
$pid = Win32::AdminMisc::CreateProcess("explorer.exe /NoUI",
Desktop=>"test",);
print "\t?=",Win32::FormatMessage( Win32::GetLastError() ), "\n";
print "pid for $DT=$pid\n";
sleep(5);
Win32::AdminMisc::SwitchDeskTop( 'default' );
print "Removing $DT:\n";
Win32::AdminMisc::RemoveDeskTop( $DeskTopHandle );
print "\t?=",Win32::FormatMessage( Win32::GetLastError() ), "\n";
print "\ndone...\n\n\n";