สร้าง CheckBox 1 ตั้งชื่อว่า ITD นะครับ ...
แล้วยัดโค้ด ...
แล้วยัดโค้ด ...
โค๊ด: [Select]
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40
Private Declare Sub 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)
Private Sub Form_Load()
MsgBox "ITD-TEAM", vbinformatin, "INFO"
End Sub
Private Sub ITD_Click()
Select Case ITD.Value
Case vbChecked:
Call WindowOnTop(True)
Case vbUnchecked:
Call WindowOnTop(False)
End Select
End Sub
Public Function WindowOnTop(OnOff As Boolean)
Select Case OnOff
Case True:
SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
Case False:
SetWindowPos Me.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
End Select
End Function