harisis
asked on
DestroyWindow doesn't work.
Why i can't destroy a window with the "DestroyWindow" function in Windows95? I use Delphi 1.
Hmmm, I have two queses: D1 and w95 problem or you paste bad parameters to the procedure...
Anyway, I quess you should try it with other windows or smth, and try to monitor the parameters you paste.
Wana` send it to me so I can check it with D3?
Good luck!
bosism@netvision.net.il
Anyway, I quess you should try it with other windows or smth, and try to monitor the parameters you paste.
Wana` send it to me so I can check it with D3?
Good luck!
bosism@netvision.net.il
ASKER
I sent the routines. The parameters should be ok. I checked the handles with other programs too.
The form has a ComboBox which gives the running windows and their handles. When the user selects a window title and presses the OK button the DestroyWindow executes... What's wrong?
-------------------------- ---------- ---
unit Unit1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, Buttons;
type
TForm1 = class(TForm)
OKButton: TBitBtn;
ComboBox1: TComboBox;
procedure ComboBox1DropDown(Sender: TObject);
procedure OKButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.ComboBox1DropDown(S ender: TObject);
var i:word;
ls:byte;
sa:array[1..255] of char;
s:string;
hndl:hwnd;
begin
combobox1.items.clear;
hndl:=GetNextWindow(applic ation.hand le,GW_HWND NEXT);
for i:=1 to GetNumTasks-1 do
begin
ls:=GetWindowText(hndl,@sa , 255);
s:=strpas(@sa);
if s<>'' then combobox1.items.add(inttos tr(hndl)+' '+s);
hndl:=GetNextWindow(hndl,G W_HWNDNEXT );
end;
end;
procedure TForm1.OKButtonClick(Sende r: TObject);
var
h:Hwnd;
sa,cl:array[1..255] of char;
dd:boolean;
begin
h:=strtoint(copy(combobox1 .text,1,po s(' ',combobox1.text)-1));
if h<>0 then
dd:=DestroyWindow(h);
end;
end.
The form has a ComboBox which gives the running windows and their handles. When the user selects a window title and presses the OK button the DestroyWindow executes... What's wrong?
--------------------------
unit Unit1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, Buttons;
type
TForm1 = class(TForm)
OKButton: TBitBtn;
ComboBox1: TComboBox;
procedure ComboBox1DropDown(Sender: TObject);
procedure OKButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.ComboBox1DropDown(S
var i:word;
ls:byte;
sa:array[1..255] of char;
s:string;
hndl:hwnd;
begin
combobox1.items.clear;
hndl:=GetNextWindow(applic
for i:=1 to GetNumTasks-1 do
begin
ls:=GetWindowText(hndl,@sa
s:=strpas(@sa);
if s<>'' then combobox1.items.add(inttos
hndl:=GetNextWindow(hndl,G
end;
end;
procedure TForm1.OKButtonClick(Sende
var
h:Hwnd;
sa,cl:array[1..255] of char;
dd:boolean;
begin
h:=strtoint(copy(combobox1
if h<>0 then
dd:=DestroyWindow(h);
end;
end.
Whoat is your purpose of using DestroyWindow instead of a Delphi method ? Free would do this work for you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is it your own application windows, or windows created by another application ?