예제 #1
0
BOOL COptionsWnd::GeneralSheetDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg)
	{
	case WM_INITDIALOG:
		{
			m_hGeneralSheet = hwnd;
			GeneralOnInit();

			return TRUE;
		}
		break;

	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDC_CHOOSE_SOUND:
			GeneralOnChooseSound();
			break;

		case IDC_PlAY_SOUND:
			GeneralOnPlayFile();
			break;

		case IDC_STOP_SOUND:
			GeneralOnStopFile();
			break;
		}
		break;

		case WM_NOTIFY:
			switch (((NMHDR*) lParam)->code)
			{
			case PSN_KILLACTIVE:
				{
					SetWindowLong(hwnd, DWL_MSGRESULT, FALSE);
				}

				return TRUE;
				break;

			case PSN_APPLY:
				GeneralOnExit();
				SetWindowLong(m_hGeneralSheet, DWL_MSGRESULT, FALSE);
				break;
			}
			break;
	}

	return FALSE;
}
예제 #2
0
INT_PTR CALLBACK
GeneralDlgProc(HWND hDlg,
               UINT message,
               WPARAM wParam,
               LPARAM lParam)
{
    PINFO pInfo = (PINFO)GetWindowLongPtrW(hDlg,
                                           GWLP_USERDATA);

    switch (message)
    {
        case WM_INITDIALOG:
            GeneralOnInit(hDlg, (PINFO)lParam);
            return TRUE;

        case WM_COMMAND:
        {
            switch(LOWORD(wParam))
            {
                case IDC_SERVERCOMBO:
                    if (HIWORD(wParam) == CBN_SELCHANGE)
                    {
                        INT last, cur;

                        cur = SendDlgItemMessageW(hDlg,
                                                  IDC_SERVERCOMBO,
                                                  CB_GETCURSEL,
                                                  0,
                                                  0);

                        last = SendDlgItemMessageW(hDlg,
                                                   IDC_SERVERCOMBO,
                                                   CB_GETCOUNT,
                                                   0,
                                                   0);
                        if ((cur + 1) == last)
                            MessageBoxW(hDlg, L"SMB is not yet supported", L"RDP error", MB_ICONERROR);
                        else
                        {
                            LoadUsernameHint(hDlg, cur);
                        }
                    }
                    break;

                case IDC_SAVE:
                    SaveAllSettings(pInfo);
                    SaveRdpSettingsToFile(NULL, pInfo->pRdpSettings);
                break;

                case IDC_SAVEAS:
                    DoSaveAs(pInfo);
                break;

                case IDC_OPEN:
                    DoOpenFile(pInfo);
                break;
            }

            break;
        }

        case WM_CLOSE:
        {
            if (pInfo->hLogon)
                DestroyIcon(pInfo->hLogon);

            if (pInfo->hConn)
                DestroyIcon(pInfo->hConn);

            break;
        }
    }

    return 0;
}