線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2057
推到 Plurk!
推到 Facebook!

請問有關ShellExecute的問題

答題得分者是:Justmade
lin11112
初階會員


發表:42
回覆:83
積分:25
註冊:2003-02-17

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-04-10 17:11:16 IP:210.202.xxx.xxx 未訂閱
請問如何取得 ShellExecute 的return value 如果開啟錯誤那會return何種值 謝謝
Justmade
版主


發表:94
回覆:1934
積分:2030
註冊:2003-03-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-04-10 17:47:25 IP:218.16.xxx.xxx 未訂閱
var ReturnValue : integer;    ReturnValue := ShellExecute(....);    Return Value 的錯誤 Wind32 SDK Help 有介紹啊 :
0                        The operating system is out of memory or resources.
ERROR_FILE_NOT_FOUND        The specified file was not found.
ERROR_PATH_NOT_FOUND        The specified path was not found.
ERROR_BAD_FORMAT                The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).
SE_ERR_ACCESSDENIED        The operating system denied access to the specified file. 
SE_ERR_ASSOCINCOMPLETE        The filename association is incomplete or invalid.
SE_ERR_DDEBUSY                The DDE transaction could not be completed because other DDE transactions were being processed.
SE_ERR_DDEFAIL                The DDE transaction failed.
SE_ERR_DDETIMEOUT                The DDE transaction could not be completed because the request timed out.
SE_ERR_DLLNOTFOUND                The specified dynamic-link library was not found. 
SE_ERR_FNF                The specified file was not found. 
SE_ERR_NOASSOC                There is no application associated with the given filename extension.
SE_ERR_OOM                There was not enough memory to complete the operation.
SE_ERR_PNF                The specified path was not found.
SE_ERR_SHARE                A sharing violation occurred.
約大於 32 就是沒錯誤囉 發表人 - Justmade 於 2003/04/10 17:49:06
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-04-10 17:50:58 IP:202.39.xxx.xxx 未訂閱
可以這麼寫:
uses ShellApi;
   
begin
  if ShellExecute(0, 'open', PChar('C:\xxx.exe'), nil, nil, SW_SHOW) < 32 then 
    ShowMessage('執行 C:\xxx.exe 發生錯誤: '   SysErrorMessage(GetLastError));
end;
--- 每個人都是一本書
lin11112
初階會員


發表:42
回覆:83
積分:25
註冊:2003-02-17

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-04-11 08:09:43 IP:210.202.xxx.xxx 未訂閱
我是用BCB 5.0 如果寫成如下   if ShellExecute(0, 'open', PChar('C:\xxx.exe'), nil, nil, SW_SHOW)  <32 then ShowMessage('執行 C:\xxx.exe 發生錯誤: ' SysErrorMessage(GetLastError)); 在compiler時會有 Expression syntax的錯誤
RaynorPao
版主


發表:139
回覆:3622
積分:7025
註冊:2002-08-12

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-04-11 16:24:15 IP:203.73.xxx.xxx 未訂閱
引言: 我是用BCB 5.0 如果寫成如下 if ShellExecute(0, 'open', PChar('C:\xxx.exe'), nil, nil, SW_SHOW) <32 then ShowMessage('執行 C:\xxx.exe 發生錯誤: ' SysErrorMessage(GetLastError)); 在compiler時會有 Expression syntax的錯誤
lin11112 你好:
(1)如果你是使用 C   Builder 的話,可以寫成以下這樣子
   >( >,不然會被
   扣分的
    -- 
        
------
-- 若您已經得到滿意的答覆,請適時結案!! --
-- 欲知前世因,今生受者是;欲知來世果,今生做者是 --
-- 一切有為法,如夢幻泡影,如露亦如電,應作如是觀 --
系統時間:2024-04-25 9:17:14
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!