|
You can simply send a WM_SETFONT message. However, the font object is not copied by the control - it uses the object handle you sent. You need to keep the object around at least as long as the control(s) which use it.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
To whom I must send this message ?
To Label ?
|
|
|
|
|
I Mike means
1) Create a CFont object within the dialog (member variable).
2) Use GetDlgItem() to get the window of the static
3) Use SetFont() to set the font of the static object.
As long as the CFont item is there for the duration of the dialog it will be there for the duration of the dialogs controls.
This solution requires you to do all the work in the dialog.
Ant.
|
|
|
|
|
Thanks you.
Where to call it better ?
In OnInitDialog() ?
|
|
|
|
|
Yea InitDialog is fine
Ant.
|
|
|
|
|
|
why is it said not to initialize in cwinthread constructor but in InitInstance()..
|
|
|
|
|
Where is this "said?" Seeing it in context might help us to better understand what is meant.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
The constructor runs on whatever thread creates the CWinThread object (at the point the object is created). InitInstance runs on the thread itself once it has been started.
Typically there isn't much difference between the two, but things like Thread Local Storage will be affected. MFC uses a fair amount of Thread Local Storage internally.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi
How can I serialize the HANDLE?
Regards
Neha
|
|
|
|
|
You got a smile so bright,
You know you could have been a candle.
I'm holding you so tight,
You know you could have been a handle.
Smokey Robinson, "The Way You Do the Things You Do"
From the point of view of implementation, a handle under Windows is always realized in one of two categories:
1.An offset into a table that is being maintained by either the executive or a subsystem component.
2.A virtual address in the address space of a process.
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
1.An instance handle is a pointer to the image of an executable file in a client process.
2.A resource handle as obtained by FindResource and LoadResource is a pointer to that process within the image.
3.A handle returned from VirtualAlloc or HeapCreate is a pointer to the beginning of the memory block in the client's address space.
4.A handle returned from HeapAlloc is a pointer into the chunk of memory allocated by 3.
5.A GDI handle is a relative offset into a table located in the client's address space.
6.A USER handle is a relative offset into a table located in the server's address space.
7.A handle to a native Windows NT object is a relative offset into a table located in system space. There are several of those tables—one per process and a few tables maintained by the system.
8.A USER object itself is located in the server's address space.
9.In the case of resources, 8 still holds true, but just as in 2, the resource is referenced through a memory-mapped image of the file that holds the executable, only the image resides in the server's address space this time. This is the scenario you encounter, for example, when calling LoadIcon.
10.The data structures that describe native Windows NT objects reside in system address space. Depending on the object type, part of the object may also be located in a process's address space. (This holds true, for example, for section objects.)
11.The data that describes a GDI object resides in the client's address space. Please also observe the restriction mentioned earlier in this article under "How the Subsystem Realizes Window GDI Objects."
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
In other words, you can't meaningfully serialize a HANDLE, because when you read it back in (presumably in a different process) that HANDLE value won't be meaningful.
|
|
|
|
|
Hi, I would like to know how I could programmatically change an image in a dialog.
For example, by clicking on a button, it would change IDC_IMAGE1 to IDC_IMAGE2 for example.
Code examples would be appreciated or reference to an article.
Thanks
Ashley
|
|
|
|
|
http://www.codeproject.com/bitmap/
::DeleteObject(hbmButton))
hbmButton=::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_NEW_BITMAP));
if (hbmButton != NULL)
{
m_ButtonCtrl.SetBitmap(hbmButton);
}
|
|
|
|
|
Hi, I have written a reminders program which allows the user to input something they need reminding about with a date time picker so they can select the date and the time in which the popup should come up....
I need to input into a string the current system time with the same formatting as the control so that the time and dates will match with the times and dates selected by the user. How do I get the System Time in the same format as the CDateTimePicker control?
Code examples would be appreciated or reference to an article.
Thankyou,
Ashley
|
|
|
|
|
Have a look at COleDateTime::Format[^]
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
CDTPicker m_DateStart; // in header
VARIANT tmpValue;
int year;
tmpValue = m_DateStart.GetYaer();
year = tmpValue.iVal;
------
SYSTEMTIME sysTime;
::SendMessage(m_DateStart.GetSafeHwnd(), MCM_GETCURSEL, 0, (LPARAM)&sysTime);
year = sysTime.wYear;
------ *****************************************
http://www.thecodeproject.com/statusbar/activexstatbar.asp
http://www.codeguru.com/Cpp/controls/controls/dateselectioncontrolsetc/article.php/c2229/
|
|
|
|
|
Hi!
I'm building a application in VC++ .NET.
But when i run it it says to me that it's Out-Of-Memory.
The memory on the computer is not full...
How do you get rid of this problem?
Can you give the program more memory?
Regards, Koo
|
|
|
|
|
Are you allocating a large amount of memory?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Is all the memory allocation on the Stack? Or are you allocating on the heap?
Ant.
|
|
|
|
|
I don't know. It's windows that allocate the memory so i don't have a clue...
|
|
|
|
|
If you have Windows 2000 or XP, look at the Performance tab of Task Manager to see the machine's memory usage. What does it look like before and during the program's execution?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
|
Which makes no sense. Look at the Task Manager before your program runs, write down the memory-related numbers. Look at the Task Manager while your program runs, write down the memory-related numbers. Compare those numbers. What do they tell you?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|