作者:绿色风
分类:
时间:2022-08-17
浏览:234
楼主 zlxtl |
Q:有很多软件都可以置顶,即显示在最上层,Excel的窗体也可以吗? A:可以,通过API函数可以实现
- Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
- Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
- Private Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
- Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
- Private Sub UserForm_Initialize()
- Application.EnableCancelKey = xlDisabled
- SetWindowPos hWndForm, -1, 0&, 0&, 0&, 0&, 3
- Call SetForegroundWindow(hWndForm)
- End Sub
- Function hWndForm() As Long
- hWndForm = FindWindow("ThunderDFrame", UserForm1.Caption)
- End Function
- Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
- SetWindowPos hWndForm, -2, 0&, 0&, 0&, 0&, 3
- Application.EnableCancelKey = xlInterrupt
- End Sub
|
2楼 zlxtl |
也可以让Excel的窗口置顶 |
免责声明
有感于原ExcelTip.Net留存知识的价值及部分知识具有的时间限定性因素,
经与ExcelTip.Net站长Apolloh商议并征得其同意,
现将原属ExcelTip.Net的知识帖采集资料于本站点进行展示,
供有需要的人士查询使用,也慰缅曾经的论坛时代。
所示各个帖子的原作者如对版权有异议,
可与本人沟通提出,或于本站点留言,我们会尽快处理。
在此,感谢ExcelTip.Net站长Apolloh的支持,感谢本站点所有人**绿色风(QQ:79664738)**的支持与奉献,特此鸣谢!
------本人网名**KevinChengCW(QQ:1210618015)**原ExcelTip.Net总版主之一