Win32OperatingSystem.st
changeset 13159 04ecf0207585
parent 13128 35def02e40f4
child 13197 74f2ab2f4c51
--- a/Win32OperatingSystem.st	Wed Dec 01 18:54:15 2010 +0100
+++ b/Win32OperatingSystem.st	Wed Dec 01 20:25:36 2010 +0100
@@ -3731,9 +3731,11 @@
 shellExecute:hwnd lpOperation:lpOperation lpFile:lpFile lpParameters:lpParameters lpDirectory:lpDirectory nShowCmd:nShowCmd
     "Opens or prints the specified file, which can be an executable, document file, or directory.
      If its a directory, an explorer window is opened (see example below).
-     Can be used to open a browser or viewer on html-files, pdf-files etc."
-
-    |errorNumber|
+     Can be used to open a browser or viewer on html-files, pdf-files etc"
+
+    |errorNumber handle|
+
+    handle := Win32ProcessHandle new.
 
 %{
     SHELLEXECUTEINFO shExecInfo = {0};
@@ -3771,7 +3773,9 @@
      && ((lpParameters == nil) || __isStringLike(lpParameters))
      && ((lpDirectory == nil) || __isStringLike(lpDirectory))
     ) {
+	// hProcess member receives the process handle
 	shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
+
 	shExecInfo.hwnd = 0;
 	shExecInfo.lpVerb        = (lpOperation != nil) ? __stringVal(lpOperation) : NULL;
 	shExecInfo.lpFile        = (lpFile != nil) ? __stringVal(lpFile) : NULL;
@@ -3793,9 +3797,17 @@
 		 */
 		GetProcessAffinityMask(shExecInfo.hProcess, &processAffinityMask, &systemAffinityMask);
 		SetProcessAffinityMask(shExecInfo.hProcess, systemAffinityMask);
+
+		// new (does not work, yet):
+		// __externalAddressVal(handle) = shExecInfo.hProcess;
+		// RETURN (handle);
+
+		// old:
 		CloseHandle(shExecInfo.hProcess);
-	    }
-	    RETURN (self); /* OK */
+		RETURN (self); /* OK */
+	    } else {
+		RETURN (self); /* OK */
+	    }
 	} else {
 	    /* error */
 	    errorNumber = __mkSmallInteger(__WIN32_ERR(GetLastError()));
@@ -3803,7 +3815,6 @@
     }
 badArgument: ;
 %}.
-
     errorNumber isNil ifTrue:[
 	self primitiveFailed:'invalid argument(s)'.
     ] ifFalse:[
@@ -16230,11 +16241,11 @@
 !Win32OperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.413 2010-11-16 14:54:12 mb Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.414 2010-12-01 19:25:36 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.413 2010-11-16 14:54:12 mb Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.414 2010-12-01 19:25:36 cg Exp $'
 ! !
 
 Win32OperatingSystem initialize!