Exemplo n.º 1
0
LRESULT CALLBACK Country_Code_Window_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch(message)
    {
    case WM_CREATE:
        Country_Code_Window_CreateChildWindows(hWnd);
        break;

    case WM_CLOSE:
        DestroyWindow(country_code_window);
        return 0;

    case WM_MENUSELECT:
    case WM_ENTERSIZEMOVE:
    case WM_NCLBUTTONDOWN:
    case WM_NCRBUTTONDOWN:
        // Prevent audio stuttering when one of the following events occurs:
        // - Menu is opened.
        // - Window is resized.
        // - Left/Right mouse button down on title bar.
        Win32_ClearSoundBuffer();
        break;

    case WM_COMMAND:
        // Button press, or Enter pressed in textbox
        switch (LOWORD(wParam))
        {
        case IDOK: // Standard dialog button ID
        case IDC_BTN_OK:
        case IDC_BTN_SAVE:
            Country_Save();
            DestroyWindow(hWnd);
            break;

        case IDC_BTN_APPLY:
            Country_Save();
            break;

        case IDCANCEL: // Standard dialog button ID
        case IDC_BTN_CANCEL:
            DestroyWindow(hWnd);
            break;

        case IDC_COUNTRY_CODE_UP:
            Country_MoveUp();
            break;

        case IDC_COUNTRY_CODE_DOWN:
            Country_MoveDown();
            break;
        }
        break;

    case WM_DESTROY:
        if (hWnd != country_code_window)
            break;

        country_code_window = NULL;

        if (cc_imglArrowUp)
        {
            // Arrow Up image list was created. Delete it.
            ImageList_Destroy(cc_imglArrowUp);
            cc_imglArrowUp = NULL;
        }

        if (cc_imglArrowDown)
        {
            // Arrow Down image list was created. Delete it.
            ImageList_Destroy(cc_imglArrowDown);
            cc_imglArrowDown = NULL;
        }

        break;
    }

    return DefWindowProc(hWnd, message, wParam, lParam);
}
LRESULT CALLBACK Select_CDROM_Window_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch(message)
	{
		case WM_CREATE:
			Select_CDROM_Window_CreateChildWindows(hWnd);
			break;
		
		case WM_CLOSE:
			DestroyWindow(select_cdrom_window);
			return 0;
		
		case WM_MENUSELECT:
		case WM_ENTERSIZEMOVE:
		case WM_NCLBUTTONDOWN:
		case WM_NCRBUTTONDOWN:
			// Prevent audio stuttering when one of the following events occurs:
			// - Menu is opened.
			// - Window is resized.
			// - Left/Right mouse button down on title bar.
			Win32_ClearSoundBuffer();
			break;
		
		case WM_COMMAND:
			// Button press, or Enter pressed in textbox
			switch (LOWORD(wParam))
			{
				case IDOK: // Standard dialog button ID
				case IDC_BTN_OK:
				case IDC_BTN_SAVE:
					if (!IsWindowEnabled(SelCD_btnOK))
						break;
					
					SelCD_Save();
					DestroyWindow(hWnd);
					break;
				
				case IDC_BTN_APPLY:
					if (!IsWindowEnabled(SelCD_btnApply))
						break;
					
					SelCD_Save();
					break;
				
					case IDCANCEL: // Standard dialog button ID
				case IDC_BTN_CANCEL:
					DestroyWindow(hWnd);
					break;
			}
			break;
		
		case WM_DESTROY:
			if (hWnd != select_cdrom_window)
				break;
			
			select_cdrom_window = NULL;
			break;
	}
	
	return DefWindowProc(hWnd, message, wParam, lParam);
}
LRESULT CALLBACK Color_Adjust_Window_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char buf[16];
	int scrlPos;
	
	switch(message)
	{
		case WM_CREATE:
			Color_Adjust_Window_CreateChildWindows(hWnd);
			break;
		
		case WM_CLOSE:
			DestroyWindow(color_adjust_window);
			return 0;
		
		case WM_MENUSELECT:
		case WM_ENTERSIZEMOVE:
		case WM_NCLBUTTONDOWN:
		case WM_NCRBUTTONDOWN:
			// Prevent audio stuttering when one of the following events occurs:
			// - Menu is opened.
			// - Window is resized.
			// - Left/Right mouse button down on title bar.
			Win32_ClearSoundBuffer();
			break;
		
		case WM_COMMAND:
			// Button press
			switch (LOWORD(wParam))
			{
				case IDOK: // Standard dialog button ID
				case IDC_BTN_OK:
				case IDC_BTN_SAVE:
					CA_Save();
					DestroyWindow(hWnd);
					break;
				
				case IDC_BTN_APPLY:
					CA_Save();
					break;
				
				case IDCANCEL: // Standard dialog button ID
				case IDC_BTN_CANCEL:
					DestroyWindow(hWnd);
					break;
			}
			break;
		
		case WM_HSCROLL:
			// Trackbar scroll
			switch (LOWORD(wParam))
			{
				case TB_THUMBPOSITION:
				case TB_THUMBTRACK:
					// Scroll position is in the high word of wParam.
					scrlPos = (signed short)HIWORD(wParam);
					break;
				
				default:
					// Send TBM_GETPOS to the trackbar to get the position.
					scrlPos = SendMessage((HWND)lParam, TBM_GETPOS, 0, 0);
					break;
			}
			
			// Convert the scroll position to a string.
			sprintf(buf, "%d", scrlPos);
			
			// Set the value label.
			if ((HWND)lParam == ca_trkContrast)
				SetWindowText(ca_lblContrastVal, buf);
			else if ((HWND)lParam == ca_trkBrightness)
				SetWindowText(ca_lblBrightnessVal, buf);
			
			break;
		
		case WM_DESTROY:
			if (hWnd != color_adjust_window)
				break;
			
			color_adjust_window = NULL;
			break;
	}
	
	return DefWindowProc(hWnd, message, wParam, lParam);
}