1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| NOTIFYICONDATA m_NotifyIconData;
void __fastcall TForm1::Button2Click(TObject *Sender)
{
HWND hwnd;
HINSTANCE hInst;
HICON hicon = ExtractIcon(hInst,"Project1.exe",0);
Form1->Hide();
m_NotifyIconData.cbSize = sizeof m_NotifyIconData;
m_NotifyIconData.hWnd = hwnd;
m_NotifyIconData.uID = 1;
m_NotifyIconData.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
m_NotifyIconData.uCallbackMessage = WM_USER;
m_NotifyIconData.hIcon = hicon;
strcpy(m_NotifyIconData.szTip, "Appli de test de trayicon");
Shell_NotifyIcon(NIM_ADD, &m_NotifyIconData);
Sleep(5000);
m_NotifyIconData.uFlags = 0;
Shell_NotifyIcon(NIM_DELETE, &m_NotifyIconData);
Form1->Show();
} |
Partager