'▼APIの宣言
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
'▼定数の宣言
Global Const SWP_NOSIZE = &H1
Global Const SWP_NOMOVE = &H2
Global Const HWND_TOPMOST = -1
Global Const HWND_NOTOPMOST = -2
'▼関数の宣言
Public Sub SetWindowTopMost(ByVal hwnd, ByVal TopMost)
If TopMost Then
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, _
SWP_NOMOVE Or SWP_NOSIZE
Else
SetWindowPos hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, _
SWP_NOMOVE Or SWP_NOSIZE
End If
End Sub
|