Private Sub Command1_Click()
res = SetWindowPos(Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, flags) 'Форма on-top
End Sub
Private Sub Command2_Click()
res = SetWindowPos(Form1.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, flags) 'Форма non-on-top
End Sub
Что делать? Выдает: Run-time Error '6' - Overflow в процедуре Command1! Где тут ошибка.
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 Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Sub Command1_Click()
Call SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, flags) 'делаем поверх всех
End Sub
Private Sub Command2_Click()
Call SetWindowPos(Me.HWND, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
End Sub
Лучше так:
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