17-10-12, 12:56 AM
كاتب الموضوع : AhmedEssawy
الكود منقول من المنتدى القديم .ضع هذة الشفرة في التصريحات
كود :
Const FLAGS = 3
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Public bOnTop As Boolean
Private Declare Function SetWindowPos Lib "user32" (ByVal h%, ByVal hb%, ByVal X%, ByVal Y%, ByVal cx%, ByVal cy%, ByVal f%) As Integer
كود :
Sub AlwaysOnTop(FormName As Form, bOnTop As Boolean)
Dim res As Integer
If bOnTop = False Then
res% = SetWindowPos(FormName.hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
Else
res% = SetWindowPos(FormName.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
End If
End Sub