Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Am I in Dialog mode? Am I Maximized

Posted on 2012-03-12
12
Medium Priority
?
575 Views
Last Modified: 2012-06-27
Hello experts!

How can I know, while in an open form in Access, if that form is -
1. maximized?
2. in dialog mode?

Thanks
0
Comment
Question by:NNOAM1
[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
  • 4
  • 4
  • 4
12 Comments
 
LVL 75
ID: 37713182
Well, Maximized is determined by You ... either in code in the Form Load or Open event, or in a Macro.

Again, Dialog mode is also determined by you, either in the FormOpen command, or the Popup and Modal properties on the Form property sheet.

Is this what you are asking ?

mx
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 37713198
1. maximized?
I don't know of any setting but microsoft has a webpage which tells you how to determine it by using api calls. You need to use the IsZoomed api call.
http://support.microsoft.com/kb/210190


2. in dialog mode?
Only option I know if is Modal but that is not the same as dialog. I am not aware of anything. You may need to hold an indicator yourself somehow (maybe global variable or form arguments) to tell the form it is opened as dialog.
0
 

Author Comment

by:NNOAM1
ID: 37713199
No. The Form is now open. It can be opened from various "places" in the application. Some of them open it in dialog mode, some of them not. In some of them it is maximized, in some of them not. I would like it to be that while the opened form is running, it would be possible to know in what "situation" I am. Something like:
If Me.Maximized then
    ......
Else
    ......
End if

and:
If Me.Dialog
     ...... etc.

But there aren't such properties. And when in dialog mode, the properties Popup and Modal are False.
Is there a way?
0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 65

Accepted Solution

by:
rockiroads earned 2000 total points
ID: 37713219
with maximized you can try this. Add this code into a module

Declare Function IsZoomed Lib "User32" (ByVal hWnd As Long) As _
     Integer
     
Public Function AmIMaxed(lHwnd As Long) As Boolean
    If IsZoomed(lHwnd) = 0 Then AmIMaxed = False Else AmIMaxed = True
End Function

Open in new window


then in your form, call AmIMaxed passig in the form handle
eg

if AmIMaxed(me.hwnd)=true then
    msgbox "maxed"
end if


However with Dialog, I have not come across any property or api call. I will take a deeper look.
0
 
LVL 75
ID: 37713225
Overall, just say NO to Maximizing. WindowS is plural for a reason ... as in multiple windows.  ONLY in Access do developers for Maximizing on users ... because you 'can'.  Most of the time, it only generate a lot of gray/white space.

Imagine that if in Quickbooks Pro, every window/register that you opened was forced max. It would be maddening!

mx
0
 

Author Comment

by:NNOAM1
ID: 37713226
Concerning Declare Function IsZoomed Lib "User32"  etc.:
Is it completely "safe" to use it in all Windows versions (XP, Vista, 7)?
(In "safe" I mean - will it work regardless of Win ver.)
0
 
LVL 75
ID: 37713238
32 bit API's will most likely need to be revamped / changed on Win x64, like Win7 x64 ...

Otherwise ... should not be an issue.

mx
0
 

Author Comment

by:NNOAM1
ID: 37713245
In Win7 x64 how would I declare that function?
0
 
LVL 75
ID: 37713248
I believe you have to use the ptrSafe parameter ... Google that and you will get a million hits.  Or, maybe Rocki knows ...

mx
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 37713258
as MX says, should not be an issue. MS support site has info on what api calls are okay to use. IsZoomed is one of them. Here is an example of how to define it to make it work for both 32bit and 64bit platforms.

Declare PtrSafe Function IsZoomed Lib "user32" Alias "IsZoomed" (ByVal hwnd As LongPtr) As Long

Read this here to help you get a better understanding.


I had a look. I went thru the properties. Only one's I can find are modal and popup. I went thru the list of api calls and could not find anything that tells you if it has been opened in dialog mode or not.
If you really need it, I think you will need to control it. Are you familiar with form arguments? you can maybe pass in something that way.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 37713259
Wow, Im slow typing, last comment I saw "otherwise not an issue" by mx lol.
0
 

Author Closing Comment

by:NNOAM1
ID: 37713295
Thank you!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

610 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