|
Are you sure that lifetime of HFONT is long enough? You can't just pass a HFONT to a Window with WM_SETFONT and destroy the font - the window doesn't copy the font.
The second thing is that not all Windows support this message. Standard controls do, but your own Window classes do not unless you explicitly handle this message.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
the HFONT is only a handle to the font
the HFONT variable need not last the life time of the control
once you send the WM_SETFONT message to the font then you can forget your HFONT variable
even if the HFONT variable is destroyed the font is not destroyed
for that, you may use DeleteObject
Nish
|
|
|
|
|
Sorry, you're wrong. HFONT needs to last as long as the window which uses it. If you destroy the HFONT with DeleteObject, the window painting will fail (SelectObject somewhere inside WM_PAINT handler will not work and subsequent calls to TextOut or DrawText will use default font).
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hello tomasz
I wasnt wrong
I clearly said that if the HFONT variable gets destroyed there is no problem as the CreateFont created front is still alive. I clearly said that for the font to be destroyed you need to call DeleteObject. But if you dont call DeleteObject your font is alive and well and you can forget about the HFONT variable
Nish
|
|
|
|
|
Let's clear things: by 'lifetime of a HFONT' I mean the time between CreateFont[Indirect] and DeleteObject. I'm not talking about local variable of type HFONT.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
oh!
sorry tomasz....
got you wrong
my fault
Nish
|
|
|
|
|
This is my fault as well - instead of technobabble like 'lifetime of a HFONT' I should just write 'you can't immediately delete a font you've set with WM_SETFONT'.
Cheers,
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
maybe...
Nish
|
|
|
|
|
Nish is talking about a deliberate memory leak.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Hello folks,
I know that a service process (under NT/Win2k) should not communicate with GUI, since no user has to be logged in so no shell is available.
But...
When my service is crashing (unhandled exception), I want my general exception handler sends a messagebox to the user in case there's a user logged in.
So...
How can I detect if a shell exist (aka: a user is logged in), so I can safely shoot a messagebox.
Thanks,
EiSl
|
|
|
|
|
hi
this might be a dumb technique but I think you can use GetDesktopWindow() and if that returns NULL, that probably means there is no user logged in
nish
|
|
|
|
|
I think you should rather write this info to the Windows Event Log.
Anyway, if you need to interact with the desktop, first read 'Interactive Services' in your VC++ help. It should be under Platform SDK/DLLs, Processes, and Threads.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I am still trying to choose the language of the standard dialog boxes...
I succeed for all common dialog boxes (printer setup, save as...): Just for try, I put the right comdlg32.dll version (the english one, I am on a french OS)in the working directory of my app and what was my surprise to see that it is working!!! I run my app, clic the "open file" item and the english box was display. I let it open on the desktop and run notepad to clic the same item: the box has been open in french!!!
But I steel searching for the monthes and days names of the calendar. The call of the calendar APIs seems to be in the comctl32.dll but I can't load another version of this DLL as I do for comdlg32.
elisabeth.sever@europlacer.fr
|
|
|
|
|
If you have a DLL that exports a number of classes, many of which a template classes, and you find that there is a common templated type that is being used over and over again, is there something special you're supposed to do for this ? I realize I may not be explaining this very clearly so here's an example:
so I have this:
template <class t=""> class A {
///whatever
};
and I find I am using A<int> all over the place in the library. Should there be some special instantiation of the template type ? Is this more efficient ? Does it even matter ?
|
|
|
|
|
I find I am using A<int> all over the place in the library.
A simple typedef A<int> AINT will save you a bit of typing. Since this is only a compile-time thing, there is no difference in the resulting binary.
--Mike--
http://home.inreach.com/mdunn/
This posting is provided "as was" with no warranties, guarantees, lotteries, or any of those little bags of peanuts you get on planes. You assume all risk for crossing the street without holding mommy's hand. © 2001 Mike's Classy Software. Member FDIC. If rash develops, discontinue use.
your with and
|
|
|
|
|
Guys,
Is there any way to cancel WaitCommEvent for non-overlapped IO ?
Thanx..
|
|
|
|
|
You can't...
Only one thing at a time can be done to a non-overlapped serial port.
See Q105302
Col
|
|
|
|
|
how can i get a responce to a click on a capture window. i tried ONLBUTTONDOWN but no responce
|
|
|
|
|
I found the only way to make this work was to keep firing a timer that called SetCapture over and over, and doing this in OnMouseMove:
CPoint pt;
GetCursorPos(&pt);
CRect rc;
GetWindowRect(&rc);
if (rc.PtInRect(pt))
ReleaseCapture();
Here's the timer function:
if(nIDEvent == ID_TIMER_SETCAPTURE)
{
CPoint pt;
GetCursorPos(&pt);
CRect rc;
GetWindowRect(&rc);
if (!rc.PtInRect(pt))
SetCapture();
}
I did not find another solution that captured the mouse AND got the click messages inside the dialog class. If you find one, please LMK because I thought this very ugly indeed.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Dear friends,
i've created one dialog box, which shows the downloading status of a file from the internet. but, the speed is a bit slower than the actual windows downloading dialog box. can any1 suggest how to make my dialog box downloads more faster than the windows one. thanx in advance...gopi
|
|
|
|
|
Does anyone know if HDN_BEGINTRACK ever gets sent correctly ? I have a listview in report mode and when I click and drag the header divider, the HDN_BEGINTRACK message is never sent. Is this a known bug ? I looked on MSDN and didn't see much. I am writing in raw Win32, not MFC, if that matters.
|
|
|
|
|
Stupid question, but you're checking for it properly as a WM_NOTIFY message ? Have you tried Spy ++ to see if it gets sent ?
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Yeah, I checked in spy, and as far as I can tell it never appears to get fired. Which seems rather odd to say the least. What's even weirder, is that HDN_ENDTRACK does get sent, and HDN_TRACKING does not get sent. very frustrating.
|
|
|
|
|
I believe this problem can be caused by HDN_BEGINTRACKW (Unicode) notification sent even if your app doesn't use Unicode and expects HDN_BEGINTRACKA mapped to HDN_BEGINTRACK by preprocessor. There was a similar question some time ago in this forum.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
now In my database,I can get the name of sender and receiver ,
the text the sender send to,the time,and the attachment,
the question is how I can save these information to a *.eml?
any suggestions?
thank in advanve!
|
|
|
|