Opendialog1. Please Execute call after the open file dialog box, how to shut down in the program instead of using the close button on the dialog?
Procedure TForm1. OpenDialog1Show (Sender: TObject);
The begin
OpenDialog_showing:=true;
The end;
Procedure TForm1. OpenDialog1Close (Sender: TObject);
The begin
OpenDialog_showing:=false;
The end;
Procedure TForm1. Timer1Timer (Sender: TObject);
The begin
If OpenDialog_showing then
The begin
SendMessage (form1. OpenDialog1. Handle, WM_CLOSE, 0, 0).//failure
Form1. OpenDialog1. OnClose (sender);//failure
Form1. OpenDialog1. Destroy;//error
The end;
The end;
CodePudding user response:
someone atCodePudding user response:
The dialog window directly destroy youCodePudding user response:
By getting OpenDialog handle release it directly,CodePudding user response:
Send a simulation of the ESC key. But this dialog is to dialogue with the originally, the result will prove myself closed, what happened?CodePudding user response:
Procedure TForm1. OdlgFolderChange (Sender: TObject);
The begin
Timer1. Enabled:=true;
The end;
Procedure TForm1. Timer1Timer (Sender: TObject);
Var
PHandle: THandle;
The begin
Timer1. Enabled:=false;
PHandle:=odlg. Handle;
If (pHandle & lt;> 0) then
PostMessage (pHandle WM_CLOSE, 0, 0);
The end;