RemObjects Pascal Script 如何使用shellexectue |
答題得分者是:eaglewolf
|
pceyes
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:70 回覆:657 積分:1140 註冊:2003-03-13 發送簡訊給我 |
以下是它的testdll範例程式,可以work <textarea name="code" class="delphi" rows="10" cols="60"> Program IFSTest; // compile the demo application, minimize delphi and run this. function FindWindow(C1, C2: PChar): Longint; external 'FindWindowA@user32.dll stdcall'; function ShowWindow(hWnd, nCmdShow: Longint): Integer; external 'ShowWindow@user32.dll stdcall'; function SetWindowText(hWnd: Longint; Text: PChar): Longint; external 'SetWindowTextA@user32.dll stdcall'; var i: Longint; wnd: Longint; Begin wnd := Findwindow('', 'Innerfuse Pascal Script III'); SetWindowText(Wnd, 'This is DLL demo, it calls some windows user32 routines. This will hide this window for a few seconds'); for i := 0 to 200000 do begin end; ShowWindow(Wnd, 0); // hide it for i := 0 to 200000 do begin end; SetWindowText(Wnd, 'Wasn''t that nice?'); ShowWindow(Wnd, 5); // show it for i := 0 to 200000 do begin end; SetWindowText(Wnd, 'Innerfuse Pascal Script III'); End. </textarea> 以下是我自己改的,但不能使用,請大家幫幫忙,謝謝! <textarea name="code" class="delphi" rows="10" cols="60">Program IFSTest; function ShellExecute(hWnd: Longint; lpOperation: pchar;lpFile: pchar;lpParameters: pchar; lpDirectory: pchar;nShowCmd:longint):longint;external 'ShellExecute@shell32.dll stdcall'; var wnd: Longint; Begin wnd := shellexecute(0,nil,pchar('d:\1234.txt'),nil,nil,0); End. </textarea>
------
努力會更接近成功 |
eaglewolf
資深會員 ![]() ![]() ![]() ![]() ![]() 發表:4 回覆:268 積分:429 註冊:2006-07-06 發送簡訊給我 |
將最後的參數0改成1應該就可以了
<textarea class="delphi" rows="10" cols="60" name="code">Program IFSTest; function ShellExecute(hWnd: Longint; lpOperation: pchar;lpFile: pchar;lpParameters: pchar; lpDirectory: pchar;nShowCmd:longint):longint;external 'ShellExecute@shell32.dll stdcall'; var wnd: Longint; Begin wnd := shellexecute(0,nil,pchar('d:\1234.txt'),nil,nil,1); End. </textarea> 雖然在delphi 的 Help 中 有提到 If lpFile specifies a document file, nShowCmd should be zero. 不過實際上 0 其實是 SW_HIDE
------
先查HELP 再查GOOGLE 最後才發問 沒人有義務替你解答問題 在標題或文章中標明很急 並不會增加網友回答速度 Developing Tool: 1.Delphi 6 2.Visual Studio 2005 3.Visual Studio 2008 DBMS: MS-SQL
編輯記錄
eaglewolf 重新編輯於 2007-08-15 23:34:08, 註解 無‧
|
pceyes
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:70 回覆:657 積分:1140 註冊:2003-03-13 發送簡訊給我 |
<textarea cols="60" rows="10" class="delphi" name="code">
# Program IFSTest;
#
# function ShellExecute(hWnd: Longint; lpOperation: pchar;lpFile: pchar;lpParameters: pchar; lpDirectory: pchar;nShowCmd:longint):longint;external 'ShellExecuteA@SHELL32.DLL stdcall';
#
# var wnd: Longint;
# Begin
#
# wnd := shellexecute(0,'OPEN','TestApplication.exe','','',1);
#
# if wnd>32 then begin
# writeln(inttostr(wnd)); // 傳回被執行的hANDLE
# end
# else begin
# writeln('debug: ' inttostr(wnd));// 低於32表示失敗
# end;
#
# End.
</textarea></font>
ShellExecuteA@SHELL32.DLL 關鍵在上面的A(ANSISTRING),W(WIDESTRING) ,上網找一個下午才找到, 無論如何, 還是謝謝大家的幫忙, 謝謝! ![]()
------
努力會更接近成功 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |