在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
WM_SYSCOMMAND - 系统命令消息,当点击最大化按钮,最小化按钮,关闭按钮等。都会收到这个消息。常用于窗口关闭时提示用户处理。 case WM_SYSCOMMAND: if( wParam == SC_CLOSE ){ int nRet = MessageBox( NULL, "是否关闭", "Infor", MB_YESNO ); if( nRet != IDYES ){ return 0; }else { PostQuitMessage( 0 ); } } break; 参考:http://blog.csdn.net/kaishang0713/article/category/1732423/2 --------------------------------------------------------------------------------- unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs; type TForm1 = class(TForm) private { Private declarations } procedure WndProc(var AMessage:TMessage);override; public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.WndProc(var AMessage: TMessage); begin if (AMessage.Msg=WM_SYSCOMMAND) and (AMessage.WParam=SC_CLOSE) then Exit else inherited; end; end.
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论