//引用以前已经解决的帖子
protected:
virtual void __fastcall CreateParams(TCreateParams & Param);void __fastcall TForm1::CreateParams(TCreateParams & Param)
{
//调用基类
TForm::CreateParams(Param);
//去掉窗口标题区
Param.Style=Param.Style & ~WS_CAPTION;
Param.Style=Param.Style | WS_POPUP;
//设为总在最上边
Param.ExStyle=Param.ExStyle | WS_EX_TOPMOST;
//设WINDOWS OWNER为DESKTOP WINDOWS
Param.WndParent=GetDesktopWindow();
}
注意:1.Windows Owner与Windows Parent不同,用::SetParent函数和设置
Form?->Parent只能设置Windows Parent,不能设置Windows Owner,
要实现FlashGet的悬浮窗必须要设置Windows Owner。
2.Form的BorderStyle要设为bsToolWindow,不然在任务栏上会显示出这个窗口的标题,
将Caption设为空也没有用
protected:
virtual void __fastcall CreateParams(TCreateParams & Param);void __fastcall TForm1::CreateParams(TCreateParams & Param)
{
//调用基类
TForm::CreateParams(Param);
//去掉窗口标题区
Param.Style=Param.Style & ~WS_CAPTION;
Param.Style=Param.Style | WS_POPUP;
//设为总在最上边
Param.ExStyle=Param.ExStyle | WS_EX_TOPMOST;
//设WINDOWS OWNER为DESKTOP WINDOWS
Param.WndParent=GetDesktopWindow();
}
注意:1.Windows Owner与Windows Parent不同,用::SetParent函数和设置
Form?->Parent只能设置Windows Parent,不能设置Windows Owner,
要实现FlashGet的悬浮窗必须要设置Windows Owner。
2.Form的BorderStyle要设为bsToolWindow,不然在任务栏上会显示出这个窗口的标题,
将Caption设为空也没有用
begin
Inherited CreateParams(Params);
With Params do
begin EXStyle:=ExStyle or WS_EX_TOPMOST OR WS_EX_ACCEPTFILES or WS_DLGFRAME or WM_NCHITTEST;
Style :=Style or WS_POPUP; //or WS_CLIPCHILDREN or WS_THICKFRAME
WndParent :=GetDeskTopWindow(); end;
end;
这是我按照老兄的C改成delphi的,如果没有用showmodal打开一个窗口,TrayWin窗口可以在最上面,且可以移动。不过,如果用showmodal打开一个窗口,TrayWin就无法移动。不知为什么,请老兄指教。