472,374 Members | 1,274 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,374 software developers and data experts.

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 9081
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_CXMAXIMIZED = 61
Global Const gclngSM_CYMAXIMIZED = 62
Declare Function WinAPI_GetSystemMetrics Lib "user32" Alias
"GetSystemMetrics" (ByVal nIndex As Long) As Long

Sub ScreenSize()
Debug.Print "Width: " & WinAPI_GetSystemMetrics(gclngSM_CXMAXIMIZED)
Debug.Print "Height: " & WinAPI_GetSystemMetrics(gclngSM_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_NOOWNERZORDER 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 BringWindowToTop Lib "user32" _
(ByVal hwnd As Long) As Long

Public Sub MaximizeToClientRect(ByRef Form As Form)
Dim ClientRect As Rect
GetClientRect Application.hWndAccessApp, 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(Cancel As Integer)
MaximizeToClientRect 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.googlegr oups.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 apiSystemParametersInfo Lib "user32" _
Alias "SystemParametersInfoA" (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

apiSystemParametersInfo 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_CXMAXIMIZED = 61
Global Const gclngSM_CYMAXIMIZED = 62

Declare Function WinAPI_GetSystemMetrics Lib "user32" Alias
"GetSystemMetrics" (ByVal nIndex As Long) As Long

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

Function MaximizeToWindowsRect(ByRef Form As Form)

Dim ScreenWidth As Long, ScreenHeight As Long

ScreenWidth = WinAPI_GetSystemMetrics(gclngSM_CXMAXIMIZED)
ScreenHeight = WinAPI_GetSystemMetrics(gclngSM_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_NOOWNERZORDER 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 BringWindowToTop Lib "user32" _
(ByVal hwnd As Long) As Long

Public Sub MaximizeToClientRect(ByRef Form As Form)
Dim ClientRect As Rect
GetClientRect Application.hWndAccessApp, 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(Cancel As Integer)
MaximizeToClientRect 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 apiSystemParametersInfo Lib "user32" _
Alias "SystemParametersInfoA" (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

apiSystemParametersInfo 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.googlegr oups.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 apiSystemParametersInfo Lib "user32" _
Alias "SystemParametersInfoA" (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

apiSystemParametersInfo 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.googlegr oups.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*****@cloud99.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.googlegr oups.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*****@cloud99.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.googlegr oups.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
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...
2
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...
2
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
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...
12
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
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...
3
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...
4
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...
6
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
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

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.