L linhl Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-25 #1 我想使自己的程序运行后,窗口始终位于其它窗口之上,不 被新运行窗口所遮盖,如何实现?
P pengjinlongex Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-25 #3 procedure AlwaysOnTop(Form: TForm; OnTop: Boolean); begin if OnTop then SetWindowPos(Form.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE) else SetWindowPos(Form.Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE) end; 窗体为normal型
procedure AlwaysOnTop(Form: TForm; OnTop: Boolean); begin if OnTop then SetWindowPos(Form.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE) else SetWindowPos(Form.Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE) end; 窗体为normal型
人 人在昆明 Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-25 #5 procedure Createparams(Var Params:TCreateParams);override; ... procedure TFormDrop.Createparams(var Params:TCreateParams); begin Inherited CreateParams(Params); With Params do begin EXStyle:=ExStyle or WS_EX_TOPMOST OR WS_EX_ACCEPTFILES or WS_DLGFRAME wndParnet:=GetDesktopWindow; //关键一行,用SetParent都不行!! end;
procedure Createparams(Var Params:TCreateParams);override; ... procedure TFormDrop.Createparams(var Params:TCreateParams); begin Inherited CreateParams(Params); With Params do begin EXStyle:=ExStyle or WS_EX_TOPMOST OR WS_EX_ACCEPTFILES or WS_DLGFRAME wndParnet:=GetDesktopWindow; //关键一行,用SetParent都不行!! end;
L linhl Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-26 #7 houanl的方法无效,另外我后来也找到一个更简单的方法, 将窗口Formstly属性设置为fsStayOnTop就行了,感想各位热情相助!