• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 705
  • Last Modified:

Restoring MS Access windows

Hiyas, Im wondering if and how its possible to restore minimized windows.  I have a message form that opens when you get a new message, and i want this to restore the minimized access windows also.

I've tried docmd.Restore and that did nothing and i've breifly tried do DoCmd.RunCommand (acCmdAppRestore as AcWindowMode) sort of thing but cant get it to work, please help :)

Thanks
0
Hirowaah
Asked:
Hirowaah
1 Solution
 
FrancescinaCommented:
You need some simple API for this functionality.

First, write this function in the declarations section of any public module:
-----------------
Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
-------------

Explanations:
-------------

ShowWindow shows (or hides) a window in a certain manner. For example, the function can minimize, maximize, or restore a given window. The function returns 0 if the window had been hidden before the call, or a non-zero value if it had been visible.

hwnd
The handle of the window to change the show status of.
nCmdShow
---------------------------------

Exactly one of the following flags specifying how to show the window:
--------------------------
SW_HIDE = 0
Hide the window.
SW_MAXIMIZE = 3
Maximize the window.
SW_MINIMIZE = 6
Minimize the window.
SW_RESTORE = 9
Restore the window (not maximized nor minimized).
SW_SHOW = 5
Show the window.
SW_SHOWMAXIMIZED = 3
Show the window maximized.
SW_SHOWMINIMIZED = 2
Show the window minimized.
SW_SHOWMINNOACTIVE = 7
Show the window minimized but do not activate it.
SW_SHOWNA = 8
Show the window in its current state but do not activate it.
SW_SHOWNOACTIVATE = 4
Show the window in its most recent size and position but do not activate it.
SW_SHOWNORMAL = 1


This function actually maximizes Access:
-----------------------------------------
' Maximize the window Form1.  Before doing so, make sure
' that the window is visible.
Dim retval As Long  ' return value

retval = ShowWindow(Form1.hWnd, SW_SHOW)  ' display the window if it's hidden
retval = ShowWindow(Form1.hWnd, SW_MAXIMIZE)  ' maximize the window
---------------------------------------
0
 
HirowaahAuthor Commented:
Thanks Francescina, im having a little trouble tho i havnt done much api yet.

I inserted a new module and put that declaration in.  Then made a function like so:

Function WindowMode()
Dim retval As Long  ' return value

retval = ShowWindow(frm_System.hwnd, SW_SHOW)  
retval = ShowWindow(frm_System.hwnd, SW_MAXIMIZE

End Function

I call this function from a timer, but it gives me an error
"Runtime errore 424 Object Required"

The only thing i havnt done yet is specified the flags, do i need to do this somewhere or am i doing something else wrong, thanks.
0
 
HirowaahAuthor Commented:
You still here Francescina?

Do you want more points for this or something, i could use your help
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
FrancescinaCommented:
Hi, Hiro,

Sorry for being "late", but I have a real life outside the internet and therefore I am not constantly online.

The a.m. solution works 100%, I implemented it in several applications. I think it is the best that I post the original code of one of my applications. Since I am not on my development computer now I can not do it immediately, but in about 12 hours.

Fran
0
 
HirowaahAuthor Commented:
No problem, thanks for your help, hope i wasnt rushing you :P
0
 
nexusnationCommented:
Hi Hirowaah,
This question has been abandoned and needs to be finalized (107 days since last comment).

   You can accept an answer, split the points, or get a refund. Go to
   http://www.cityofangels.com/Experts/Closing.htm for information and options.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

nexusnation
EE Cleanup Volunteer for Microsoft Access
0
 
1WilliamCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept question, refund points
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

1William
EE Cleanup Volunteer
0
 
RotaredoMCommented:
Per recommendation, question PAQed and 50 points refunded.

RotaredoM
CS Mod @ EE
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now