Positioning app window

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I develod application that have main form of fixed size. I have already done
that on app startup the access window get size needed. I can also position it
using x and y values. I'd like to place on the center of the screen.

x = (screenWidth / 2) - (windowSize / 2)

and 'y' the same. But I cannot find how to get screen width.

How to get width of screen?
 
I develod application that have main form of fixed size. I have already done
that on app startup the access window get size needed. I can also position it
using x and y values. I'd like to place on the center of the screen.

x = (screenWidth / 2) - (windowSize / 2)

and 'y' the same. But I cannot find how to get screen width.

How to get width of screen?

with an api call:

Option Compare Database
Option Explicit
Public Declare Function apiGetSystemMetrics Lib "user32" Alias _
"GetSystemMetrics" (ByVal nIndex As Long) As Long

Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1


and then you get the screen Size in Pixels
if you multply it with 15 you get it in Twips (if your screen
resolution is 96 dpi)

ScreenX = apiGetSystemMetrics(SM_CXSCREEN)
ScreenY = apiGetSystemMetrics(SM_CYSCREEN)

If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top