全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1447
推到 Plurk!
推到 Facebook!

UniCode再問 - ParamStr 接收UNICODE的問題

缺席
syc0121
一般會員


發表:6
回覆:12
積分:3
註冊:2003-01-15

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-05-21 13:14:54 IP:61.222.xxx.xxx 未訂閱
如題.煩請賜教 除了 ParamStr 之外, 請問是否另有其它FUNCTION或API可接收UNICODE的參數?    小弟的需求是: 將檔案名稱傳入程式之中    例如:  C:\MyApp.exe "C:\王建煊.TXT"    謝謝 發表人 -
syc0121
一般會員


發表:6
回覆:12
積分:3
註冊:2003-01-15

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-05-21 15:40:13 IP:61.222.xxx.xxx 未訂閱
自問自答..小弟找到方法了... 提供出來大家參考參考 ================================================================= 改寫 GetParamStr 和ParamStr 這二個FUNCTION..就可以了.. ================================================================= function GetParamStrW(P:PWChar;var Param:WideString):PWChar; var Len:Integer; Buffer:array[0..4095] of WChar; begin while True do begin while (P[0]<>#0) and (P[0]<=' ') do Inc(P); if (P[0]='"') and (P[1]='"') then Inc(P,2) else Break; end; Len:=0; while (P[0]>' ') and (Len#0) and (P[0]<>'"') do begin Buffer[Len]:=P[0]; Inc(Len); Inc(P); end; if P[0]<>#0 then Inc(P); end else begin Buffer[Len]:=P[0]; Inc(Len); Inc(P); end; end; SetString(Param, Buffer, Len); Result:=P; end; function ParamStrW(Index: Integer): WideString; var P:PWChar; Buffer:array[0..MAX_PATH] of WChar; begin if Index=0 then SetString(Result,Buffer,GetModuleFileNameW(0,Buffer,SizeOf(Buffer))) else begin P:=GetCommandLineW; Result:=''; while True do begin P:=GetParamStrW(P,Result); if (Index = 0) or (Result = '') then Break; Dec(Index); end; end; end;
系統時間:2024-05-19 8:25:56
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!