Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get the width and height of current active form

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
Hi,

How do i get the hight and width of the current form?

Code:
MsgBox Me.WindowLeft & " - " & Me.WindowTop & " - " & Me.Form.Width & " - " & Me.Form.WindowHeight

I'm trying the above but the numbers don't look right?

I want add a function call to every form that resizes the DB shell to the size of the current open form

But i can't seem to get the info I need , though I do have the resize working...
Code:
Declare Function apiMoveWindow Lib "user32" Alias "MoveWindow" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long


Public Function resizeApp(iLeft As Integer, iTop As Integer, iWidth As Integer, iHeight As Integer)
    apiMoveWindow Application.hWndAccessApp, iLeft, iTop, iWidth, iHeight, True
End Function

How do I get the info i need to pass to my function?

Thanks,
1DMF

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

MIME::Lite TLS Email Encryption - Perl v0.02 beta
 
note that this information
MsgBox Me.WindowLeft & " - " & Me.WindowTop & " - " & Me.Form.Width & " - " & Me.Form.WindowHeight

are in twips which are 1/1400 of an inch
try
MsgBox Me.WindowLeft*1440 & " - " & Me.WindowTop*1440 & " - " & Me.Form.Width*1440 & " - " & Me.Form.WindowHeight*1440

 
thanks, thoguh that gives an even bigger number?

Width,height,top,bottom take pixels?

anyway, i seem to be going round in circles trying to get the GUI to behave the way I want it to.

basically I want the main app window to resize to the size of the current form instead of having the app window fullscreen with a tiny form in the middle.

I want every form that opens have the main app window resize to fit exatly.

How do i do this?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

MIME::Lite TLS Email Encryption - Perl v0.02 beta
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top