Open on top

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
 
D

Dirk Goldgar

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 -----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top