我能夠通過
Private Sub Form_Load()
Dim lR As Long
lR = SetTopMostWindow(Form2.hwnd, True)
End Sub
實現,並添加一個模塊
Option Explicit
Public Const SWP_NOMOVE = 2
Public Const SWP_NOSIZE = 1
Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
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
Public Function SetTopMostWindow(hwnd As Long, Topmost As Boolean) _
As Long
If Topmost = True Then 'Make the window topmost
SetTopMostWindow = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, _
0, FLAGS)
Else
SetTopMostWindow = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, _
0, 0, FLAGS)
SetTopMostWindow = False
End If
End Function</pre>
一個可以參考https://support.microsoft.com/en-us/kb/184297
感謝
你已經建立一個代表他70年代並不知道比不讓我們看看你的代碼? – LDMJoe
他們沒有什麼特別的代碼,但我已經添加了它。 – mark
在VB6的Form中沒有'Activate'方法,與VBA中的某些對象不同。你正在混合一些東西。 – MicSim