Home > Software engineering >  For help, how to add images to tray icon
For help, how to add images to tray icon

Time:10-09

Write a simple tray program, how to realize the tray icon to the lower right corner to join a picture, or a blank look strange

CodePudding user response:

http://babybandf.blog.163.com/blog/static/61993532009121899788/

CodePudding user response:

reference 1st floor paschen response:
http://babybandf.blog.163.com/blog/static/61993532009121899788/

I mean I want make me a custom icon images, blog, if did not say ah

CodePudding user response:

NOTIFYICONDATA structure in the body is not a hIcon variables, you give the assignment not good

 
# define MY_NOTIFYICON (WM_USER + 200)

NOTIFYICONDATA data=https://bbs.csdn.net/topics/{0};
Data. The cbSize=sizeof (NOTIFYICONDATA)
Data. HIcon=: : LoadImage (NULL, _T (" res \ \ hanky-panky. ICO "), IMAGE_ICON, 32, 32, LR_LOADFROMFILE);//to check the LoadImage this API
Data. The hWnd=hMainWnd;//tray icon of the form
Data. The uID=31000;//tray icon ID, you specify, generally set to form the ID value of the
Data. UFlags=NIF_ICON | NIF_MESSAGE | NIF_TIP;//tray icon structure attribute
Data. The uCallbackMessage=MY_NOTIFYICON;//set the tray icon click message
//...
//...

Shell_NotifyIcon (NIM_ADD, & amp; The data);
//...
//...

CodePudding user response:

reference lsq19871207 reply: 3/f
NOTIFYICONDATA structure in the body is not a hIcon variables, you give the assignment not good

 
# define MY_NOTIFYICON (WM_USER + 200)

NOTIFYICONDATA data=https://bbs.csdn.net/topics/{0};
Data. The cbSize=sizeof (NOTIFYICONDATA)
Data. HIcon=: : LoadImage (NULL, _T (" res \ \ hanky-panky. ICO "), IMAGE_ICON, 32, 32, LR_LOADFROMFILE);//to check the LoadImage this API
Data. The hWnd=hMainWnd;//tray icon of the form
Data. The uID=31000;//tray icon ID, you specify, generally set to form the ID value of the
Data. UFlags=NIF_ICON | NIF_MESSAGE | NIF_TIP;//tray icon structure attribute
Data. The uCallbackMessage=MY_NOTIFYICON;//set the tray icon click message
//...
//...

Shell_NotifyIcon (NIM_ADD, & amp; The data);
//...
//...

In the middle of that data. HIcon=: : LoadImage (NULL, _T (" res \ \ hanky-panky. ICO "), IMAGE_ICON, 32, 32, LR_LOADFROMFILE);
Compile pass ah, can not HANDLE type assigned to HICON type

CodePudding user response:

The
reference 4 floor HHeellooword reply:


Casting...

HICON HICON=(HICON) LoadImage (... );

CodePudding user response:

reference 1st floor paschen response:
http://babybandf.blog.163.com/blog/static/61993532009121899788/


Have said: NotifyIcon. HIcon=AfxGetApp () - & gt; LoadIcon (IDR_MAINFRAME);

CodePudding user response:

reference 5 floor Sandrer reply:
Quote: refer to 4th floor HHeellooword response:


Casting...

HICON HICON=(HICON) LoadImage (... );


Right, need to cast, I knock code manually, please forgive me

CodePudding user response:

M_tnid. HIcon=AfxGetApp () - & gt; LoadIcon (IDR_MAINFRAME);
So use the program icon
  • Related