473,695 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determine the size of the Windows screen MINUS the task bar?

Is there a way to determine the size of the user's screen minus the
Windows task bar?
I am trying to maximize an Access popup form that is also resizeable
and it is causing me problems since it maximizes to full screen size
(with a portion under the toolbar.)

If I had the measurements of the screen minus the toolbar I could just
use docmd.movesize. ..

Thanks,
lq

(I am currently using a workaround where I maximize the Access window,
maximize the form, then restore the access window but it's a very messy
solution.)

Nov 13 '05 #1
9 9306
lauren quantrell wrote:
Is there a way to determine the size of the user's screen minus the
Windows task bar?
I am trying to maximize an Access popup form that is also resizeable
and it is causing me problems since it maximizes to full screen size
(with a portion under the toolbar.)

If I had the measurements of the screen minus the toolbar I could just
use docmd.movesize. ..

Thanks,
lq

(I am currently using a workaround where I maximize the Access window,
maximize the form, then restore the access window but it's a very messy
solution.)


<---
Option Compare Database
Option Explicit
Global Const gclngSM_CXMAXIM IZED = 61
Global Const gclngSM_CYMAXIM IZED = 62
Declare Function WinAPI_GetSyste mMetrics Lib "user32" Alias
"GetSystemMetri cs" (ByVal nIndex As Long) As Long

Sub ScreenSize()
Debug.Print "Width: " & WinAPI_GetSyste mMetrics(gclngS M_CXMAXIMIZED)
Debug.Print "Height: " & WinAPI_GetSyste mMetrics(gclngS M_CYMAXIMIZED)
End Sub
--->

--
This sig left intentionally blank
Nov 13 '05 #2
lauren quantrell wrote:
Is there a way to determine the size of the user's screen minus the
Windows task bar?


In a standard module:

Private Const HWND_TOP As Long = 0
Private Const HWND_TOPMOST As Long = -1
Private Const SWP_NOZORDER As Long = &H4
Private Const SWP_NOOWNERZORD ER As Long = &H2

Private Declare Function GetClientRect Lib "user32" _
(ByVal hwnd As Long, lpRect As Rect) As Long

Private Type Rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Declare Function BringWindowToTo p Lib "user32" _
(ByVal hwnd As Long) As Long

Public Sub MaximizeToClien tRect(ByRef Form As Form)
Dim ClientRect As Rect
GetClientRect Application.hWn dAccessApp, ClientRect
With ClientRect
SetWindowPos _
Form.hwnd, _
HWND_TOP, _
.Left, _
.Top, _
.Right - .Left, _
.Bottom - .Top, _
SWP_NOZORDER
End With
End Sub

In the form module:

Private Sub Form_Open(Cance l As Integer)
MaximizeToClien tRect Me
End Sub

--
--
Lyle
--
From ADO28.chm

Deprecated Components
Each of the following components is considered obsolete. While these
components are still supported in this release of the Microsoft® Data
Access Components (MDAC), they may be removed in the future. When
writing new applications, you should avoid using these deprecated
components. When modifying existing applications, you are strongly
encouraged to remove any dependency on these components.

ODBC Provider (MSDASQL)
You are strongly encouraged to use one of the native OLE DB Providers
instead of the Microsoft Open Database Connectivity (ODBC) Provider.
Native OLE DB Providers provide better application stability and
performance. Furthermore, native OLE DB Providers will be supported in
the future, whereas MSDASQL will not have any new features added to it,
will not be available on 64-bit, and will not be accessible from the OLE
DB NET Data Provider.

Remote Data Services (RDS)
Remote Data Services (RDS) is a proprietary Microsoft mechanism for
accessing remote data across the Internet or intranet. Microsoft is now
shipping the Microsoft Simple Object Access Protocol (SOAP) Toolkit 2.0
that enables you to access remote data using an open, XML-based
standard. Given the availability of the SOAP Toolkit 2.0, you should
migrate from RDS to SOAP. The SOAP 2.0 Toolkit 2.0 also includes sample
code for remotely accessing Microsoft ActiveX® Data Objects (ADO)
Recordsets.

Jet and Replication Objects (JRO)
The Microsoft Jet OLE DB Provider and other related components were
removed from MDAC 2.6. Microsoft has deprecated the Microsoft Jet
Engine, and plans no new releases or service packs for this component.
As a result, the Jet and Replication Objects (JRO) is being deprecated
in this release and will not be available in any future MDAC releases.

