IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası

IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası (https://www.ircforumlari.net/)
-   Delphi (https://www.ircforumlari.net/delphi/)
-   -   Delphi Formunda Harici .exe Çalıştırma (https://www.ircforumlari.net/delphi/688286-delphi-formunda-harici-exe-calistirma.html)

Kaf_Dağı 11 Mart 2015 13:46

Delphi Formunda Harici .exe Çalıştırma
 
Delphi Formunda Harici .exe Çalıştırma

Kod:

unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
 
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    fNotepadHandle:THandle;
    procedure res;
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
uses ShellAPI;
 
procedure TForm1.res;
begin
  if IsWindow(fNotepadHandle) then begin
    SetWindowPos(fNotepadHandle, 10, 10, 0, 60, 60,
      SWP_SHOWWINDOW);
  end;
end;
 
procedure TForm1.Button1Click(Sender: TObject);
var
  Rec: TShellExecuteInfo;
const
  AVerb = 'open';
  AParams = '';
  AFileName = 'Notepad.exe';
  ADir = '';
begin
  FillChar(Rec, SizeOf(Rec), #0);
 
  Rec.cbSize      := SizeOf(Rec);
  Rec.fMask        := SEE_MASK_NOCLOSEPROCESS;
  Rec.lpVerb      := PChar( AVerb );
  Rec.lpFile      := PChar( AfileName );
  Rec.lpParameters := PChar( AParams );
  Rec.lpDirectory  := PChar( Adir );
  Rec.nShow        := SW_HIDE;
 
  ShellExecuteEx(@[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]);
  WaitForInputIdle(Rec.hProcess, 5000);
  fNotepadHandle := Windows.FindWindow( 'Notepad', nil );
  Res;
  Windows.SetParent( fNotepadHandle,Handle );
  ShowWindow(fNotepadHandle, SW_SHOW);
end;
 
end.



Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 22:51.

Powered by vBulletin® Version 3.8.8 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO
Copyright ©2004 - 2024 IRCForumlari.Net