Sera que é Possível Executar .exe dentro de um Form ?

Delphi

21/06/2004

... Sera que isso é Possivel ??


Alves

Alves

Curtidas 0

Respostas

Lucas Silva

Lucas Silva

21/06/2004

Tenho um código aqui, que roda aplicações do windows no seu Form, Como MDI.

unit Unit1; 

interface 

uses 
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, StdCtrls 
; 

type 
  TForm1 = class(TForm) 
    Button1: TButton; 
    Lista: TListBox; 
    Button2: TButton; 
    Edit1: TEdit; 
    procedure Button2Click(Sender: TObject); 
    procedure Button1Click(Sender: TObject); 
  private 
    { Private declarations } 
  public 
    { Public declarations } 
  end; 

var 
  Form1: TForm1; 

implementation 

{$R *.dfm} 
procedure LIstApp; 

const 
MAX_WINDOW = 16364; 
var 
I      : Integer; 
Caption: Array[0..255]Of Char; 
//Lista  : TStringList; 
begin 
//Lista:=TStringList.Create; 
//Lista.Sorted:=True; 
For I:=1 To MAX_WINDOW Do 
Begin 
If((GetWindowText(I,Caption,255)<>0)And (GetWindowLong(I,GWL_EXSTYLE)<>0)And 
(GetWindowLong(I,GWL_HWNDPARENT)=0)And (GetWindowLong(I,GWL_HINSTANCE)<>0))Then 
If(IsWindowVisible(I))Then 
form1.Lista.Items.Add(inttostr(i) + ´ ´  + caption); 
end; 
end; 






procedure TForm1.Button2Click(Sender: TObject); 
begin 
lista.Clear; 
listapp; 
end; 

procedure TForm1.Button1Click(Sender: TObject); 
begin 
windows.SetParent(strtoint(edit1.text),form1.handle); 
end; 

end. 



GOSTEI 0
Motta

Motta

21/06/2004

The WinExec function runs the specified application
This function is provided for compatibility with earlier versions of Windows. For Win32-based applications, use the CreateProcess function.


The CreateProcess function creates a new process and its primary thread. The new process executes the specified executable file.


GOSTEI 0
Alves

Alves

21/06/2004

Isso Mesmo: Baseado no teu codigo consegui fazer o q queria
Valeu, Lucas Alves Silva e Motta


GOSTEI 0
POSTAR