.....
Nov 13 '05 #3
On Mar 09 2005, 04:30 pm, "lauren quantrell" <la************ *@hotmail.com>
wrote in news:11******** **************@ g14g2000cwa.goo glegroups.com:
Is there a way to determine the size of the user's screen minus the
Windows task bar?


Another way, which has the advantage of taking into account any toolbars
that might be visible on the desktop (Office, etc.), not just Windows
taskbar:

Private Declare Function apiSystemParame tersInfo Lib "user32" _
Alias "SystemParamete rsInfoA" (ByVal uAction As Long, _
ByVal uParam As Long, lpvParam As RECT, ByVal fuWinIni As Long) As Long

Private Const SPI_GETWORKAREA = 48

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Public Sub T

Dim r As RECT

apiSystemParame tersInfo SPI_GETWORKAREA , 0&, r, 0&

Debug.Print r.Top, r.Left, r.Bottom, r.Right

End Sub

--
remove a 9 to reply by email
Nov 13 '05 #4
Lyle,
Thanks for the reply. Your code only works to maximize the form within
the Access window frame, whatever shape and position that might be in.
But it did get me pointed in the right direction, and using a
complation of code I came up with the following solution:

Global Const gclngSM_CXMAXIM IZED = 61
Global Const gclngSM_CYMAXIM IZED = 62

Declare Function WinAPI_GetSyste mMetrics Lib "user32" Alias
"GetSystemMetri cs" (ByVal nIndex As Long) As Long

Private Const HWND_TOP As Long = 0
Private Const SWP_NOZORDER As Long = &H4

Function MaximizeToWindo wsRect(ByRef Form As Form)

Dim ScreenWidth As Long, ScreenHeight As Long

ScreenWidth = WinAPI_GetSyste mMetrics(gclngS M_CXMAXIMIZED)
ScreenHeight = WinAPI_GetSyste mMetrics(gclngS M_CYMAXIMIZED)

SetWindowPos Form.hwnd, HWND_TOP, 0, 0, ScreenWidth, ScreenHeight -
3, SWP_NOZORDER

End Function


Lyle Fairfield wrote:
lauren quantrell wrote:
Is there a way to determine the size of the user's screen minus the
Windows task bar?
In a standard module:

Private Const HWND_TOP As Long = 0
Private Const HWND_TOPMOST As Long = -1
Private Const SWP_NOZORDER As Long = &H4
Private Const SWP_NOOWNERZORD ER As Long = &H2

Private Declare Function GetClientRect Lib "user32" _
(ByVal hwnd As Long, lpRect As Rect) As Long

Private Type Rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Declare Function BringWindowToTo p Lib "user32" _
(ByVal hwnd As Long) As Long

Public Sub MaximizeToClien tRect(ByRef Form As Form)
Dim ClientRect As Rect
GetClientRect Application.hWn dAccessApp, ClientRect
With ClientRect
SetWindowPos _
Form.hwnd, _
HWND_TOP, _
.Left, _
.Top, _
.Right - .Left, _
.Bottom - .Top, _
SWP_NOZORDER
End With
End Sub

In the form module:

Private Sub Form_Open(Cance l As Integer)
MaximizeToClien tRect Me
End Sub

--
--
Lyle
--
From ADO28.chm

Deprecated Components
Each of the following components is considered obsolete. While these
components are still supported in this release of the Microsoft®

Data Access Components (MDAC), they may be removed in the future. When
writing new applications, you should avoid using these deprecated
components. When modifying existing applications, you are strongly
encouraged to remove any dependency on these components.

ODBC Provider (MSDASQL)
You are strongly encouraged to use one of the native OLE DB Providers instead of the Microsoft Open Database Connectivity (ODBC) Provider.
Native OLE DB Providers provide better application stability and
performance. Furthermore, native OLE DB Providers will be supported in the future, whereas MSDASQL will not have any new features added to it, will not be available on 64-bit, and will not be accessible from the OLE DB NET Data Provider.

