forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Best way to get TitleBar(cap) height

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Thu Mar 22, 2007 11:32 am    Post subject: Best way to get TitleBar(cap) height Reply with quote

Whats the best or easiest way to get TitleBar(cap) height.

The measurement down from the top of the dialog is not a guaranteed result without knowing the TitleBar(cap) height.

When the classic style is used for example, the Title bar is not as vertically tall in pixels.

Thanks for reading Cool
Back to top
View user's profile Send private message Visit poster's website
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Thu Mar 22, 2007 4:20 pm    Post subject: Reply with quote

Code:

%%SM_CYCAPTION = 4
LOADLIB user32.dll
%%height = @lib(user32,GetSystemMetrics,INT:,%%SM_CYCAPTION)
info Titlebar height in pixels: %%height
FREELIB user32.dll

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Thu Mar 22, 2007 11:01 pm    Post subject: Reply with quote

wow
Thats gotta be the best simplist answer ever givin here Very Happy

Not taking anything away from the answer, but I found something that I could'nt figure.

The below example has the VDS SMALLCAP style but its still seen as 26 pixels tall.

Am I drunken without any alcohol again Rolling Eyes

Code:
DIALOG CREATE,captest,-1,0,200,150,SMALLCAP
DIALOG ADD,BUTTON,GETtbh,80,15,120,30,Get Title bar Height,,,hand
dialog show

:Evloop
  wait event
  goto @event()

:GETtbhBUTTON
%%SM_CYCAPTION = 4
LOADLIB user32.dll
%%height = @lib(user32,GetSystemMetrics,INT:,%%SM_CYCAPTION)
info Titlebar height in pixels: %%height
FREELIB user32.dll
goto evloop

:close
EXIT


I could just make a math formula adjustment when knowing SMALLCAPS is added.

Thanks for that awesome code SnarlingSheep, really appreciated that, quick answer too, your too cool!
Back to top
View user's profile Send private message Visit poster's website
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Fri Mar 23, 2007 1:39 am    Post subject: Reply with quote

Try SM_CYSMCAPTION instead of SM_CYCAPTION
Code:

%%SM_CYSMCAPTION = 51

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Fri Mar 23, 2007 3:58 am    Post subject: Reply with quote

Code:
:GETtbhBUTTON
%%SM_CYSMCAPTION = 51
LOADLIB user32.dll
%%height = @lib(user32,GetSystemMetrics,INT:,%%SM_CYSMCAPTION)
info Titlebar height in pixels: %%height
FREELIB user32.dll

I'm getting 21 result on XP SMALLCAPS  (PaintProgram shows 18 pixels)



Code:
:GETtbhBUTTON
%%SM_CYCAPTION = 4
LOADLIB user32.dll
%%height = @lib(user32,GetSystemMetrics,INT:,%%SM_CYCAPTION)
info Titlebar height in pixels: %%height
FREELIB user32.dll

I'm getting 26 result on XP CAPS   (PaintProgram shows 29 pixels)


Is this right?

< EDIT - got the order correct now >


Last edited by vtol on Fri Mar 23, 2007 5:28 am; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Fri Mar 23, 2007 5:15 am    Post subject: Reply with quote

The code is right, I think you have your results backwards though.
You show the results for small caption in the code for regular caption, and vice versa.

Here I get 26 from both GetSystemMetrics and an imaging program for regular caption.
But I get 18 from GetSystemMetrics and 21 from an imaging program for small caption.
My selection is good, so I'm not real sure what the difference is there.

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Fri Mar 23, 2007 5:24 am    Post subject: Reply with quote

lol
Your right I had them reversed. < FIXED - EDITED THEM >

I noticed in a paint program theres 3 or 4 pixels as edging or bossed edge.

I'm not sure either, but 3 is close enough and if need one could add 3 pixels, whatever.

Anyways, it'll do the job easily Smile

Thanks again SnarlingSheep
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group