7970 |
7971 |
7971 |errorNumber| |
7972 |errorNumber| |
7972 |
7973 |
7973 " |
7974 " |
7974 HINSTANCE ShellExecute( |
7975 HINSTANCE ShellExecute( |
7975 HWND hwnd, // handle to parent window |
7976 HWND hwnd, // handle to parent window |
7976 LPCTSTR lpOperation, // pointer to string that specifies operation to perform |
7977 LPCTSTR lpOperation, // pointer to string that specifies operation to perform |
7977 LPCTSTR lpFile, // pointer to filename or folder name string |
7978 LPCTSTR lpFile, // pointer to filename or folder name string |
7978 LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters |
7979 LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters |
7979 LPCTSTR lpDirectory, // pointer to string that specifies default directory |
7980 LPCTSTR lpDirectory, // pointer to string that specifies default directory |
7980 INT nShowCmd // whether file is shown when opened |
7981 INT nShowCmd // whether file is shown when opened |
7981 ); |
7982 ); |
7982 " |
7983 " |
7983 "/ <apicall: long 'ShellExecuteA' (long char* char* char* char* ulong) module:'shell32.dll'> |
7984 "/ <apicall: long 'ShellExecuteA' (long char* char* char* char* ulong) module:'shell32.dll'> |
7984 %{ |
7985 %{ |
7985 unsigned long __nShowCmd = 0; |
7986 unsigned long __nShowCmd = 0; |
7986 |
7987 |
7987 if (__isSmallInteger(nShowCmd)) { |
7988 if (__isSmallInteger(nShowCmd)) { |
7988 __nShowCmd = __intVal(nShowCmd); |
7989 __nShowCmd = __intVal(nShowCmd); |
7989 } else { |
7990 } else { |
7990 if (nShowCmd == @symbol(SW_SHOW)) { |
7991 if (nShowCmd == @symbol(SW_SHOW)) { |
7991 __nShowCmd = SW_SHOW; |
7992 __nShowCmd = SW_SHOW; |
7992 } |
7993 } else if (nShowCmd == @symbol(SW_SHOWNORMAL)) { |
7993 if (nShowCmd == @symbol(SW_SHOWNORMAL)) { |
7994 __nShowCmd = SW_SHOWNORMAL; |
7994 __nShowCmd = SW_SHOWNORMAL; |
7995 } else if (nShowCmd == @symbol(SW_SHOWDEFAULT)) { |
7995 } |
7996 __nShowCmd = SW_SHOWDEFAULT; |
7996 if (nShowCmd == @symbol(SW_SHOWDEFAULT)) { |
7997 } else if (nShowCmd == @symbol(SW_SHOWMAXIMIZED)) { |
7997 __nShowCmd = SW_SHOWDEFAULT; |
7998 __nShowCmd = SW_SHOWMAXIMIZED; |
7998 } |
7999 } else if (nShowCmd == @symbol(SW_SHOWMINIMIZED)) { |
7999 if (nShowCmd == @symbol(SW_SHOWMAXIMIZED)) { |
8000 __nShowCmd = SW_SHOWMINIMIZED; |
8000 __nShowCmd = SW_SHOWMAXIMIZED; |
8001 } else if (nShowCmd == @symbol(SW_SHOWMINNOACTIVE)) { |
8001 } |
8002 __nShowCmd = SW_SHOWMINNOACTIVE; |
8002 if (nShowCmd == @symbol(SW_SHOWMINIMIZED)) { |
8003 } else if (nShowCmd == @symbol(SW_SHOWNA)) { |
8003 __nShowCmd = SW_SHOWMINIMIZED; |
8004 __nShowCmd = SW_SHOWNA; |
8004 } |
8005 } else if (nShowCmd == @symbol(SW_SHOWNOACTIVATE)) { |
8005 if (nShowCmd == @symbol(SW_SHOWMINNOACTIVE)) { |
8006 __nShowCmd = SW_SHOWNOACTIVATE; |
8006 __nShowCmd = SW_SHOWMINNOACTIVE; |
8007 } else if (nShowCmd == @symbol(SW_MAXIMIZE)) { |
8007 } |
8008 __nShowCmd = SW_MAXIMIZE; |
8008 if (nShowCmd == @symbol(SW_SHOWNA)) { |
8009 } else if (nShowCmd == @symbol(SW_RESTORE)) { |
8009 __nShowCmd = SW_SHOWNA; |
8010 __nShowCmd = SW_RESTORE; |
8010 } |
8011 } else { |
8011 if (nShowCmd == @symbol(SW_SHOWNOACTIVATE)) { |
8012 goto badArgument; |
8012 __nShowCmd = SW_SHOWNOACTIVATE; |
8013 } |
8013 } |
8014 } |
8014 if (nShowCmd == @symbol(SW_MAXIMIZE)) { |
8015 |
8015 __nShowCmd = SW_MAXIMIZE; |
8016 if (((lpOperation == nil) || __isString(lpOperation)) |
8016 } |
8017 && ((lpFile == nil) || __isString(lpFile)) |
8017 if (nShowCmd == @symbol(SW_RESTORE)) { |
8018 && ((lpParameters == nil) || __isString(lpParameters)) |
8018 __nShowCmd = SW_RESTORE; |
8019 && ((lpDirectory == nil) || __isString(lpDirectory)) |
8019 } |
8020 ) { |
8020 } |
8021 HANDLE __hwnd = 0; |
8021 |
8022 char *__lpOperation = (lpOperation != nil) ? __stringVal(lpOperation) : NULL; |
8022 if (((lpOperation == nil) || __isString(lpOperation)) |
8023 char *__lpFile = (lpFile != nil) ? __stringVal(lpFile) : NULL; |
8023 && ((lpFile == nil) || __isString(lpFile)) |
8024 char *__lpParameters = (lpParameters != nil) ? __stringVal(lpParameters) : NULL; |
8024 && ((lpParameters == nil) || __isString(lpParameters)) |
8025 char *__lpDirectory = (lpDirectory != nil) ? __stringVal(lpDirectory) : NULL; |
8025 && ((lpDirectory == nil) || __isString(lpDirectory)) |
8026 long result; |
8026 ) { |
8027 |
8027 HANDLE __hwnd = 0; |
8028 if (hwnd != nil) { |
8028 char *__lpOperation = (lpOperation != nil) ? __stringVal(lpOperation) : NULL; |
8029 if (__isExternalAddressLike(hwnd)) { |
8029 char *__lpFile = (lpFile != nil) ? __stringVal(lpFile) : NULL; |
8030 __hwnd = (HANDLE)(__externalAddressVal(hwnd)); |
8030 char *__lpParameters = (lpParameters != nil) ? __stringVal(lpParameters) : NULL; |
8031 } else |
8031 char *__lpDirectory = (lpDirectory != nil) ? __stringVal(lpDirectory) : NULL; |
8032 goto badArgument; |
8032 long result; |
8033 } |
8033 |
8034 result = ShellExecuteA(__hwnd, __lpOperation, __lpFile, __lpParameters, __lpDirectory, __nShowCmd); |
8034 if (hwnd != nil) { |
8035 |
8035 if (__isExternalAddressLike(hwnd)) { |
8036 /* MS programmers are brain damaged - here's the proof... */ |
8036 HANDLE __hwnd = (HANDLE)(__externalAddressVal(hwnd)); |
8037 if (result > 32) { |
8037 } else |
8038 RETURN ( self ); /* OK */ |
8038 goto badArgument; |
8039 } |
8039 } |
8040 |
8040 result = ShellExecuteA(__hwnd, __lpOperation, __lpFile, __lpParameters, __lpDirectory, __nShowCmd); |
8041 switch (result) { |
8041 |
8042 case 0: |
8042 /* MS programmers are brain damaged - here's the proof... */ |
8043 case SE_ERR_OOM: |
8043 if (result > 32) { |
8044 result = ERROR_NOT_ENOUGH_MEMORY; |
8044 RETURN ( self ); /* OK */ |
8045 break; |
8045 } |
8046 |
8046 |
8047 case SE_ERR_ACCESSDENIED: |
8047 switch (result) { |
8048 result = ERROR_ACCESS_DENIED; |
8048 case 0: |
8049 break; |
8049 case SE_ERR_OOM: |
8050 |
8050 result = ERROR_NOT_ENOUGH_MEMORY; |
8051 case SE_ERR_FNF: |
8051 break; |
8052 result = ERROR_FILE_NOT_FOUND; |
8052 |
8053 break; |
8053 case SE_ERR_ACCESSDENIED: |
8054 |
8054 result = ERROR_ACCESS_DENIED; |
8055 case SE_ERR_PNF: |
8055 break; |
8056 result = ERROR_PATH_NOT_FOUND; |
8056 |
8057 break; |
8057 case SE_ERR_FNF: |
8058 |
8058 result = ERROR_FILE_NOT_FOUND; |
8059 default: |
8059 break; |
8060 result = ERROR_INVALID_FUNCTION; |
8060 |
8061 break; |
8061 case SE_ERR_PNF: |
8062 } |
8062 result = ERROR_PATH_NOT_FOUND; |
8063 errorNumber = __MKUINT( result ); |
8063 break; |
8064 } |
8064 |
|
8065 default: |
|
8066 result = ERROR_INVALID_FUNCTION; |
|
8067 break; |
|
8068 } |
|
8069 errorNumber = __MKUINT( result ); |
|
8070 } |
|
8071 badArgument: ; |
8065 badArgument: ; |
8072 %}. |
8066 %}. |
8073 errorNumber isNil ifTrue:[ |
8067 errorNumber isNil ifTrue:[ |
8074 self error:'invalid argument(s)'. |
8068 self error:'invalid argument(s)'. |
8075 ] ifFalse:[ |
8069 ] ifFalse:[ |
8076 (OperatingSystem errorHolderForNumber:errorNumber) reportError |
8070 (OperatingSystem errorHolderForNumber:errorNumber) reportError |
8077 ]. |
8071 ]. |
|
8072 |
|
8073 " |
|
8074 self openDocumentationFilename: Filename currentDirectory |
|
8075 |
|
8076 self |
|
8077 shellExecute:nil |
|
8078 lpOperation:'open' |
|
8079 lpFile:(Filename currentDirectory pathName) |
|
8080 lpParameters:nil |
|
8081 lpDirectory:(Filename currentDirectory pathName) |
|
8082 nShowCmd:#SW_SHOWNORMAL |
|
8083 |
|
8084 self |
|
8085 shellExecute:nil |
|
8086 lpOperation:'explore' |
|
8087 lpFile:(Filename currentDirectory pathName) |
|
8088 lpParameters:nil |
|
8089 lpDirectory:(Filename currentDirectory pathName) |
|
8090 nShowCmd:#SW_SHOWNORMAL |
|
8091 " |
|
8092 |
|
8093 "Modified: / 26-01-2007 / 14:16:38 / cg" |
8078 ! ! |
8094 ! ! |
8079 |
8095 |
8080 !Win32OperatingSystem class methodsFor:'socket support'! |
8096 !Win32OperatingSystem class methodsFor:'socket support'! |
8081 |
8097 |
8082 socketAccessor |
8098 socketAccessor |