VB中如何让窗口置顶

来源:百度知道 编辑:UC知道 时间:2024/05/08 06:22:12
如题
意思不是将FORM置于顶部,是说将FORM至于所有程序上!

新建立类模块:
Option Explicit
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)
窗口代码:
Dim rtn
'让窗口在顶层
rtn = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)
'取消窗口在顶层
'rtn = SetWindowPos(F_V.hwnd, -2, 0, 0, 0, 0, 3)

在form属性里将top设置成0即可