bool CXTPTrayIcon::AddIcon() { if (!m_bRemoved) { RemoveIcon(); } m_niData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; if (!ShellNotify(NIM_ADD)) { m_bShowPending = true; return false; } m_bRemoved = m_bHidden = false; return true; }
void ChangeIconDialog::OnRemoveIcon(wxCommandEvent &event) { auto iconList = InstIconList::Instance(); wxString removeIcon = GetSelectedIconKey(); wxString iconFilename = iconList->getFileNameForKey(removeIcon); if (wxFileExists(iconFilename)) { wxRemoveFile(iconFilename); } else { return; } iconList->RemoveIcon(removeIcon); iconListCtrl->UpdateItems(); }
bool CTrayIcon::AddIcon() { if (!m_bRemoved) RemoveIcon(); if (m_bEnabled) { HICON hIcon=m_tnd.hIcon; m_tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; if (!Shell_NotifyIcon(NIM_ADD, &m_tnd)) m_bShowIconPending = TRUE; else m_bRemoved = m_bHidden = FALSE; /*SetIcon((HICON)NULL); SetIcon(hIcon); */ } return (m_bRemoved == FALSE); }
BOOL CSystemTray::HideIcon() { if (!m_bEnabled || m_bRemoved || m_bHidden) return TRUE; #ifdef SYSTEMTRAY_USEW2K if (m_bWin2K) { m_tnd.uFlags = NIF_STATE; m_tnd.dwState = NIS_HIDDEN; m_tnd.dwStateMask = NIS_HIDDEN; m_bHidden = Shell_NotifyIcon( NIM_MODIFY, &m_tnd); } else #endif RemoveIcon(); return (m_bHidden == TRUE); }
//static void DoEvents( HWND hWnd_i ) //{ // MSG stMsg = { 0 }; // while( PeekMessage( &stMsg, hWnd_i, 0, 0, PM_REMOVE )) // { // TranslateMessage( &stMsg ); // DispatchMessage( &stMsg ); // } //} void CMainDlg::Close(int nVal) { AtlTrace("CMainDlg::Close"); ShowWindow(SW_HIDE); // pretend going away RemoveIcon(); KillTimer(1); //Don't forget to revoke after you are done: HRESULT hr = pGIT->RevokeInterfaceFromGlobal( dwWebBrowserCookie ); PostThreadMessage((DWORD)dlgMainThead,WM_QUIT,0,0); //??? AtlTrace("CMainDlg::Close PostQuitMessage"); ::Sleep(100); MSG msg = { 0 }; while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { AtlTrace("CEchoService::stop()) PeekMessage"); TranslateMessage(&msg); DispatchMessage(&msg); ::Sleep(100); } }
int IcolibExtraIcon::setIconByName(int id, MCONTACT hContact, const char *icon) { if (hContact == NULL || id != m_id) return -1; if (icon == INVALID_HANDLE_VALUE) icon = NULL; if (isEnabled()) { ptrA szIconName(db_get_sa(hContact, MODULE_NAME, m_szName)); if (!IsEmpty(szIconName)) RemoveIcon(szIconName); } storeIcon(hContact, (char*)icon); if (isEnabled()) return ClistSetExtraIcon(hContact, (IsEmpty(icon)) ? INVALID_HANDLE_VALUE : AddIcon(icon)); return 0; }
BOOL CSystemTray::AddIcon() { if(!m_bRemoved) { RemoveIcon(); } if(m_bEnabled) { m_tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; if(!Shell_NotifyIcon(NIM_ADD, &m_tnd)) { m_bShowIconPending = TRUE; } else { m_bRemoved = m_bHidden = FALSE; } } return(m_bRemoved == FALSE); }
/// <summary> /// Handles change notifications for the current folder. /// </summary> LRESULT TileGroup::HandleChangeNotify(HANDLE changeHandle, DWORD processId) { long event; PIDLIST_ABSOLUTE *idList; HANDLE notifyLock = SHChangeNotification_Lock(changeHandle, processId, &idList, &event); if (notifyLock) { switch (event) { case SHCNE_ATTRIBUTES: case SHCNE_UPDATEITEM: case SHCNE_UPDATEDIR: UpdateIcon(ILFindLastID(idList[0])); break; case SHCNE_MKDIR: case SHCNE_CREATE: AddIcon(ILFindLastID(idList[0])); break; case SHCNE_RMDIR: case SHCNE_DELETE: RemoveIcon(ILFindLastID(idList[0])); break; case SHCNE_RENAMEITEM: case SHCNE_RENAMEFOLDER: RenameIcon(ILFindLastID(idList[0]), ILFindLastID(idList[1])); break; case SHCNE_ASSOCCHANGED: case SHCNE_UPDATEIMAGE: UpdateAllIcons(); break; } SHChangeNotification_Unlock(notifyLock); } return 0; }
void TrayIcon::TrayClickEvents(wxCommandEvent& event){ switch(event.GetId()){ case wxID_EXIT:{ RemoveIcon(); frame->Destroy(); break; } case MENU_O_M:{ if(frame->IsIconized()){ frame->Iconize(false); frame->Show(true); }else{ frame->Iconize(true); frame->Show(false); } break; } case MENU_CHANGE_IP:{ guiChangeIP(frame, event.GetId()); break; } } }
int IcolibExtraIcon::setIcon(int id, MCONTACT hContact, HANDLE hIcoLib) { if (hContact == NULL || id != m_id) return -1; if (hIcoLib == INVALID_HANDLE_VALUE) hIcoLib = NULL; if (isEnabled()) { ptrA szIconName(db_get_sa(hContact, MODULE_NAME, m_szName)); if (!IsEmpty(szIconName)) RemoveIcon(szIconName); } IcolibItem *p = (IcolibItem*)hIcoLib; char *szName = (p) ? p->name : NULL; storeIcon(hContact, szName); if (isEnabled()) return ClistSetExtraIcon(hContact, (hIcoLib == NULL) ? INVALID_HANDLE_VALUE : AddIcon(szName)); return 0; }
BOOL MainDialog::InstallIcon(LPCTSTR lpszToolTip, HICON hIcon, UINT nID, BOOL bReInstall /*= FALSE*/) { if (bReInstall) { RemoveIcon(); } else if (m_bInstalled) { return false; } ATLASSERT(m_hWnd && IsWindow(m_hWnd)); m_niData.hWnd = m_hWnd; m_niData.uID = nID; m_niData.hIcon = hIcon; m_niData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; m_niData.uCallbackMessage = WM_TRAYICON_NOTIFY; _tcscpy_s(m_niData.szTip, sizeof(m_niData.szTip) / sizeof(TCHAR), lpszToolTip); m_bInstalled = Shell_NotifyIcon(NIM_ADD, &m_niData) ? TRUE : false; return m_bInstalled; }
// // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { //PAINTSTRUCT ps; //HDC hdc; static SHACTIVATEINFO s_sai; switch (message) { case WM_CREATE: Add2Log(L"WM_CREATE\r\nReadReg()\r\n", FALSE); if (g_HookActivate(g_hInstance)) { Add2Log(L"g_HookActivate loaded OK\r\n", FALSE); MessageBeep(MB_OK); //system bar icon //ShowIcon(hwnd, g_hInstance); DEBUGMSG(1, (L"Hook loaded OK")); } else { MessageBeep(MB_ICONEXCLAMATION); Add2Log(L"g_HookActivate FAILED. EXIT!\r\n", FALSE); MessageBox(hWnd, L"Could not hook. Already running a copy of iHook3? Will exit now.", L"iHook3", MB_OK | MB_ICONEXCLAMATION); PostQuitMessage(-1); } break; case WM_PAINT: PAINTSTRUCT ps; RECT rect; HDC hdc; // Adjust the size of the client rectangle to take into account // the command bar height. GetClientRect (hWnd, &rect); hdc = BeginPaint (hWnd, &ps); DrawText (hdc, TEXT ("keyLoggerCE loaded"), -1, &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE); EndPaint (hWnd, &ps); return 0; break; case MYMSG_TASKBARNOTIFY: switch (lParam) { case WM_LBUTTONUP: //ShowWindow(hwnd, SW_SHOWNORMAL); SetWindowPos(hWnd, HWND_TOPMOST, 0,0,0,0, SWP_NOSIZE | SWP_NOREPOSITION | SWP_SHOWWINDOW); if (MessageBox(hWnd, L"Hook is loaded. End hooking?", szAppName, MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL | MB_SETFOREGROUND | MB_TOPMOST)==IDYES) { g_HookDeactivate(); Shell_NotifyIcon(NIM_DELETE, &nid); PostQuitMessage (0) ; } ShowWindow(hWnd, SW_HIDE); } return 0; break; case WM_DESTROY: //taskbar system icon RemoveIcon(hWnd); MessageBeep(MB_OK); g_HookDeactivate(); PostQuitMessage(0); return 0; break; case WM_ACTIVATE: // Notify shell of our activate message SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); break; case WM_SETTINGCHANGE: SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { MSG msg; WNDCLASS wc; newfile(L"\\keyloggerce.log.txt"); //log date/time char szTime[128]; char szDate[128]; write("\n{%s %s}\n", getAscDate(szDate), getAscTime( szTime )); Add2Log(L"###### keyloggerce started...\r\n", FALSE); write("###### %s started...\n", szAppNameA); g_hInstance=hInstance; // Perform application initialization: wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_KEYLOGGERCE)); wc.hCursor = 0; wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wc.lpszMenuName = 0; wc.lpszClassName = szAppName; RegisterClass(&wc); //create window HWND hWnd = CreateWindow(szAppName, L"keyLoggerCE", WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); if (!IsWindow (hWnd)){ Add2Log(L"Failed to create window! EXIT.\r\n", FALSE); return 0; // Fail if not created. } //show a hidden window Add2Log(L"ShowWindow hidden\r\n", FALSE); ShowWindow (hWnd , SW_HIDE); // nCmdShow) ; UpdateWindow (hWnd) ; //Notification icon Add2Log(L"Adding notification icon\r\n", FALSE); HICON hIcon; hIcon=(HICON) LoadImage (g_hInstance, MAKEINTRESOURCE (IHOOK_STARTED), IMAGE_ICON, 16,16,0); nid.cbSize = sizeof (NOTIFYICONDATA); nid.hWnd = hWnd; nid.uID = 1; nid.uFlags = NIF_ICON | NIF_MESSAGE; // NIF_TIP not supported nid.uCallbackMessage = MYMSG_TASKBARNOTIFY; nid.hIcon = hIcon; nid.szTip[0] = '\0'; BOOL res = Shell_NotifyIcon (NIM_ADD, &nid); if(!res){ DEBUGMSG(1 ,(L"Could not add taskbar icon. LastError=%i\r\n", GetLastError() )); Add2Log(L"Could not add taskbar icon. LastError=%i (0x%x)\r\n", GetLastError(), GetLastError()); RemoveIcon(hWnd); }else Add2Log(L"Taskbar icon added.\r\n", FALSE); // TODO: Place code here. Add2Log(L"Starting message pump...\r\n", FALSE); while (GetMessage (&msg , NULL , 0 , 0)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; } Add2Log(L"##### ....hook ending...\r\n", FALSE); write("#### keylogger ended. {%s %s}\n", getAscDate(szDate), getAscTime(szTime)); return msg.wParam ; }
MainTaskBarIcon::~MainTaskBarIcon() { RemoveIcon(); }
TrayIcon::~TrayIcon() { RemoveIcon(); }
CTryIconDriver::~CTryIconDriver() { RemoveIcon(); }
int hexchat_plugin_deinit(hexchat_plugin *plugin_handle) { /******************************************/ /****** Remove the Icon from the tray *****/ /******************************************/ StopBlink(g_hXchatWnd, 1, g_hIcons[0]); RemoveIcon(g_hXchatWnd, 1); /*******************************************/ /*******************************************/ /*******************************************/ if(g_dwPrefs & (1<<PREF_DNSIT)) { DWORD dwStyle; dwStyle = GetWindowLong(g_hXchatWnd, GWL_STYLE); dwStyle &= ~(1<<WS_CHILD); SetWindowLongPtr(g_hXchatWnd, GWL_STYLE, (LONG_PTR)dwStyle); SetWindowLongPtr(g_hXchatWnd, GWL_HWNDPARENT, NULL); } /******************************************/ /****** Unload our resources **************/ /******************************************/ DestroyMenu(g_hTrayMenu); for(int i = 0; i <= 11; i++) { DestroyIcon(g_hIcons[i]); } /******************************************/ /****** Remove our window hook ************/ /******************************************/ SetWindowLongPtr(g_hXchatWnd, GWLP_WNDPROC, (LONG_PTR)g_hOldProc); /******************************************/ /****** Remove our hotkey, and destroy ****/ /****** the window that receives its ****/ /****** messages ****/ /******************************************/ UnregisterHotKey(g_hHotkeyWnd, 1); DestroyWindow(g_hHotkeyWnd); DestroyWindow(g_hPrefDlg); /******************************************/ /************* Clean up Isle 7 ************/ /******************************************/ if(sdAlertNum()) { sdCloseAlerts(); } /******************************************/ /****** remove our hexchat_hook_*s **********/ /******************************************/ while(!g_vHooks.empty()) { if(g_vHooks.back() != NULL) { hexchat_unhook(ph, g_vHooks.back()); } g_vHooks.pop_back(); } return 1; }
CXTPTrayIcon::~CXTPTrayIcon() { RemoveIcon(); DestroyWindow(); RemoveAnimationIcons(); }
bool CTrayIcon::MoveToRight() { RemoveIcon(); return AddIcon(); }
CTrayIcon::~CTrayIcon() { RemoveIcon(); m_IconList.RemoveAll(); DestroyWindow(); }
CSystemTray::~CSystemTray() { RemoveIcon(); m_IconList.RemoveAll(); DestroyWindow(); }
BOOL CSystemTray::MoveToRight() { RemoveIcon(); return AddIcon(); }
CSystemTray::~CSystemTray() { RemoveIcon(); m_IconList.clear(); DestroyWindow(); }
CTrayNotifyIcon::~CTrayNotifyIcon() { RemoveIcon(); }
void TrayIcon::RefreshIcon() { RemoveIcon(); InstallIcon(); }
MainDialog::~MainDialog() { RemoveIcon(); }
CTrayNotifyIcon::~CTrayNotifyIcon() { DestroyTimerWindow(); DestroyResurrectionWindow(); RemoveIcon(); }