Remote Data Services (RDS)
Remote Data Services (RDS) is a proprietary Microsoft mechanism for
accessing remote data across the Internet or intranet. Microsoft is now shipping the Microsoft Simple Object Access Protocol (SOAP) Toolkit 2.0 that enables you to access remote data using an open, XML-based
standard. Given the availability of the SOAP Toolkit 2.0, you should
migrate from RDS to SOAP. The SOAP 2.0 Toolkit 2.0 also includes sample code for remotely accessing Microsoft ActiveX® Data Objects (ADO)
Recordsets.

Jet and Replication Objects (JRO)
The Microsoft Jet OLE DB Provider and other related components were
removed from MDAC 2.6. Microsoft has deprecated the Microsoft Jet
Engine, and plans no new releases or service packs for this component. As a result, the Jet and Replication Objects (JRO) is being deprecated in this release and will not be available in any future MDAC releases.
....


Nov 13 '05 #5
Dimitri,
You have provided the perfect solution!
My earlier solution did not take into account the toolbar position
problem, which you have provided me a solution for.
This code maximizes an Access form to the usable Windows screen area
and takes into account the size and position of toolbars and taskbar.
Thanks to everyone for giving me the pieces and concept.

So here is my finished code:

'***CODE START:

Private Declare Function apiSystemParame tersInfo Lib "user32" _
Alias "SystemParamete rsInfoA" (ByVal uAction As Long, _
ByVal uParam As Long, lpvParam As RECT, ByVal fuWinIni As Long) As Long

Private Const SPI_GETWORKAREA = 48

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Const HWND_TOP As Long = 0
Private Const SWP_NOZORDER As Long = &H4

Function MaxForm(ByRef Form As Form)

Dim r As RECT

apiSystemParame tersInfo SPI_GETWORKAREA , 0&, r, 0&

SetWindowPos Form.hwnd, HWND_TOP, r.Left, r.Top, r.Right - r.Left,
r.Bottom - r.Top, SWP_NOZORDER

End Function
'***CODE END
Dimitri Furman wrote:
On Mar 09 2005, 04:30 pm, "lauren quantrell" <la************ *@hotmail.com> wrote in news:11******** **************@ g14g2000cwa.goo glegroups.com:
Is there a way to determine the size of the user's screen minus the
Windows task bar?
Another way, which has the advantage of taking into account any

toolbars that might be visible on the desktop (Office, etc.), not just Windows taskbar:

Private Declare Function apiSystemParame tersInfo Lib "user32" _
Alias "SystemParamete rsInfoA" (ByVal uAction As Long, _
ByVal uParam As Long, lpvParam As RECT, ByVal fuWinIni As Long) As Long
Private Const SPI_GETWORKAREA = 48

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Public Sub T

Dim r As RECT

apiSystemParame tersInfo SPI_GETWORKAREA , 0&, r, 0&

Debug.Print r.Top, r.Left, r.Bottom, r.Right

End Sub

--
remove a 9 to reply by email


Nov 13 '05 #6
Dimitri. Thanks very much for helping me solve this. Now I just need to
know how to make my floating Access toolbar appear on top of the
maximized form window.
lq

Nov 13 '05 #7
On Mar 12 2005, 02:51 am, "lauren quantrell" <la************ *@hotmail.com>
wrote in news:11******** **************@ z14g2000cwz.goo glegroups.com:
Dimitri. Thanks very much for helping me solve this. Now I just need to
know how to make my floating Access toolbar appear on top of the
maximized form window.


If I remember correctly, you can't do this with a maximized popup form. Is
there a particular reason you have to open the form as popup? Another
option may be to dock the toolbar.

Now, if I don't remember correctly and it is actually possible, then you
can try to hide and show the toolbar. Perhaps it will show on top of the
form after doing that.

--
remove a 9 to reply by email
Nov 13 '05 #8
Dimitri Furman <df*****@cloud9 9.net> wrote in
news:Xn******** *************** *****@127.0.0.1 :
On Mar 12 2005, 02:51 am, "lauren quantrell"
<la************ *@hotmail.com> wrote in
news:11******** **************@ z14g2000cwz.goo glegroups.com:
Dimitri. Thanks very much for helping me solve this. Now I just
need to know how to make my floating Access toolbar appear on top
of the maximized form window.


If I remember correctly, you can't do this with a maximized popup
form. Is there a particular reason you have to open the form as
popup? Another option may be to dock the toolbar.

