这是追加分的帖子, 加至200分!极简单的屏保预览(上贴),如何关闭! (100分)

  • 主题发起人 主题发起人 wenqy
  • 开始时间 开始时间
W

wenqy

Unregistered / Unconfirmed
GUEST, unregistred user!
加100分!两贴总分200分,极简单的屏保预览(上贴),如何关闭? <br>一个极简单的屏保预览,按下Button后,用OpenDialog选择到屏保程序,在edit显示路径的同时,在Panel上开始预览,但不知如何关闭?<br>原码见上贴:http://delphibbs.sumaster.com/delphibbs/dispq.asp?lid=1572936
 
FreeAndNil(Panel1);
 
bigroute:<br>&nbsp; 不行,程序显示是非法操作,异常退出!
 
unit unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br>&nbsp; StdCtrls, ExtCtrls;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Panel1: TPanel;<br>&nbsp; &nbsp; Button1: TButton;<br>&nbsp; &nbsp; OpenDialog1: TOpenDialog;<br>&nbsp; &nbsp; Button2: TButton;<br>&nbsp; &nbsp; procedure Button1Click(Sender: TObject);<br>&nbsp; &nbsp; procedure Button2Click(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>&nbsp; if not OpenDialog1.Execute then<br>&nbsp; &nbsp; Exit;<br><br>&nbsp; WinExec(Pchar(OpenDialog1.FileName + ' /p' + IntToStr(Panel1.Handle)), SW_SHOW);<br>end;<br><br>function EnumChildWindowsProc(hwnd: Integer; lparam: Longint): Boolean; stdcall;<br>begin<br>&nbsp; PostMessage(hwnd, WM_CLOSE, 0, 0);<br>&nbsp; Result := True;<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br>&nbsp; EnumChildWindows(Panel1.Handle, @EnumChildWindowsProc, 0);<br>end;<br><br><br>end.
 
yzhshi:<br>&nbsp; &nbsp;请你在一小时之内,在我的上一贴挂个号,以便送分.
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
940
SUNSTONE的Delphi笔记
S
后退
顶部