Пример #1
0
CTrayIcon::~CTrayIcon()
{
    if (m_bTrayIconExists)
        DestroyTrayIcon();

    delete m_pNID;
}
Пример #2
0
COggSplitter::~COggSplitter()
{
	if (m_bShowTrayIcon)
		DestroyTrayIcon();
	delete m_pInput;
	if (m_pChapterInfo)
		delete m_pChapterInfo;
}
Пример #3
0
LRESULT AutoIt_App::WndProcHandler (HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
	static UINT s_uTaskbarRestart;				// Holds taskbar recreate message

	// What window is the message for? (note, g_hWnd may be NULL during startup WM_CREATE)
	if (hWnd == g_hWnd || g_hWnd == NULL)
	{
		//
		// Main window messages
		//

		switch (iMsg)
		{
			// Window initial creation
			case WM_CREATE:
				AUT_DEBUGMSG("==> AutoIt_App::WndProc, g_hWnd: WM_CREATE\n")

				// Start the main timer used for flashing the "pause" icon
				SetTimer(hWnd, AUT_MAIN_TIMER_ID, AUT_MAIN_TIMER_DELAY, NULL);

				// Register a message so we know if explorer crashes and we have to redraw taskbar
				s_uTaskbarRestart = RegisterWindowMessage("TaskbarCreated");

				return 0;

			// Some form of timer has been triggered - check it out
			case WM_TIMER:
				HandleTimer(hWnd, wParam, lParam);

				return 0;

			// Menu command received
			case WM_COMMAND:
				if (HandleCommand(hWnd, iMsg, wParam, lParam) == true)
					 return 0;                              // completely handled
				break;

			// Window close clicked, if this returns 0 then user will be prevented from closing
			case WM_CLOSE:
				AUT_DEBUGMSG("==> AutoIt_App::WndProc, g_hWnd: WM_CLOSE\n")

				// Notify the script that close was requested but DON'T allow the system to continue
				// with the defaut WM_CLOSE - we will call DestroyWindow() ourselves from the script
				g_bTrayExitClicked = true;
				g_bKillWorkerThreads = true;			// Ask worker threads to stop (otherwise the script
														// may be blocked - e.g InetGet on a big download)
				//break;
				return 0;

				// Window is being destroyed
			case WM_DESTROY:
				AUT_DEBUGMSG("==> AutoIt_App::WndProc, g_hWnd: WM_DESTROY\n")

				KillTimer(hWnd, AUT_MAIN_TIMER_ID);		// Remove any timers in use
				DestroyTrayIcon();						// Remove tray icon if present
				PostQuitMessage(0);						// Tell the message loop to stop
				return 0;

			// Window is getting focus
			case WM_SETFOCUS:
				SetFocus(g_hWndEdit);                         // Put focus on the main edit window
				return 0;

			// Window has been resized in some way
			case WM_SIZE:
				MoveWindow(g_hWndEdit, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
				return 0;

			// Popup menu accessed
			case AUT_WM_NOTIFYICON:
				NotifyIcon(hWnd, iMsg, wParam, lParam);
				return 0;

			case WM_HOTKEY:                                        // Ignore when paused
				if (!g_bScriptPaused)
				{
					 g_HotKeyQueue[g_HotKeyNext++] = wParam;     // Store the hotkey ID pressed
					 if (g_HotKeyNext >= AUT_HOTKEYQUEUESIZE)
						  g_HotKeyNext = 0;
				}

				//MessageBox(NULL, "", "Hotkey pressed", MB_OK);
				break;

			default:
				// If the icon was visible and explorer crashed then redraw
				if(iMsg == s_uTaskbarRestart && g_bTrayIcon == true)
				{
					AUT_DEBUGMSG("==> AutoIt_App::WndProc, g_hWnd: TaskbarRestart received - redrawing trayicon\n")
					DestroyTrayIcon();
					CreateTrayIcon();
				}
				break;

		} // end main switch

	}

	// If not handled, return the default
	return DefWindowProc(hWnd, iMsg, wParam, lParam);

} // WndProcHandler()