Override Delphi Form's Restore Operation
{ Private declarations }
procedure WMSysCommand (var Msg: TWMSysCommand) ; message WM_SYSCOMMAND;
procedure TForm1.WMSysCommand(var Msg: TWMSysCommand);
begin
if Msg.CmdType = SC_RESTORE then
begin
ShowMessage('SC_RESTORE');
if self.WindowState = wsMaximized then
begin
self.WindowState := wsMinimized;
Msg.Result := 0;
Exit;
end;
if self.WindowState = wsMinimized then
begin
self.WindowState := wsMaximized;
Msg.Result := 0;
Exit;
end;
end;
DefaultHandler(Msg) ;
end;
相关文档:
枚举类型
Pascal程序不仅用于数值处理,还更广泛地用于处理非数值的数据。例如,性别、月份、星期几、颜色、单位名、学历、职业等。
1、枚举类型的定义
格式: type 枚举类型标识符=(标识符1,标识符2,…,标识符n)
2、枚举类型数据特点
① 枚举元素只能是标识符;
例如,下列类型定义是合法的:
type ......
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
......
1、先用Const 定义一个常量,例如 const WM_MyMessage=WM_USER+$200;
2、在要实现的unit中定义一个私有方法
procedure doMyMessage(var msg:TMessage);message WM_MyMessage;
3、实现这个私有方法
procedure TForm1.doMyMessage(var msg:TMessage);
begin
//
if msg. ......
1. 字符串连接直接用+,与Java和Python中的相同
2. 执行外部命令使用winexec,ShellExecute
eg. ShellExecute(0, 'open', 'jre/bin/java', '-lang zh-CN', 'E:\myfolder', SW_SHOW);
3. 判断文件、文件夹是否存在
FileExists('C:\Users\bill\somefile.txt')
......