Now, if I don't remember correctly and it is actually possible,
then you can try to hide and show the toolbar. Perhaps it will
show on top of the form after doing that.


I'm coming into this thread late, but I once solved this problem by
creating a common "toolbar" as a subform that was embedded in all my
main forms. That kept it exactly where I wanted it, while also
allowing easy contextual modifications.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #9
David,
I also thought of that solution a little too late for this application
I'm afraid since I have maybe 100 forms. But the next project I will do
just that.

BTW I did discover that toolbar vbShowNo follwed by vbSHowYes brings
the toolbar to the top of a popup form. I had only tried vbShowYes.

lq

David W. Fenton wrote:
Dimitri Furman <df*****@cloud9 9.net> wrote in
news:Xn******** *************** *****@127.0.0.1 :
On Mar 12 2005, 02:51 am, "lauren quantrell"
<la************ *@hotmail.com> wrote in
news:11******** **************@ z14g2000cwz.goo glegroups.com:
Dimitri. Thanks very much for helping me solve this. Now I just
need to know how to make my floating Access toolbar appear on top
of the maximized form window.


If I remember correctly, you can't do this with a maximized popup
form. Is there a particular reason you have to open the form as
popup? Another option may be to dock the toolbar.

Now, if I don't remember correctly and it is actually possible,
then you can try to hide and show the toolbar. Perhaps it will
show on top of the form after doing that.


I'm coming into this thread late, but I once solved this problem by
creating a common "toolbar" as a subform that was embedded in all my
main forms. That kept it exactly where I wanted it, while also
allowing easy contextual modifications.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc


Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3479
by: mh | last post by:
Hi Folks- I'm trying to do a simple emulation of unix "locate" functionality in python for windows. Problem is I don't want to crawl/index optical drives. Do any of the windows people out there know how I can determine: 1. How many drives are on the system? (I could just iterate over the alphabet os.path.exists("%s:\\"%letter) ... is there a "windows" way of
2
1494
by: mykidisgollum | last post by:
Greetings, We've recently been working with our site pages' viewstate, turning off unnecessesary viestate items to reduce page size for faster loading. We are also experimenting with using less tables etc. What is the best way to determine the amount of data passed from server to client in an ASP.NET page run? Right now the only way we know is to view source, save source and view the file size properties. I believe this may not...
2
2358
by: pmclinn | last post by:
What is the easiest way to find the viewable space on a EU's monitor, minus the taskbar space.....
6
2778
by: arun.hallan | last post by:
Hi, I want to run a webservice method every night at a specified time, say 10pm. The current way i thought of doing this is to have a windows service and a timer which checks the time every minute and when it gets to 10:00 it fires off the webmethod. Is this the best way to do it? If not, does anyone have any
12
1754
by: garyusenet | last post by:
I want to write a program that lists all folders on my local hard drive in order of size, any ideas for how I might do this? Thankyou, Gary.
1
3473
by: SetonSoftware | last post by:
I'm developing a VB.NET 2005 WinForms application that will run on a tablet PC. I want to build a screen resizer method that will position the forms and controls properly depending on whether the display is in landscape mode (using the tablet like a notebook with keyboard) or portrait mode (using the tablet, well, as a tablet). I can trap when the user flips the display via the SystemEvents.DisplaySettingsChanged event. The problem is I...
3
2158
by: Mufasa | last post by:
I have customers who install our product and then set the screen resolution to a crappy resolution so things don't display on the screen correctly. I'd like to know what the default monitor setting is set to. I'd also like to know what windows has detected as the default screen res. I'd also like to find out information about what monitor is hooked up to the computer. I realize this isn't always right but I'd like to know what windows is...
4
10377
by: dipalipatel | last post by:
Hi, I have one c# smart device application created in .net 2005. I have fixed size form for my one device. Now i have another device and screen size is chaged menas it is more wider and short in size. If i run same application then some of the controls are not visible as screen dimentions chages. So, is there any way i can auto size my forms as per screen dimentions. For exmple if i have screen dimensions like 251 X 300 it works...
6
2236
by: davidson1 | last post by:
If I am using UNIX,suppose if I need to see the Windows Screen,Is it is Possible,Which Command can be used for that.
0
9119
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8852
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8830
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7664
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6493
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5839
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2276
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1977
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.