--- a/Win32OperatingSystem.st Fri Jan 26 14:17:00 2007 +0100
+++ b/Win32OperatingSystem.st Fri Jan 26 14:24:15 2007 +0100
@@ -5132,28 +5132,29 @@
|result|
Error
- handle:[:ex |
- self halt
- ] do:[
- |filename|
-
- filename := aFilenameOrString asFilename.
- result := self
- shellExecute:nil
- lpOperation:'open'
- lpFile:filename pathName
- lpParameters:nil
- lpDirectory:filename directory pathName
- nShowCmd:#SW_SHOWNORMAL.
- ^ self.
- ]
+ handle:[:ex |
+ self halt
+ ] do:[
+ |filename|
+
+ filename := aFilenameOrString asFilename.
+ result := self
+ shellExecute:nil
+ lpOperation:'open'
+ lpFile:filename pathName
+ lpParameters:nil
+ lpDirectory:filename directory pathName
+ nShowCmd:#SW_SHOWNORMAL.
+ ^ self.
+ ]
"
self openDocumentationFilename: 'C:\WINDOWS\Help\clipbrd.chm' asFilename
+ self openDocumentationFilename: Filename currentDirectory
"
"Created: / 04-08-2006 / 18:04:52 / fm"
- "Modified: / 21-09-2006 / 09:41:45 / cg"
+ "Modified: / 26-01-2007 / 14:05:44 / cg"
!
openHelpFile: helpFilename inContextID: contextID withOwner: anApplicationModel
@@ -7972,109 +7973,124 @@
"
HINSTANCE ShellExecute(
- HWND hwnd, // handle to parent window
- LPCTSTR lpOperation, // pointer to string that specifies operation to perform
- LPCTSTR lpFile, // pointer to filename or folder name string
- LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters
- LPCTSTR lpDirectory, // pointer to string that specifies default directory
- INT nShowCmd // whether file is shown when opened
+ HWND hwnd, // handle to parent window
+ LPCTSTR lpOperation, // pointer to string that specifies operation to perform
+ LPCTSTR lpFile, // pointer to filename or folder name string
+ LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters
+ LPCTSTR lpDirectory, // pointer to string that specifies default directory
+ INT nShowCmd // whether file is shown when opened
);
"
"/ <apicall: long 'ShellExecuteA' (long char* char* char* char* ulong) module:'shell32.dll'>
%{
- unsigned long __nShowCmd = 0;
-
- if (__isSmallInteger(nShowCmd)) {
- __nShowCmd = __intVal(nShowCmd);
- } else {
- if (nShowCmd == @symbol(SW_SHOW)) {
- __nShowCmd = SW_SHOW;
- }
- if (nShowCmd == @symbol(SW_SHOWNORMAL)) {
- __nShowCmd = SW_SHOWNORMAL;
- }
- if (nShowCmd == @symbol(SW_SHOWDEFAULT)) {
- __nShowCmd = SW_SHOWDEFAULT;
- }
- if (nShowCmd == @symbol(SW_SHOWMAXIMIZED)) {
- __nShowCmd = SW_SHOWMAXIMIZED;
- }
- if (nShowCmd == @symbol(SW_SHOWMINIMIZED)) {
- __nShowCmd = SW_SHOWMINIMIZED;
- }
- if (nShowCmd == @symbol(SW_SHOWMINNOACTIVE)) {
- __nShowCmd = SW_SHOWMINNOACTIVE;
- }
- if (nShowCmd == @symbol(SW_SHOWNA)) {
- __nShowCmd = SW_SHOWNA;
- }
- if (nShowCmd == @symbol(SW_SHOWNOACTIVATE)) {
- __nShowCmd = SW_SHOWNOACTIVATE;
- }
- if (nShowCmd == @symbol(SW_MAXIMIZE)) {
- __nShowCmd = SW_MAXIMIZE;
- }
- if (nShowCmd == @symbol(SW_RESTORE)) {
- __nShowCmd = SW_RESTORE;
- }
- }
-
- if (((lpOperation == nil) || __isString(lpOperation))
- && ((lpFile == nil) || __isString(lpFile))
- && ((lpParameters == nil) || __isString(lpParameters))
- && ((lpDirectory == nil) || __isString(lpDirectory))
- ) {
- HANDLE __hwnd = 0;
- char *__lpOperation = (lpOperation != nil) ? __stringVal(lpOperation) : NULL;
- char *__lpFile = (lpFile != nil) ? __stringVal(lpFile) : NULL;
- char *__lpParameters = (lpParameters != nil) ? __stringVal(lpParameters) : NULL;
- char *__lpDirectory = (lpDirectory != nil) ? __stringVal(lpDirectory) : NULL;
- long result;
-
- if (hwnd != nil) {
- if (__isExternalAddressLike(hwnd)) {
- HANDLE __hwnd = (HANDLE)(__externalAddressVal(hwnd));
- } else
- goto badArgument;
- }
- result = ShellExecuteA(__hwnd, __lpOperation, __lpFile, __lpParameters, __lpDirectory, __nShowCmd);
-
- /* MS programmers are brain damaged - here's the proof... */
- if (result > 32) {
- RETURN ( self ); /* OK */
- }
-
- switch (result) {
- case 0:
- case SE_ERR_OOM:
- result = ERROR_NOT_ENOUGH_MEMORY;
- break;
-
- case SE_ERR_ACCESSDENIED:
- result = ERROR_ACCESS_DENIED;
- break;
-
- case SE_ERR_FNF:
- result = ERROR_FILE_NOT_FOUND;
- break;
-
- case SE_ERR_PNF:
- result = ERROR_PATH_NOT_FOUND;
- break;
-
- default:
- result = ERROR_INVALID_FUNCTION;
- break;
- }
- errorNumber = __MKUINT( result );
- }
+ unsigned long __nShowCmd = 0;
+
+ if (__isSmallInteger(nShowCmd)) {
+ __nShowCmd = __intVal(nShowCmd);
+ } else {
+ if (nShowCmd == @symbol(SW_SHOW)) {
+ __nShowCmd = SW_SHOW;
+ } else if (nShowCmd == @symbol(SW_SHOWNORMAL)) {
+ __nShowCmd = SW_SHOWNORMAL;
+ } else if (nShowCmd == @symbol(SW_SHOWDEFAULT)) {
+ __nShowCmd = SW_SHOWDEFAULT;
+ } else if (nShowCmd == @symbol(SW_SHOWMAXIMIZED)) {
+ __nShowCmd = SW_SHOWMAXIMIZED;
+ } else if (nShowCmd == @symbol(SW_SHOWMINIMIZED)) {
+ __nShowCmd = SW_SHOWMINIMIZED;
+ } else if (nShowCmd == @symbol(SW_SHOWMINNOACTIVE)) {
+ __nShowCmd = SW_SHOWMINNOACTIVE;
+ } else if (nShowCmd == @symbol(SW_SHOWNA)) {
+ __nShowCmd = SW_SHOWNA;
+ } else if (nShowCmd == @symbol(SW_SHOWNOACTIVATE)) {
+ __nShowCmd = SW_SHOWNOACTIVATE;
+ } else if (nShowCmd == @symbol(SW_MAXIMIZE)) {
+ __nShowCmd = SW_MAXIMIZE;
+ } else if (nShowCmd == @symbol(SW_RESTORE)) {
+ __nShowCmd = SW_RESTORE;
+ } else {
+ goto badArgument;
+ }
+ }
+
+ if (((lpOperation == nil) || __isString(lpOperation))
+ && ((lpFile == nil) || __isString(lpFile))
+ && ((lpParameters == nil) || __isString(lpParameters))
+ && ((lpDirectory == nil) || __isString(lpDirectory))
+ ) {
+ HANDLE __hwnd = 0;
+ char *__lpOperation = (lpOperation != nil) ? __stringVal(lpOperation) : NULL;
+ char *__lpFile = (lpFile != nil) ? __stringVal(lpFile) : NULL;
+ char *__lpParameters = (lpParameters != nil) ? __stringVal(lpParameters) : NULL;
+ char *__lpDirectory = (lpDirectory != nil) ? __stringVal(lpDirectory) : NULL;
+ long result;
+
+ if (hwnd != nil) {
+ if (__isExternalAddressLike(hwnd)) {
+ __hwnd = (HANDLE)(__externalAddressVal(hwnd));
+ } else
+ goto badArgument;
+ }
+ result = ShellExecuteA(__hwnd, __lpOperation, __lpFile, __lpParameters, __lpDirectory, __nShowCmd);
+
+ /* MS programmers are brain damaged - here's the proof... */
+ if (result > 32) {
+ RETURN ( self ); /* OK */
+ }
+
+ switch (result) {
+ case 0:
+ case SE_ERR_OOM:
+ result = ERROR_NOT_ENOUGH_MEMORY;
+ break;
+
+ case SE_ERR_ACCESSDENIED:
+ result = ERROR_ACCESS_DENIED;
+ break;
+
+ case SE_ERR_FNF:
+ result = ERROR_FILE_NOT_FOUND;
+ break;
+
+ case SE_ERR_PNF:
+ result = ERROR_PATH_NOT_FOUND;
+ break;
+
+ default:
+ result = ERROR_INVALID_FUNCTION;
+ break;
+ }
+ errorNumber = __MKUINT( result );
+ }
badArgument: ;
%}.
errorNumber isNil ifTrue:[
- self error:'invalid argument(s)'.
+ self error:'invalid argument(s)'.
] ifFalse:[
- (OperatingSystem errorHolderForNumber:errorNumber) reportError
- ].
+ (OperatingSystem errorHolderForNumber:errorNumber) reportError
+ ].
+
+ "
+ self openDocumentationFilename: Filename currentDirectory
+
+ self
+ shellExecute:nil
+ lpOperation:'open'
+ lpFile:(Filename currentDirectory pathName)
+ lpParameters:nil
+ lpDirectory:(Filename currentDirectory pathName)
+ nShowCmd:#SW_SHOWNORMAL
+
+ self
+ shellExecute:nil
+ lpOperation:'explore'
+ lpFile:(Filename currentDirectory pathName)
+ lpParameters:nil
+ lpDirectory:(Filename currentDirectory pathName)
+ nShowCmd:#SW_SHOWNORMAL
+ "
+
+ "Modified: / 26-01-2007 / 14:16:38 / cg"
! !
!Win32OperatingSystem class methodsFor:'socket support'!
@@ -12729,7 +12745,7 @@
!Win32OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.262 2007-01-24 15:17:49 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.263 2007-01-26 13:24:15 cg Exp $'
! !
Win32OperatingSystem initialize!