|
Hi all,
I have developed a win32 console application, that has a notify icon in the taskbar. The problem is that I'm using the file name to load the icon, so if the ico file is not present, the icon can not be loaded.
For example:
...
niData.uFlags = NIF_ICON|NIF_MESSAGE|NIF_TIP;
LPTSTR szFileName = "SlotClient.ico";
niData.hIcon = (HICON)LoadImage( NULL,
szFileName,
IMAGE_ICON,
0,
0,
LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE );
strcpy(niData.szTip,"Application Running");
SetConsoleTitle((LPCSTR)"Test Application");
HWND hWnd = FindWindow(NULL, (LPCTSTR)"Test Application");
niData.hWnd = hWnd;
BOOL rc = Shell_NotifyIcon(NIM_ADD,&niData);
...
Q:How can I load an icon out of the dynamic link library 'user32.dll' so that when I can't find the .ico, I can load another one from the dll.
Many Thanks.
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
The best thing to do would be to display the icon that the system thinks is associated with that file type. Use SHGetFileInfo() with uFlags = SHGFI_ICON | SHGFI_LARGEICON (or HGFI_SMALLICON ).
|
|
|
|
|
Try using ExtractIcon API.
Regards,
Paresh.
|
|
|
|
|
Hi,
Thank you for the reply. Just one question if I may, how do I go about getting the handle to the instance of the application, seeing that I use a console application.
Many Thanks
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
GetModuleHandle(NULL)
HMODULE s and HINSTANCE s are the same beast in Win32 (a difference used to exist in the Win16 days) so feel free to cast between them.
Steve
|
|
|
|
|
|
|
|
I still could not find my answer . I need drag a image (bitmap or any image)on the dialogbox so that every time i drag I find it top and letf coordinated in the textbox .
RajeshGupta
|
|
|
|
|
rajeshgupta1253 wrote: I need drag a image (bitmap or any image)on the dialogbox so that every time i drag I find it top and letf coordinated in the textbox .
i didn't understand your question!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hello everyone,
I want to use a pdf Viewer ActiveX Control in my MFC Application.Can any one suggest a free ActiveX control for the same Or please suggest some ActiveX with low price.
Midhun M
|
|
|
|
|
Hi,
Have a look at Adobe ActiveX Control with MFC[^] I think it will help.
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
thank u..
Can i use the same Activex For creating pdf from my application
Midhun
|
|
|
|
|
Hi
I am having the following doubt regarding copy constructor
E.g If I have class A then the copy constructor will be
A(const A& x)
{
}
why it can't be
1. A(const A x)
{
}
2. A(const A* x)
{
}
Please give me the reason also
|
|
|
|
|
ragavan wrote: 1. A(const A x)
{
}
If the argument x is passed by value a copy is needed. This is the job of the copy constructor. Therefore we'd need to call the copy constructor to copy the argument to the copy constructor, and so on, endlessly recursively.
ragavan wrote: 2. A(const A* x)
{
}
Because an object itself need copying, not the object indirected through a pointer. It could have worked this was but it doesn't make as much sense.
Steve
|
|
|
|
|
From the C++ Standard ISO/IEC 14882-1998 12.8/2:
A non-template constructor for class X is a copy constructor if its
first parameter is of type X&, const X&, volatile X& or const volatile
X&, and either there are no other parameters or else all other
parameters have default arguments.
|
|
|
|
|
ragavan wrote: Please give me the reason also
interview question ahha
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
hi i have to copy an exe to the system (in a specified path)while installing an package and then run this exe until system restarts or shutdown. how to do this. any clues pls help me
|
|
|
|
|
Hope I understood your question
Do you need to ExitWindowsEx ?
|
|
|
|
|
yes but i dont know how to do this. any clues
|
|
|
|
|
|
Please look at "Windows Services". Hope this is what you are looking for.
Regards,
Paresh.
|
|
|
|
|
Are you needing help with: 1) copying a file to another machine, or 2) running a program on another machine?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
saisp wrote: have to copy an exe to the system (in a specified path)while installing an package and then run this exe until system restarts or shutdown
is your client application is being installed at that machine
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Is it possible to send a message to a worker thread? I know we could send a message to a UI thread, but is the same possible with a worker thread?
Thanks,
AJ
|
|
|
|