你肯定把消息框出现之前的窗体放在最前面了,才会出现这种情况。这么办,先取消置顶,然后弹出消息对话框,然后再把窗体置顶。 ———————————————————————————— '模块中 Option ExplicitPublic 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’窗体中'取消置顶 SetWindowPos Form1.hwnd, -2, 0, 0, 0, 0, &H2 Or &H1MsgBox "fadsjkf"'置顶 SetWindowPos Form1.hwnd, -1, 0, 0, 0, 0, &H2 Or &H1
————————————————————————————
'模块中
Option ExplicitPublic 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’窗体中'取消置顶
SetWindowPos Form1.hwnd, -2, 0, 0, 0, 0, &H2 Or &H1MsgBox "fadsjkf"'置顶
SetWindowPos Form1.hwnd, -1, 0, 0, 0, 0, &H2 Or &H1