这样的代码确实能够让form1弹出来而且也获得焦点,但是只要你单击了悬浮窗口(只要这个时候form1已经显示,也就是说只要form1还停留在任务栏不是托盘区)form1也会弹出来啊?我只想让form1在双击form2的时候弹出来啊?要怎么样改写代码?
implementation
uses unit1;
{$R *.dfm}procedure TForm2.createparams(var params: TCreateparams);
begin
inherited;
with params do
begin
Style := Params.Style xor WS_DLGFRAME;
wndparent:=GetDesktopWindow; //让form2的父窗口为桌面。
end;
end;procedure TForm2.FormCreate(Sender: TObject);
begin
setwindowlong(handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
height:=50;
width:=50;
end;procedure TForm2.image1DblClick(Sender: TObject);
begin // releasecapture;
//perform(WM_SYSCOMMAND,$F012,0);
SETWINDOWLONG(application.Handle,GWL_EXSTYLE,WS_EX_APPWINDOW);
showwindow(form1.Handle,sw_show);
showwindow(application.Handle,sw_show);
setforegroundwindow(application.Handle);
end;procedure TForm2.image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var cursorpos:tpoint;
begin
case button of
mbleft:
begin
releasecapture;
perform(WM_SYSCOMMAND,$F012,0);
if form1.showing then
form1.SetFocus;
end;
mbright:
begin
GetCursorPos(cursorpos);
form1.PopupMenu1.Popup(cursorpos.X,cursorpos.y);
end;
end;end;
implementation
uses unit1;
{$R *.dfm}procedure TForm2.createparams(var params: TCreateparams);
begin
inherited;
with params do
begin
Style := Params.Style xor WS_DLGFRAME;
wndparent:=GetDesktopWindow; //让form2的父窗口为桌面。
end;
end;procedure TForm2.FormCreate(Sender: TObject);
begin
setwindowlong(handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
height:=50;
width:=50;
end;procedure TForm2.image1DblClick(Sender: TObject);
begin // releasecapture;
//perform(WM_SYSCOMMAND,$F012,0);
SETWINDOWLONG(application.Handle,GWL_EXSTYLE,WS_EX_APPWINDOW);
showwindow(form1.Handle,sw_show);
showwindow(application.Handle,sw_show);
setforegroundwindow(application.Handle);
end;procedure TForm2.image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var cursorpos:tpoint;
begin
case button of
mbleft:
begin
releasecapture;
perform(WM_SYSCOMMAND,$F012,0);
if form1.showing then
form1.SetFocus;
end;
mbright:
begin
GetCursorPos(cursorpos);
form1.PopupMenu1.Popup(cursorpos.X,cursorpos.y);
end;
end;end;
解决方案 »
- 猜猜哪位是阿三,哪位是华仔,猜对获取20分,散完分之止
- 大虾请教:在MS SQL 的字段为SMALLDATETIME,在D7 中,做了一个查询,详情如下:
- 数据库连接问题,请教!
- 急,形参的默认值问题,请大家帮忙
- OnFetchProgress事件在什么时候触发啊?
- 995~~如何把数据库得的image类型字段,取到本地,存成文件~(给个例子)
- 有没有高手啊,怎么这个问题没人能回答呀!?:怎样动态的输入文字以及竖直输入?
- 请问我如何在List中放入ComboBox呢?
- 哪位有TPolyline控件,急需!请告知!
- 线程中的mediaplayer 控件在播放音乐的时候如何释放,退出主FORM就报错“无效的窗口句柄”
- 求一个思路?
- 关于 注册表 清理 的原理 的问题??????????
为什么不把MouseDown事件改换成Click事件呢?