Open on top

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using Access 2K on a Win2K platform.

I have an application that I am using fSetAccessWindow to hide the Access
window. In this application, I have form which contains a timer event that
opens up another form if the first form is minimized and a certain amount of
time has elapsed. I would like this second form to pop up on top of any
other application that is currently running, but the dialog parameter of
OpenForm does not accomplish this. Any ideas?

Dale
 
Dale Fye said:
I'm using Access 2K on a Win2K platform.

I have an application that I am using fSetAccessWindow to hide the
Access window. In this application, I have form which contains a
timer event that opens up another form if the first form is minimized
and a certain amount of time has elapsed. I would like this second
form to pop up on top of any other application that is currently
running, but the dialog parameter of OpenForm does not accomplish
this. Any ideas?

I'm no API expert, but this seems to work, in my limited tests. The
following code is to go in the module of the calling form, in different
places as indicated:

----- code for the Declarations section of the module -----

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)

----- end code for the Declarations section -----

----- code for the event where you want to pop up the other form -----

DoCmd.OpenForm "YourFormName"

SetWindowPos Forms!YourFormName.hWnd, HWND_TOPMOST, _
0, 0, 0, 0, _
SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE

----- end code for event -----
 
Back
Top