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

加入執行檔

尚未結案
peiyao
一般會員


發表:41
回覆:23
積分:12
註冊:2003-07-21

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-10-31 12:08:16 IP:210.62.xxx.xxx 未訂閱
請問: 如何讓raswin.exe這個執行檔能夠在delphi的form1中執行呢? 請大家幫幫忙~~~~謝謝~~~~
s9054469
一般會員


發表:21
回覆:35
積分:11
註冊:2003-04-21

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-10-31 13:10:00 IP:210.243.xxx.xxx 未訂閱
引言: 請問: 如何讓raswin.exe這個執行檔能夠在delphi的form1中執行呢? 請大家幫幫忙~~~~謝謝~~~~
如果你只是要做到從form1去呼叫一個外部的執行檔,可以使用ShellExecute去呼叫,使用方式如下: 記得uses shellapi; xPath := 'd:\MySql\Setup.exe'; //要執行檔案的路徑; ShellExecute(0, PChar('open'), PChar(xPath), nil, nil, SW_SHOW); ================================================================= ShellExecute有很多種呼叫方式,比如還有呼叫dos模式的com.exe來執行 ShellExecute(0, 'open', 'cmd.exe',PChar(xPath), '', SW_SHOWNORMAL); 上次在98平台用時就不能用com.exe了..好像要用command.com ~做中學,學中做~
------
corn
hagar
版主


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

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-10-31 13:27:21 IP:202.39.xxx.xxx 未訂閱
http://groups.google.com.tw/groups?q=setparent+%2B+fnotepad+%2B+%22peter+below%22&hl=zh-TW&lr=&ie=UTF-8&oe=UTF-8&selm=VA.0000551a.0122062b%40antispam.compuserve.com&rnum=1
unit Unit1;    interface    uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ComCtrls, StdCtrls, Menus, AppEvnts;    type
  TForm1 = class(TForm)
    ApplicationEvents1: TApplicationEvents;
    procedure FormCreate(Sender: TObject);
    procedure ApplicationEvents1Activate(Sender: TObject);
  private
    { Private declarations }
    FNotepad: HWND;
  public
    { Public declarations }
  end;    var
  Form1: TForm1;    implementation
{$R *.DFM}    procedure TForm1.FormCreate(Sender: TObject);
var
  wnd: HWND;
  tries: Integer;
begin
  WinExec( 'notepad.exe', SW_HIDE );
  tries := 0;
  repeat
    wnd := Findwindow( 'notepad', nil );
    if wnd = 0 then begin
      inc( tries );
      sleep( 100 );
    end;
  until (wnd <> 0) or (tries > 10);
  if wnd <> 0 then begin
    windows.setparent( wnd, handle );
    application.title:= 'Notepad';
    MoveWindow( wnd, 0, 0, clientwidth, clientheight, false );
    ShowWindow( wnd, SW_SHOW );
    SetForegroundWindow( wnd );
    FNotepad := wnd;
  end
  else
    showmessage( 'Failed' );
end;    procedure TForm1.ApplicationEvents1Activate(Sender: TObject);
begin
  If IsWindow( FNotepad ) Then
    SetForegroundWindow( FNotepad )
  Else
    Close;
end;    end.
--- Everything I say is a lie.
系統時間:2024-06-02 21:45:48
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!