|
There is system setting:
Big/small/custom size of system font in display properties.
How to get It programmatically ?
thanks
|
|
|
|
|
This is untested code, but should hopefully come up with the right answer
HFONT hGuiFont = ::GetStockObject(DEFAULT_GUI_FONT);
CFont font;
font.Attach(hGuiFont);
LOGFONT lf;
font.GetLogFont(&lf);
int size = -lf.lfHeight;
font.Detach(); // dont delete global resources
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
This may seem a little round-about:
GetDeviceCaps(NULL, LOGPIXELSX);
GetDeviceCaps(NULL, LOGPIXELSY); which gives you the number of pixels per inch in each direction.
Setting Small Fonts sets both to 96, Large Fonts sets both to 120, and Custom is something else.
|
|
|
|
|
Hi,
I want to produce a Font, of say size 10 points & with Character ratio 2. In the MFC,I have seen the "CreateFont" method which takes the width as
the 2nd parameter.But How will I get the width of a particular font with size
10 pts.
Could anyone help me regarding this.
Thanks in advance...
|
|
|
|
|
Not sure I understand what you mean. But if you want to know how much space (Wdith) a font takes, select your font in a device context and then use GetTextExtent.
Good luck!
|
|
|
|
|
Thanks for ur reply...........
But I want to know the width of the font,Before I Create the font. My aim is to provide a character ratio for the font.
Iam creating the font using the "CreateFont" method.In this Function,the 2nd parameter is width.So to Create a Font with a particular character ratio,I need to give in this 2nd parameter a value which is equal to (widthoffont * characterratio).
sO THATS why I want to know the width of the font before creating a font before.Is it possible?.
|
|
|
|
|
You will probably have to create this font in 3 stages.
1. Create it using normal parameters to allow windows to choose the correct width for the font height
2. Get the LOGFONT of this font
3. double the width value and CreateFontIndirect() using the LOGFONT
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
Hi,
I want to know the width of a font,Before I Create a font. My aim is to provide
a character ratio for the font.
Iam creating the font using the "CreateFont" method.In this Function,the 2nd parameter
is width.So to Create a Font with a particular character ratio,I need to give in this 2nd
parameter a value which is equal to (widthoffont * characterratio).
sO THATS why I want to know the width of the font before creating a font before.Is it
possible?.
I tried as u told:
CFont font:
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
font.CreateFont(-height,0,rotVal.x ,rotVal.y,style,FALSE,FALSE,0,ANSI_CHARSET,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS,
reinterpret_cast(facename.c_str()));
// In "CreateFont" method Iam giving width as 0 in the 2nd parameter as I dont know the width in advance & I tried to get the width windows allocated using the logFont Structure. But Iam not getting the width windows allocated instead Iam getting '0' which I gave in the "CreateFont" method.How is it possible to get the width windows allocated.
Would be nice if someone tells me how to achieve this....
font.GetLogFont(&lf);
long width = lf.lfWidth;
font.CreateFontIndirect(&lf);
Thanks in advance.........
|
|
|
|
|
i need to boot from flash. OS can be win98 or linux.
how can i do that
|
|
|
|
|
Call me a sceptic, but USB technology is still kept in the dark due to very large $$$ potential to private companies.
|
|
|
|
|
Set your BIOS to use the USB as a boot device and have your flash-stick formatted as a bootable device.
Now it SHOULD work....
If it does, you have the reassuring knowledge that you are far ahead of the common mob.
In other words, it seems to be plain luck.
Newer computers and notebooks tend to do better with USB than older desktops.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Hi All
does ne1 know how to add an HTML help to a sdi appplication genertated in Visual Studio 2003
normally this would be created at the start of the project, but i didnt think that i would require
one, however i now need to add one to my project
does anyone know how to do this
thanks
simon
|
|
|
|
|
Hi
Now I develop a control derrived from static text.
In PreSubclassWindow() I need to call GetFont(). If control is created via dialog editor everything is OK, but when I try to create it in OnInitDialog() handler using Create() method, GetFont() returns NULL.
Why is it so.
____________________
Best regards,
v0id
|
|
|
|
|
Just a stab in the dark, but I think if your call GetFont() before CDialog::OnInitDialog(), the dialog as not been initialised/created, therefore will bomb out.
Try it after the base function is called and see what happens
I Dream of Absolute Zero
|
|
|
|
|
This is a guess, but by the end of the stadnard OnInitDialog, wit hte controls created, the CDialog bass class code calls setFont on each control to set the font to use.
As your doing the Create() calls manually, not font is being set. he control will render with the default GUI font (GetStockObject(DEFAULT_GUI_FONT)), but will return NULL as no specific font to use has been set.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
hi all,
i want to write a program that alows videochating,i do not know how to capture image from webcam, and how to compress it. Can any one help me?
thanks.
|
|
|
|
|
Get the DirectX SDK and look thru some of the samples. http://www.microsoft.com/windows/directx/default.aspx
|
|
|
|
|
How can I delete files from my Visual C++ program?
Christian
|
|
|
|
|
int remove( const char *path );
|
|
|
|
|
|
Press Del in the Project window file list.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Neville Franks wrote:
Press Del in the Project window file list.
hahahaha
The World is getting smaller and so are the people.
|
|
|
|
|
Would you please tell me how to store, retrieve and display .bmp file using sql server 2000 and vc++ 6.0?
Thanks a lot!!!
|
|
|
|
|
I'm encountering a strange problem in multithreaded code (I can hear the groans now ). In a nutshell, my app is MDI where each document has a CListView attached. Each CListView spawns two threads. The first thread monitors a file and, when the file changes, reads the changes and adds the change records to a list. The second thread is signalled by the first thread when the list changes and updates the ListView with the new data.
As part of the shutdown sequence for the program I signal a stop event monitored by each thread which, when signalled, causes the thread to terminate. The stop event is manual reset. Then I wait upon each thread handle to be sure the thread has in fact terminated. Because the work in each thread is inside a loop not directly controlled by the WaitForXObject(s) call there's another boolean variable used to signal the thread, at each iteration of the loop, if I want it to return to the WaitForXObject(s) call. The thread that sets that variable sleeps for a couple of timeslices to be sure the threads see the change. (It makes no difference in the outcome if the thread that sets the variable sleeps 10 ms or 10 seconds).
It all works perfectly if I let it run to completion, ie
file changes
monitor thread notices changes and creates change records, adds them to list
update thread is signalled and copies new records into the view
but if I try to exit the app while the update thread is still processing change records the app hangs about half the time in a call to CListCtrl::InsertItem . I can let it sit there for an hour and nothing happens (and 0% CPU for the app). Breaking under the debugger when it's hung reveals the update thread is waiting for CListCtrl::InsertItem to return.
The thread procedure gets the this pointer to the CListView as the LPVOID parameter. Examining the code for CListCtrl::InsertItem reveals it's a simple wrapper around a ::SendMessage call using the HWND of the CListCtrl embedded in the view (ie, not using the MFC temporary CWnd mechanism. This explains why it works most of the time (no cross thread problems with CWnd 's)).
When I break using the debugger during the hang I can see that the CListView is still valid and the embedded CListCtrl is also still valid (both have valid HWND 's which Spy++ can see). So I can't imagine why it's hanging in the InsertItem call. Since the InsertItem call uses ::SendMessage rather than ::PostMessage it's not message pump related.
Any ideas? Any experience with hangs in CListCtrl::InsertItem ?
Rob Manderson
http://www.mindprobes.net
"I killed him dead cuz he was stepping on my turf, cutting me out of my bling the same way my ho cuts cookies, officer"
"Alright then, move along" - Ian Darling, The Lounge, Oct 10 2003
|
|
|
|
|
Rob Manderson wrote:
Since the InsertItem call uses ::SendMessage rather than ::PostMessage it's not message pump related.
Are you sure? SendMessage waits for the window procedure to complete, if you no longer have a GUI thread it isn't going to be processed.
You could ensure your update threads exit before your main application thread, or use PostMessage instead. I think I would go for the first option.
Ryan.
|
|
|
|