--- a/Win32OperatingSystem.st Fri Jul 05 14:33:44 2013 +0200
+++ b/Win32OperatingSystem.st Fri Jul 05 14:36:41 2013 +0200
@@ -824,6 +824,7 @@
"Modified: 7.1.1997 / 19:36:11 / stefan"
! !
+
!Win32OperatingSystem class methodsFor:'OS signal constants'!
sigABRT
@@ -3784,7 +3785,9 @@
shellExecute:hwndArg lpOperation:lpOperationArg lpFile:lpFileArg lpParameters:lpParametersArg lpDirectory:lpDirectoryArg 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"
+ Can be used to open a browser or viewer on html-files, pdf-files etc.
+ lpDirectory: the pathname string of the directory used for the command,
+ or nil for the current directory."
|errorNumber handle|
@@ -3795,102 +3798,102 @@
shExecInfo.cbSize = sizeof(shExecInfo);
if (__isSmallInteger(nShowCmd)) {
- shExecInfo.nShow = __intVal(nShowCmd);
+ shExecInfo.nShow = __intVal(nShowCmd);
} else {
- if (nShowCmd == @symbol(SW_SHOW)) {
- shExecInfo.nShow = SW_SHOW;
- } else if (nShowCmd == @symbol(SW_SHOWNORMAL)) {
- shExecInfo.nShow = SW_SHOWNORMAL;
- } else if (nShowCmd == @symbol(SW_SHOWDEFAULT)) {
- shExecInfo.nShow = SW_SHOWDEFAULT;
- } else if (nShowCmd == @symbol(SW_SHOWMAXIMIZED)) {
- shExecInfo.nShow = SW_SHOWMAXIMIZED;
- } else if (nShowCmd == @symbol(SW_SHOWMINIMIZED)) {
- shExecInfo.nShow = SW_SHOWMINIMIZED;
- } else if (nShowCmd == @symbol(SW_SHOWMINNOACTIVE)) {
- shExecInfo.nShow = SW_SHOWMINNOACTIVE;
- } else if (nShowCmd == @symbol(SW_SHOWNA)) {
- shExecInfo.nShow = SW_SHOWNA;
- } else if (nShowCmd == @symbol(SW_SHOWNOACTIVATE)) {
- shExecInfo.nShow = SW_SHOWNOACTIVATE;
- } else if (nShowCmd == @symbol(SW_MAXIMIZE)) {
- shExecInfo.nShow = SW_MAXIMIZE;
- } else if (nShowCmd == @symbol(SW_RESTORE)) {
- shExecInfo.nShow = SW_RESTORE;
- } else {
- goto badArgument;
- }
+ if (nShowCmd == @symbol(SW_SHOW)) {
+ shExecInfo.nShow = SW_SHOW;
+ } else if (nShowCmd == @symbol(SW_SHOWNORMAL)) {
+ shExecInfo.nShow = SW_SHOWNORMAL;
+ } else if (nShowCmd == @symbol(SW_SHOWDEFAULT)) {
+ shExecInfo.nShow = SW_SHOWDEFAULT;
+ } else if (nShowCmd == @symbol(SW_SHOWMAXIMIZED)) {
+ shExecInfo.nShow = SW_SHOWMAXIMIZED;
+ } else if (nShowCmd == @symbol(SW_SHOWMINIMIZED)) {
+ shExecInfo.nShow = SW_SHOWMINIMIZED;
+ } else if (nShowCmd == @symbol(SW_SHOWMINNOACTIVE)) {
+ shExecInfo.nShow = SW_SHOWMINNOACTIVE;
+ } else if (nShowCmd == @symbol(SW_SHOWNA)) {
+ shExecInfo.nShow = SW_SHOWNA;
+ } else if (nShowCmd == @symbol(SW_SHOWNOACTIVATE)) {
+ shExecInfo.nShow = SW_SHOWNOACTIVATE;
+ } else if (nShowCmd == @symbol(SW_MAXIMIZE)) {
+ shExecInfo.nShow = SW_MAXIMIZE;
+ } else if (nShowCmd == @symbol(SW_RESTORE)) {
+ shExecInfo.nShow = SW_RESTORE;
+ } else {
+ goto badArgument;
+ }
}
if (((lpOperationArg == nil) || __isStringLike(lpOperationArg))
&& ((lpFileArg == nil) || __isStringLike(lpFileArg))
&& ((lpParametersArg == nil) || __isStringLike(lpParametersArg))
&& ((lpDirectoryArg == nil) || __isStringLike(lpDirectoryArg))
) {
- // hProcess member receives the process handle
- shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
-
- shExecInfo.hwnd = 0;
- shExecInfo.lpVerb = (lpOperationArg != nil) ? __stringVal(lpOperationArg) : NULL;
- shExecInfo.lpFile = (lpFileArg != nil) ? __stringVal(lpFileArg) : NULL;
- shExecInfo.lpParameters = (lpParametersArg != nil) ? __stringVal(lpParametersArg) : NULL;
- shExecInfo.lpDirectory = (lpDirectoryArg != nil) ? __stringVal(lpDirectoryArg) : NULL;
- if (hwndArg != nil) {
- if (__isExternalAddressLike(hwndArg)) {
- shExecInfo.hwnd = (HANDLE)(__externalAddressVal(hwndArg));
- } else
- goto badArgument;
- }
- if (ShellExecuteEx(&shExecInfo)) {
- if (shExecInfo.hProcess) {
- DWORD_PTR processAffinityMask, systemAffinityMask;
- /*
- * Set the affinity mask
- * to any processor, and resume the processes main thread.
- * (librun/process.s limited the affinity to a single processor).
- */
- 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 */
- } else {
- RETURN (self); /* OK */
- }
- } else {
- /* error */
- errorNumber = __mkSmallInteger(__WIN32_ERR(GetLastError()));
- }
+ // hProcess member receives the process handle
+ shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
+
+ shExecInfo.hwnd = 0;
+ shExecInfo.lpVerb = (lpOperationArg != nil) ? __stringVal(lpOperationArg) : NULL;
+ shExecInfo.lpFile = (lpFileArg != nil) ? __stringVal(lpFileArg) : NULL;
+ shExecInfo.lpParameters = (lpParametersArg != nil) ? __stringVal(lpParametersArg) : NULL;
+ shExecInfo.lpDirectory = (lpDirectoryArg != nil) ? __stringVal(lpDirectoryArg) : NULL;
+ if (hwndArg != nil) {
+ if (__isExternalAddressLike(hwndArg)) {
+ shExecInfo.hwnd = (HANDLE)(__externalAddressVal(hwndArg));
+ } else
+ goto badArgument;
+ }
+ if (ShellExecuteEx(&shExecInfo)) {
+ if (shExecInfo.hProcess) {
+ DWORD_PTR processAffinityMask, systemAffinityMask;
+ /*
+ * Set the affinity mask
+ * to any processor, and resume the processes main thread.
+ * (librun/process.s limited the affinity to a single processor).
+ */
+ 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 */
+ } else {
+ RETURN (self); /* OK */
+ }
+ } else {
+ /* error */
+ errorNumber = __mkSmallInteger(__WIN32_ERR(GetLastError()));
+ }
}
badArgument: ;
%}.
errorNumber isNil ifTrue:[
- self primitiveFailed:'invalid argument(s)'.
+ self primitiveFailed:'invalid argument(s)'.
] ifFalse:[
- (OperatingSystem errorHolderForNumber:errorNumber)
- parameter:lpFileArg;
- reportError
+ (OperatingSystem errorHolderForNumber:errorNumber)
+ parameter:lpFileArg;
+ reportError
].
"
self
- shellExecute:nil
- lpOperation:'open'
- lpFile:(Filename currentDirectory pathName)
- lpParameters:nil
- lpDirectory:(Filename currentDirectory pathName)
- nShowCmd:#SW_SHOWNORMAL
+ shellExecute:nil
+ lpOperation:'open'
+ lpFile:(Filename currentDirectory pathName)
+ lpParameters:nil
+ lpDirectory:nil
+ nShowCmd:#SW_SHOWNORMAL
self
- shellExecute:nil
- lpOperation:'explore'
- lpFile:(Filename currentDirectory pathName)
- lpParameters:nil
- lpDirectory:(Filename currentDirectory pathName)
- nShowCmd:#SW_SHOWNORMAL
+ shellExecute:nil
+ lpOperation:'explore'
+ lpFile:(Filename currentDirectory pathName)
+ lpParameters:nil
+ lpDirectory:nil
+ nShowCmd:#SW_SHOWNORMAL
"
!
@@ -9804,32 +9807,31 @@
!Win32OperatingSystem class methodsFor:'shell operations'!
-openApplicationForDocument:aFilenameOrString operation:operationSymbol
+openApplicationForDocument:fileOrUrl operation:operationSymbol mimeType:mimeType
"open a windows-shell application to present the document contained in aFilenameOrString.
This looks for the files extension, and is typically used to present help-files,
html documents, pdf documents etc.
operationSymbol is one of:
- open
- edit
- explore
- print
- "
-
- |result filename|
-
- filename := aFilenameOrString asFilename.
- result := self
- shellExecute:nil
- lpOperation:operationSymbol
- lpFile:filename pathName
- lpParameters:nil
- lpDirectory:filename directory pathName
- nShowCmd:#SW_SHOWNORMAL.
- ^ self.
+ open
+ edit
+ explore
+ print
+ "
+
+ self
+ shellExecute:nil
+ lpOperation:operationSymbol
+ lpFile:fileOrUrl asString
+ lpParameters:nil
+ lpDirectory:nil "/ uses the current directory
+ nShowCmd:#SW_SHOWNORMAL.
+
"
self openApplicationForDocument: Filename currentDirectory operation:#open
+ self openApplicationForDocument: 'C:\' operation:#open
self openApplicationForDocument: '..\..\doc\books\ArtOfSmalltalk\artMissing186187Fix1.pdf' asFilename operation:#open
+ self openApplicationForDocument: 'http://www.exept.de' asFilename operation:#open
self openApplicationForDocument: 'C:\WINDOWS\Help\clipbrd.chm' asFilename operation:#open
"
@@ -17140,15 +17142,15 @@
!Win32OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.468 2013-07-04 19:34:59 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.469 2013-07-05 12:36:41 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.468 2013-07-04 19:34:59 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.469 2013-07-05 12:36:41 stefan Exp $'
!
version_SVN
- ^ '$Id: Win32OperatingSystem.st,v 1.468 2013-07-04 19:34:59 stefan Exp $'
+ ^ '$Id: Win32OperatingSystem.st,v 1.469 2013-07-05 12:36:41 stefan Exp $'
! !