处理WM_SysCommand消息,没什么效果
解决方案 »
- gettickcount函数在delphi7为何不能用?
- 100分!求数据库之间导数据的问题!
- 如何让stringgrid整列或整行变色?
- 关于COM+问题在线急。。。。
- 如何选择通过点击TREEVIEW1,在TREEVIEW2中生成对应的项...在线等,急需!
- 谁有用过TAudioIO,请教如何才能把被填充到buffer中的数据存成.wav文件?
- 当MAPX中的MAP为miEditModeNode or miEditModeAddNode 时候,如何增加一个NODE了
- 如何加快Delphi浮点运算速度
- 现有一个程序,里面有很多查询,我想把一个查询导入到一个DBF文件中去!
- 请大家帮帮忙,怎样把filelistbox1里的文件拖放到listbox1中,而且只是把文件名放在listbox1里.?????
- 关于DLL的问题
- delphi7中出现的问题~!
Mainfrm.Height := Screen.Height;
Mainfrm.top := 0;
Mainfrm.left := 0;
宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
————————————————————————————————————
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, AppEvnts, StdCtrls, Buttons;type
TForm1 = class(TForm)
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure MaxMessage(var Msg:TMessage);message WM_SYSCOMMAND; end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.MaxMessage(var Msg:TMessage);
begin
if Msg.WParam = SC_MAXIMIZE then
begin
form1.Width := screen.Width;
form1.Height := screen.Height;
form1.Top := 0;
form1.Left := 0;
end;
end;procedure TForm1.BitBtn1Click(Sender: TObject);
begin
form1.WindowState := wsMaximized;
end;end.
WM_SysCommand只能处理系统菜单事件, 不能处理窗体最大化按钮点击事件,这需要通过另外一个消息WM_NCHITTEST 来截取,我尝试过在这两个消息中处理,但没有成功
你新建一个PROJECT,然后什么都不要创建,直接把下面的代面替换掉unit1.pas的代码,然后F9
运行后什么都没有,但当你点最大化按纽的时候,将会出现对话框,俺在d7+win2003下测试通过
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
procedure MaxMessage(var Msg:TMessage);Message WM_SYSCOMMAND;
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure Tform1.MaxMessage(var Msg:TMessage);
begin
if Msg.WParam = SC_MAXIMIZE then
begin
ShowMessage('dd');
end;
end;end.
begin
if Msg.wParam and $FFF0=SC_MAXIMIZE then
BorderStyle:=bsNone;
DefWindowProc(Handle,Msg.Msg,Msg.wParam,Msg.lParam);
end;
本来当天准备来结贴的,结果网络出了问题一个是在WndProc过程里处理
if (MSG.WM_SYSCOMMAND) and (WParams=SC_MAXIMIZE) then
....
另一个就是标题栏的双击消息
WM_NCLBUTTONDBLCLK
在这个消息里就写两句
begin
Inherited;
SendMessage(Handle, WM_SYSCOMMAND,SC_MAXIMIZE ,0)
end;我在新工程里这样写的,完全能够实现。可用在我现在开发的工程里,和我以前写的一个控件有冲突,
所以放弃使用这个功能了