|
I've been using CSystemTray by Chris Maunder and it's really a wonderful class and made tray icon related programming very convenient.
However I found one problem, the icon shown on system tray is 16*16, so if the source icon is 32*32 it will be shrunk to 16*16, which obviously produces shape distortion. I thoughy that's not the problem because I could add a 16*16 format into the source icon so that it now has both 32*32 and 16*16 formats, but after I added new format it still uses the 32*32 format and shrinks the icon, it just seems to ignore any format in an icon but 32*32.
Now in order to let it recognize 16*16 format, I must delete(!) the 32*32 format from the source icon, by the way Visual studio 6 resource editor does not provide this feature, I had to use a third part icon editor to delete the format, now the only format remains in the icon is 16*16, and it finally worked.
Is there a way to tell the CSystemTray class to specifically choose a format from a given icon? Usually we will store both format in icon IDR_MAINFRAME, use the 32*32 for application main icon, and 16*16 for system tray displaying, that makes sense. We should not have to use two separate icons.
|
|
|
|
|
Visual Studio 6 can delete a specific "device bitmap" from an icon. Go to resource editor, open your icon and check the menu for something that looks like "Delete device bitmap" (sorry I use the german version dunno what it's named in the US version).
Hope it helps, I use the class and it works for me.
|
|
|
|
|
Great, I found the "delete device bitmap" menu, thanks.
My main problem still remains though, how do you specify an icon format? For example, you have an icon resource IDR_MAINFRAME, which consists of both 32*32 and 16*16 device formats, now how do you tell CSystemTray to "Hey, please display the 16*16 one on system tray!", can you?
|
|
|
|
|
When you load the icon, use LoadImage() and specify the size you want. This will work nicely for icon sizes, but be aware: prior to WinXP, the tray does not display icons with more than 16 colors, even if that's what you explicitly load.
--------
The real problem is that you don't have to be religious to be a religious fanatic,
you just have to be a fanatic. -- Stan Shannon, the lounge
|
|
|
|
|
AFAIK LoadIcon() can't, but LoadImage() can.
Well, I personaly never specify icon size, usually Windows picks the appropriate icon automatically. Hm if you feel problems try to trick a little bit:
SetIcon(AfxGetApp()->LoadIcon(IDR_ICON_DEFAULT), TRUE);
SetIcon(NULL, FALSE);
Do NOT call SetIcon() for the small icon with an icon handle if your big icon provides the small device bitmap too.
Another workaround: feed CSystemTray with an 32x32 icon which is a scaled 16x16 icon (each pixel is build by 4 identical pixel).
Hope it helps.
|
|
|
|
|
I have read the article by Chris Maunder about printing. But I'm having some problems. I would like to print plain text from a large CString. How do I know where to break the page??? I've read some articles about this but everyone is avoiding this bit.
Can someone please help a beginner ??
Regards
Henrik
|
|
|
|
|
HenrikO wrote:
I've read some articles about this but everyone is avoiding this bit.
because that's the hard bit.
you essentially have to measure the page, then measure the string. if the string is too long, break it somewhere (by breaking and measuring in a loop, usually). then print the first part, page break, print the next part (or, as much of it that fits on the page) and so on.
i'm sure someone will correct me if i'm wrong... but that's the way i've always seen it done.
-c
Garbage collection, making life better - for weenies!
|
|
|
|
|
Thanks for your response.
Excuse me for the stupid question's I'm asking, but how to I make a page break
regards
Henrik
|
|
|
|
|
CDC::StartPage and CDC::EndPage control where a page starts and ends. CDC::StartDoc and CDC::EndDoc control the overall document.
-c
Garbage collection, making life better - for weenies!
|
|
|
|
|
Thank You I Think this will help me alot!!!!
Best Regards
Henrik
|
|
|
|
|
I just posted an article about this. You can find it in the printing section.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
i want to call the main window of my sdi from a custom dialoge .. is there any way for doing it..
secondly i want to make a check such that every time when i run my software it could check the values in the database .if the data base is all empty it should call the secondary dlg first with displaying the main dlg. and if the data base has some entries then the main dlg should be called.
thanks for ure help
looking forward from all the gurus of code
|
|
|
|
|
This is not what you're asking for, but maybe you can solve your problem by calling the secondary dialog directly when needed in your app's InitInstance , right before the main window initialization.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I've developed an ATL service which offers an interface.
I observed the number of threads the service handles is as big as the number of CoCreateInstance/Release calls for a pointer of that interface.
It seems like the number of threads is only increasing and never decreasing. Is this true or there is a timeout for any thread?
Is it possible to have bugs in my application, despite of the fact that i didn't create any thread?
rechi
|
|
|
|
|
I have some code in a button event. When i push the button an unhandled exception appears saying "Stack overflow". If i put a breakpoint in the first sentence in the button event the Stack overflow message appears anyway so it hasn't executed any code when i comes with the Stack overflow message. If i remove all the code from the button event nothing happens... what's wrong?
|
|
|
|
|
This is truly weird... Could you post the relevant code (the handler itself as well as the macros inserted by the MFC wizard related to it)?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I found out what it was, i created a very large COLORREF array [1600][1200], but it didn't reach to that sentence before the stack overflow message appeared.
|
|
|
|
|
Hi!
Is there any way to make windows execute an app on shutdown? (something like HKCU\Software\Microsoft\Windows\Current Version\Run but for shutdown)
..or do I need to have an app running in background trapping the WM_ENDSESSION message?
Cheers, Marc Click to see my *real* signature
|
|
|
|
|
This is dependent on OS version.
For NT5+ you can do this using gpedit.msc.
|
|
|
|
|
How do you dynamically set menu item text? I am looking at all the ContextMenu methods, but there is no text setting methods. Any ideas?
thanks
|
|
|
|
|
MFC example:
CMenu *pMenu = GetMenu()->GetSubMenu(0);
pMenu->ModifyMenu(2,MF_BYPOSITION | MF_STRING, NULL,"New menu item text");
|
|
|
|
|
You will need to use ModifyMenu().. look up your documentation on CMenu
"When a friend hurts us, we should write it down in the sand, where the winds of forgiveness get in charge of erasing it away, and when something great happens, we should engrave it in the stone of the memory of the heart, where no wind can erase it" Nish on life [methinks]
"It's The Soapbox; topics are optional" Shog 9
|
|
|
|
|
i am using the odbcrecordset class from the threat:
www.codeproject.com/database/odbcrecordset.asp
but i don't know how i can delete a recordset in my database?
someone has an idea???
thanx for help!!!
tom.
|
|
|
|
|
What do you mean by recordset? Do you mean you want to delete all of the data that is contained in your recordset? Or do you want to delete an entire table or view?
CRecordset (which ODBCRecordset is based on) has a Delete() function, which will delete the currently selected record. You could just loop through each record and delete it from the database.
If you want to drop an entire table or view, you should use the CDatabase class. Look at the ExecuteSQL() function.
|
|
|
|
|
int horzres = GetDeviceCaps(GetDC(GetDesktopWindow()), HORZRES);
int vertres = GetDeviceCaps(GetDC(GetDesktopWindow()), VERTRES);
COLORREF *pCol = new COLORREF[horzres][vertres];
VC++ says "non-constant expression as array bound". Why can i use a non-constant expression to create a one-dimensional array but i can't use a non-constant expression to create a two-dimensional array?
Thanks in advance.
|
|
|
|