Force form to display

Leif

Registered User.
Local time
Today, 06:37
Joined
Jan 20, 2011
Messages
79
I'm trying to develop a message sub-system in my Access 2003 application. I have a form (hidden), driven by a timer, that checks if a message needs to be displayed. If so, it open a form with the message.

It works, but the problem is when the Access application is minimized. It still displays the form, but it is under the currently active application. If I have no applications up then it displays. Otherwise, it displays under the current application.

Is there some why to force the form to the front of the screen?

Thanks.

Regards,
Leif
 
I'm trying to develop a message sub-system in my Access 2003 application. I have a form (hidden), driven by a timer, that checks if a message needs to be displayed. If so, it open a form with the message.

It works, but the problem is when the Access application is minimized. It still displays the form, but it is under the currently active application. If I have no applications up then it displays. Otherwise, it displays under the current application.

Is there some why to force the form to the front of the screen?

Thanks.

Regards,
Leif

You could set the window to be the top most using one API call. In a modulal enter

Private Const HWND_TOP = 0
Private Const HWND_TOPMOST = -1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
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


Then in your on load event for your window enter

Call SetWindowPos(Me.hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)

This will place the window as the top most in the window stack and it will over lay all other windows.

Don
 
Thanks Don,

That does indeed work. However, I did find that if the user minimized the Access window then my dialog box appears in the upper left corner of the screen and the application remains minimized.

Is it possible to restore the application and center the form within the application window. The form is set AutoCenter Yes.

Thanks,
Leif
 
Leif,

Sorry it took so long, by you should be able to retore your application using me.restore, just before you window pops up. This should place your window where you expected it.

Don
 
Don,

The only object I found for the restore method was docmd. I tried using that, but it did not seem to have any effect on the minimized window.
 
To bring up the application itself the command is

DoCmd.RunCommand acCmdAppMaximize
 

Users who are viewing this thread

Back
Top Bottom