Пример #1
0
INT_PTR CALLBACK MainDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg) {
	case WM_INITDIALOG:
	    MainInitDialog(hWnd);
	    break;

	case WM_DROPFILES:
	    MainDropFiles(hWnd, (HDROP) wParam);
	    break;

	case WM_APP:
	    FireCommand(CommandDelayBuffer);
	    break;

	case WM_COMMAND:
	    MainCommand(hWnd, LOWORD(wParam));
	    break;

	case WM_NOTIFY:
	    return MainNotify(hWnd, (LPNMHDR) lParam);
	    break;

	case WM_SIZE:
	    MainSize(hWnd, LOWORD(lParam), HIWORD(lParam));
	    break;

	case WM_MENUSELECT:
	    MainMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam));
	    break;

	case WM_TIMER:
	    RtfWindowTimer();;
	    break;

	case WM_CONTEXTMENU:
	    {
		HWND hParam = (HWND) wParam;
		HWND hRtfChild = GetDlgItem(hWnd, ID_RTF);
		if (hParam == hWnd || hParam == hRtfChild)
		    ShowContextMenu(LOWORD(lParam), HIWORD(lParam));
	    }
	    break;

	case WM_HELP:
	    MainCommand(hWnd, ID_HELPCONTENTS);
	    break;

	case WM_CLOSE:
	    RegistryWriteWindowPos(hWnd);
	    if (Running)
		AbortExecution();
	    PostQuitMessage(0);
	    break;
    }

    return FALSE;
}
Пример #2
0
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg) {

		case WM_NOTIFY:		
			return MainNotify(hWnd, (LPNMHDR) lParam);
			break;

		case WM_CREATE:
			MainCreate(hWnd);
			break;

		case WM_DROPFILES:
			MainDropFiles(hWnd, (HDROP) wParam);
			break;

		case WM_COMMAND: 
			MainCommand(hWnd, LOWORD(wParam));		
			break;

		case WM_SIZE:
			MainSize(hWnd, LOWORD(lParam), HIWORD(lParam));
			break;

		case WM_MENUSELECT:
			MainMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam));
			break;

		case WM_SETFOCUS:
			SetFocus(hWndRtf);
			break;

		case WM_CONTEXTMENU: {
				HWND hParam = (HWND) wParam;
				HWND hRtfChild = GetDlgItem(hWnd, IDC_Rtf);
				if (hParam == hWnd || hParam == hRtfChild)
					ShowContextMenu(LOWORD(lParam), HIWORD(lParam));
			}
			break;

		case WM_HELP:		
			MainCommand(hWnd, ID_HELPCONTENTS);
			break;

		case WM_CLOSE:
			FinalizeWinGHCi();

			if (Running)
				AbortExecution();

			FireAsyncCommand(TEXT(":quit"));

			// should not be necessary
			SetEvent(hKillGHCi);

			PostQuitMessage(0);
			break;
		default: return DefWindowProc(hWnd, uMsg, wParam, lParam);
	}

	return 0;
}