attach form to window bottom

  • Thread starter Thread starter el_leon
  • Start date Start date
E

el_leon

hi everybody

I have a form which I need to attach to main window bottom, no matter what
the screen resolution it was. It's some kind of status bar of my own.

Does anyone know to make it stick to the application window bottom? Which
would be the code to be entered in the Form_Open() event? I mean, is there a
way to calculate the value of this variables?

numleft=0
numtop=5800
Forms.Item("ToDo").Move numleft, numtop

If there is a better way to make it, does anyone of you have an example?

thanks in advance, and happy new year to all of you

el_leon
 
You might try getting the screen resolution, then using a case statement,
doing a movesize to where you want. You will probably also need to maximize
or set your form to a constant dimension. Here's some code that will enable
you to get the screen resolution:

Option Compare Database
Option Explicit

Private Declare Function apiEnumDisplaySettings Lib "User32" Alias _
"EnumDisplaySettingsA" (ByVal lpszDeviceName As Long, ByVal iModeNum As _
Long, lpDevMode As Any) As Boolean

Declare Function GetDesktopWindow Lib "User32" () As Long

Declare Function GetWindowRect Lib "User32" _
(ByVal hWnd As Long, rectangle As RECT) As Long

'*****************************************************************

Const DM_PELSWIDTH = &H80000
Const DM_PELSHEIGHT = &H100000
Const CCFORMNAME = 32
Const CCDEVICENAME = 32

Type RECT
x1 As Long
y1 As Long
x2 As Long
y2 As Long
End Type

'*****************************************************************
' FUNCTION: GetScreenResolution()
'
' PURPOSE:
' To determine the current screen size or resolution.
'
' RETURN:
' The current screen resolution. Typically one of the following:
' 640 x 480
' 800 x 600
' 1024 x 768
'
'*****************************************************************
Function GetScreenResolution() As String

Dim R As RECT
Dim hWnd As Long
Dim RetVal As Long

hWnd = GetDesktopWindow()
RetVal = GetWindowRect(hWnd, R)
GetScreenResolution = (R.x2 - R.x1) & "x" & (R.y2 - R.y1)

End Function
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top