Reputation: 49
Actually I find there is a same demand post here. But I find some problem still, so I have to post another question here.
If I use snipaste to capture the toolbar. I can know the real title bar is 28
like this
But if I use the method in that post like this:
#include<iostream>
#include <wtypes.h>
using namespace std;
int main() {
cout << GetSystemMetrics(SM_CYCAPTION) << endl;
return 0;
}
I will just get 23
. Is there any thing I have missed? Or the 28
actually contain other portion besides the title bar? What can I do to find the real height of title bar with c++.
Upvotes: 1
Views: 3036
Reputation: 15055
Not precisely what you asked, but I often find this a useful metric:
int FindExtraWindowHeight(HWND h)
{
RECT w, c;
GetWindowRect(h, &w);
GetClientRect(h, &c);
return (w.bottom - w.top) - (c.bottom - c.top);
}
The difference between the window and the client area. So this will give you the title bar height + the border thickness.
Upvotes: 4