| View previous topic :: View next topic |
| Author |
Message |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Thu Mar 22, 2007 11:32 am Post subject: Best way to get TitleBar(cap) height |
|
|
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  |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Mar 22, 2007 4:20 pm Post subject: |
|
|
| 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 |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Thu Mar 22, 2007 11:01 pm Post subject: |
|
|
wow
Thats gotta be the best simplist answer ever givin here
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
| 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 |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Fri Mar 23, 2007 1:39 am Post subject: |
|
|
Try SM_CYSMCAPTION instead of SM_CYCAPTION
| Code: |
%%SM_CYSMCAPTION = 51
|
_________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Fri Mar 23, 2007 3:58 am Post subject: |
|
|
| 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 |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Fri Mar 23, 2007 5:15 am Post subject: |
|
|
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 |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Fri Mar 23, 2007 5:24 am Post subject: |
|
|
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
Thanks again SnarlingSheep |
|
| Back to top |
|
 |
|