?
Solved

Restoring MS Access windows

Posted on 2003-03-02
8
Medium Priority
?
688 Views
Last Modified: 2008-02-01
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
Comment
Question by:Hirowaah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 1

Expert Comment

by:Francescina
ID: 8056842
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
 

Author Comment

by:Hirowaah
ID: 8061004
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
 

Author Comment

by:Hirowaah
ID: 8077198
You still here Francescina?

Do you want more points for this or something, i could use your help
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Expert Comment

by:Francescina
ID: 8078818
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
 

Author Comment

by:Hirowaah
ID: 8096330
No problem, thanks for your help, hope i wasnt rushing you :P
0
 
LVL 12

Expert Comment

by:nexusnation
ID: 8784091
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
 
LVL 18

Expert Comment

by:1William
ID: 8876379
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
 

Accepted Solution

by:
RotaredoM earned 0 total points
ID: 8962775
Per recommendation, question PAQed and 50 points refunded.

RotaredoM
CS Mod @ EE
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question