"predominant" form

benjamin.weizmann

Registered User.
Local time
Today, 04:28
Joined
Aug 30, 2016
Messages
78
hi :)
there is any way in access make "predominant" pop up form ?
I mean when the form pop up, it will came front of all windows which open in the computer (not just access windows)?

thanks!
Ben
 
hi :)
there is any way in access make "predominant" pop up form ?
I mean when the form pop up, it will came front of all windows which open in the computer (not just access windows)?

thanks!
Ben

You can force a pop-up form to stay on top of all other windows, and you can cancel that with this WinAPI function
Code:
'
' Declare function 
Public 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

  '
  '  Make sure form stays on top and reverse that
  '
  'Private Sub Command1_Click()
  '       Dim lR As Long
  '       lR = SetTopMostWindow(Me.Form.hwnd, True)
  '    End Sub
  '----------------------------------------------
  'Private Sub Command2_Click()
  '       Dim lR As Long
  '       lR = SetTopMostWindow(Me.Form.hwnd, False)
  'End Sub
  '------------------------------------------------
  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

Best,
Jiri
 
You can force a pop-up form to stay on top of all other windows, and you can cancel that with this WinAPI function
Code:
'
' Declare function 
Public 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

  '
  '  Make sure form stays on top and reverse that
  '
  'Private Sub Command1_Click()
  '       Dim lR As Long
  '       lR = SetTopMostWindow(Me.Form.hwnd, True)
  '    End Sub
  '----------------------------------------------
  'Private Sub Command2_Click()
  '       Dim lR As Long
  '       lR = SetTopMostWindow(Me.Form.hwnd, False)
  'End Sub
  '------------------------------------------------
  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
Best,
Jiri

thanks
Is it supposed to work in Access?
 

Users who are viewing this thread

Back
Top Bottom