Print Page | Close Window

[Solved]Get the position and size of Floating Pane

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=17204
Printed Date: 24 April 2024 at 9:07am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [Solved]Get the position and size of Floating Pane
Posted By: Jebo
Subject: [Solved]Get the position and size of Floating Pane
Date Posted: 05 September 2010 at 1:20pm
Hello,

I need the position and size of a Floating Pane. BUT HOW do I get this?

I was trying to catch it by GetWindowRect API. But the Result is WITHOUT the caption Height an Border-width of a floating pane?

So please how can I get the right values OR the Border-width plus caption Height of a floeting pane???




Replies:
Posted By: Jebo
Date Posted: 05 September 2010 at 2:38pm
ARGHHHH!!!! I have tried everything in the last many hours!

Also tried this Workaround: http://forum.codejock.com/forum_posts.asp?TID=17066

It seems it's not possible!!!

CJ, WHY?

PLEASE add a position/location property to next release!


Posted By: jpbro
Date Posted: 05 September 2010 at 5:05pm
It looks like you need to call the GetParent API twice - once on the Pane.Handle, and Once on the return value of GetParent(Pane.Handle) in order to get the top level window. So:


Private Declare Function GetParent Lib "user32.dll" (ByVal hwnd As Long) As Long


Private Sub Command1_Click()
   Dim lt_Rect As RECT
   Dim l_PaneIndex As Long   ' Pane Index to find the window size of

   GetWindowRect GetParent(GetParent(Me.DockingPane1.Panes(l_PaneIndex).Handle)), lt_Rect ' Rect contains position of window in Pixels.

   Debug.Print lt_Rect.Right - lt_Rect.Left, lt_Rect.Bottom - lt_Rect.Top   ' print width and height of window
End Sub



-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: jpbro
Date Posted: 05 September 2010 at 5:21pm
I guess the "correct" way would be to use the GetAncestor API instead:


Private Declare Function GetAncestor Lib "user32.dll" (ByVal hwnd As Long, ByVal gaFlags As Long) As Long
Private Const GA_ROOTOWNER As Long = 3

Private Sub Command1_Click()
   Dim lt_Rect As RECT
   Dim l_PaneIndex As Long   ' Pane Index to find the window size of

   GetWindowRect GetAncestor(Me.DockingPane1.Panes(l_PaneIndex).Handle, GA_ROOTOWNER), lt_Rect ' Rect contains position of window in Pixels.

   Debug.Print lt_Rect.Right - lt_Rect.Left, lt_Rect.Bottom - lt_Rect.Top   ' print width and height of window
End Sub




-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Jebo
Date Posted: 05 September 2010 at 6:08pm
Hi jpbro,

You are the Hero!    ...
GetParent will work!

Wow! Now I have so many hours of hard work behind me.

What's interesting is that I tested also the GetParent API but made a mistake. Then I tried it not anymore!

BIG THX!!!


Posted By: jpbro
Date Posted: 05 September 2010 at 7:48pm
Glad to help Jebo!

-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net