当前位置: 首页>>代码示例>>C++>>正文


C++ ComboBox_GetCurSel函数代码示例

本文整理汇总了C++中ComboBox_GetCurSel函数的典型用法代码示例。如果您正苦于以下问题:C++ ComboBox_GetCurSel函数的具体用法?C++ ComboBox_GetCurSel怎么用?C++ ComboBox_GetCurSel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ComboBox_GetCurSel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: File_OFNHookProc

UINT CALLBACK File_OFNHookProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    static LPINT lpnLineFeedType;

    switch (uMsg)
    {
    case WM_INITDIALOG:
    {
        OPENFILENAME *lpofn = (OPENFILENAME *)lParam;
        HWND hwndCbo = GetDlgItem(hwnd, IDC_COMBO_LINEFEED);
        int nSelectedIndex = 0;
        int i;
        struct tagLINEFEEDCOMBOITEM
        {
            TCHAR   szText[32];
            int     nType;
        } ts[4] =
        {
            { _T("Automatic"), CRLF_STYLE_AUTOMATIC },
            { _T("DOS"), CRLF_STYLE_DOS },
            { _T("UNiX"), CRLF_STYLE_UNIX },
            { _T("Mac"), CRLF_STYLE_MAC }
        };

        // Set a pointer to the passed on int)
        lpnLineFeedType = (int *)lpofn->lCustData;

        for (i = 0; i < DIMOF(ts); i++)
        {
            int nIndex = ComboBox_AddString(hwndCbo, ts[i].szText);
            if (nIndex != CB_ERR)
            {
                if (ts[i].nType == *lpnLineFeedType)
                    nSelectedIndex = nIndex;

                ComboBox_SetItemData(hwndCbo, nIndex, ts[i].nType);
            }
        }

        ComboBox_SetCurSel(hwndCbo, nSelectedIndex);
    }
    return (FALSE);
    case WM_NOTIFY:
    {
        LPNMHDR lpnmh = (LPNMHDR)lParam;

        switch (lpnmh->code)
        {
        case CDN_SHAREVIOLATION:
            SetWindowLong(hwnd, DWL_MSGRESULT, TRUE);
        return (TRUE);
        case CDN_FILEOK:
        {
            HWND hwndCbo = GetDlgItem(hwnd, IDC_COMBO_LINEFEED);
            int nIndex = ComboBox_GetCurSel(hwndCbo);

            if (nIndex != CB_ERR)
                *lpnLineFeedType = (int)ComboBox_GetItemData(hwndCbo, nIndex);
            else
                *lpnLineFeedType = CRLF_STYLE_AUTOMATIC;

            SetWindowLong(hwnd, DWL_MSGRESULT, TRUE);
        }
        return (TRUE);
        }
    }
    break;
    }

    return (FALSE);
}
开发者ID:now,项目名称:slackedit,代码行数:71,代码来源:file_actions.c

示例2: switch


//.........这里部分代码省略.........

			case ID_DEBUG_STEPOUT:
				if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepOut();
				break;

			case IDC_SHOWVFPU:
				vfpudlg->Show(true);
				break;

			case IDC_FUNCTIONLIST: 
				switch (HIWORD(wParam))
				{
				case CBN_DBLCLK:
					{
						HWND lb = GetDlgItem(m_hDlg,LOWORD(wParam));
						int n = ListBox_GetCurSel(lb);
						if (n!=-1)
						{
							unsigned int addr = (unsigned int)ListBox_GetItemData(lb,n);
							ptr->gotoAddr(addr);
							SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW));
						}
					}
					break;
				};
				break;

			case IDC_GOTOINT:
				switch (HIWORD(wParam))
				{
				case LBN_SELCHANGE:
					{
						HWND lb =GetDlgItem(m_hDlg,LOWORD(wParam));
						int n = ComboBox_GetCurSel(lb);
						unsigned int addr = (unsigned int)ComboBox_GetItemData(lb,n);
						if (addr != 0xFFFFFFFF)
						{
							ptr->gotoAddr(addr);
							SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW));
						}
					}
					break;
				};
				break;

			case IDC_STOPGO:
				{
					if (!Core_IsStepping())		// stop
					{
						ptr->setDontRedraw(false);
						SetDebugMode(true);
						Core_EnableStepping(true);
						_dbg_update_();
						Sleep(1); //let cpu catch up
						ptr->gotoPC();
						UpdateDialog();
						vfpudlg->Update();
					} else {					// go
						lastTicks = CoreTiming::GetTicks();

						// If the current PC is on a breakpoint, the user doesn't want to do nothing.
						CBreakPoints::SetSkipFirst(currentMIPS->pc);

						SetDebugMode(false);
						Core_EnableStepping(false);
					}
开发者ID:MoonSnidget,项目名称:ppsspp,代码行数:67,代码来源:Debugger_Disasm.cpp

示例3: UpdateDialogControls

//************************************************************************************
// UpdateDialogControls()
// Builds the list of devices and modes for the combo boxes in the device
// select dialog box.
//************************************************************************************
static VOID UpdateDialogControls(HWND hDlg, D3DEnum_DeviceInfo * pCurrentDevice,
                                 DWORD dwCurrentMode, BOOL bWindowed,
                                 BOOL bStereo)
{
	// Get access to the enumerated device list
	D3DEnum_DeviceInfo * pDeviceList;
	DWORD               dwNumDevices;
	D3DEnum_GetDevices(&pDeviceList, &dwNumDevices);

	// Access to UI controls
	HWND hwndDevice         = GetDlgItem(hDlg, IDC_DEVICE_COMBO);
	HWND hwndMode           = GetDlgItem(hDlg, IDC_MODE_COMBO);
	HWND hwndWindowed       = GetDlgItem(hDlg, IDC_WINDOWED_CHECKBOX);
	HWND hwndStereo         = GetDlgItem(hDlg, IDC_STEREO_CHECKBOX);
	HWND hwndFullscreenText = GetDlgItem(hDlg, IDC_FULLSCREEN_TEXT);

	// Reset the content in each of the combo boxes
	ComboBox_ResetContent(hwndDevice);
	ComboBox_ResetContent(hwndMode);

	// Don't let non-GDI devices be windowed
	if (FALSE == pCurrentDevice->bDesktopCompatible)
		bWindowed = FALSE;

	// Add a list of devices to the device combo box
	for (DWORD device = 0; device < dwNumDevices; device++)
	{
		D3DEnum_DeviceInfo * pDevice = &pDeviceList[device];

		// Add device name to the combo box
		DWORD dwItem = ComboBox_AddString(hwndDevice, pDevice->strDesc);

		// Set the remaining UI states for the current device
		if (pDevice == pCurrentDevice)
		{
			// Set the combobox selection on the current device
			ComboBox_SetCurSel(hwndDevice, dwItem);

			// Enable/set the fullscreen checkbox, as appropriate
			if (hwndWindowed)
			{
				EnableWindow(hwndWindowed, pDevice->bDesktopCompatible);
				Button_SetCheck(hwndWindowed, bWindowed);
			}

			// Enable/set the stereo checkbox, as appropriate
			if (hwndStereo)
			{
				EnableWindow(hwndStereo, pDevice->bStereoCompatible && !bWindowed);
				Button_SetCheck(hwndStereo, bStereo);
			}

			// Enable/set the fullscreen modes combo, as appropriate
			EnableWindow(hwndMode, !bWindowed);
			EnableWindow(hwndFullscreenText, !bWindowed);

			// Build the list of fullscreen modes
			for (DWORD mode = 0; mode < pDevice->dwNumModes; mode++)
			{
				DDSURFACEDESC2 * pddsdMode = &pDevice->pddsdModes[mode];

				// Skip non-stereo modes, if the device is in stereo mode
				if (0 == (pddsdMode->ddsCaps.dwCaps2 & DDSCAPS2_STEREOSURFACELEFT))
					if (bStereo)
						continue;

				TCHAR strMode[80];
				wsprintf(strMode, _T("%ld x %ld x %ld"),
				         pddsdMode->dwWidth, pddsdMode->dwHeight,
				         pddsdMode->ddpfPixelFormat.dwRGBBitCount);

				// Add mode desc to the combo box
				DWORD dwItem = ComboBox_AddString(hwndMode, strMode);

				// Set the item data to identify this mode
				ComboBox_SetItemData(hwndMode, dwItem, mode);

				// Set the combobox selection on the current mode
				if (mode == dwCurrentMode)
					ComboBox_SetCurSel(hwndMode, dwItem);

				// Since not all modes support stereo, select a default mode in
				// case none was chosen yet.
				if (bStereo && (CB_ERR == ComboBox_GetCurSel(hwndMode)))
					ComboBox_SetCurSel(hwndMode, dwItem);
			}
		}
	}
}
开发者ID:okready,项目名称:ArxFatalis,代码行数:94,代码来源:EERIEenum.cpp

示例4: InputPageDialogProc

INT_PTR CALLBACK InputPageDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
  // Mouse actions
  struct {
    int control;
    wchar_t *option;
  } mouse_buttons[] = {
    { IDC_LMB, L"LMB" },
    { IDC_MMB, L"MMB" },
    { IDC_RMB, L"RMB" },
    { IDC_MB4, L"MB4" },
    { IDC_MB5, L"MB5" },
  };
  struct action {
    wchar_t *action;
    wchar_t *l10n;
  };
  struct action mouse_actions[] = {
    { L"Move",        l10n->input_actions_move },
    { L"Resize",      l10n->input_actions_resize },
    { L"Close",       l10n->input_actions_close },
    { L"Minimize",    l10n->input_actions_minimize },
    { L"Lower",       l10n->input_actions_lower },
    { L"AlwaysOnTop", l10n->input_actions_alwaysontop },
    { L"Center",      l10n->input_actions_center },
    { L"Nothing",     l10n->input_actions_nothing },
  };

  // Scroll
  struct action scroll_actions[] = {
    { L"AltTab",       l10n->input_actions_alttab },
    { L"Volume",       l10n->input_actions_volume },
    { L"Transparency", l10n->input_actions_transparency },
    { L"Lower",        l10n->input_actions_lower },
    { L"Nothing",      l10n->input_actions_nothing },
  };

  // Hotkeys
  struct {
    int control;
    int vkey;
  } hotkeys[] = {
    { IDC_LEFTALT,     VK_LMENU },
    { IDC_RIGHTALT,    VK_RMENU },
    { IDC_LEFTWINKEY,  VK_LWIN },
    { IDC_RIGHTWINKEY, VK_RWIN },
    { IDC_LEFTCTRL,    VK_LCONTROL },
    { IDC_RIGHTCTRL,   VK_RCONTROL },
  };

  if (msg == WM_INITDIALOG) {
    wchar_t txt[50];
    int i;
    // Hotkeys
    unsigned int temp;
    int numread;
    GetPrivateProfileString(L"Input", L"Hotkeys", L"A4 A5", txt, ARRAY_SIZE(txt), inipath);
    wchar_t *pos = txt;
    while (*pos != '\0' && swscanf(pos,L"%02X%n",&temp,&numread) != EOF) {
      pos += numread;
      // What key was that?
      for (i=0; i < ARRAY_SIZE(hotkeys); i++) {
        if (temp == hotkeys[i].vkey) {
          Button_SetCheck(GetDlgItem(hwnd,hotkeys[i].control), BST_CHECKED);
          break;
        }
      }
    }
  }
  else if (msg == WM_COMMAND) {
    int id = LOWORD(wParam);
    int event = HIWORD(wParam);
    wchar_t txt[50] = L"";
    int i;
    if (event == CBN_SELCHANGE) {
      HWND control = GetDlgItem(hwnd, id);
      // Mouse actions
      for (i=0; i < ARRAY_SIZE(mouse_buttons); i++) {
        if (id == mouse_buttons[i].control) {
          int j = ComboBox_GetCurSel(control);
          WritePrivateProfileString(L"Input", mouse_buttons[i].option, mouse_actions[j].action, inipath);
          break;
        }
      }
      // Scroll
      if (id == IDC_SCROLL) {
        int j = ComboBox_GetCurSel(control);
        if (!vista && !wcscmp(scroll_actions[j].action,L"Volume")) {
          MessageBox(NULL, L"The Volume action only works on Vista and later. Sorry!", APP_NAME, MB_ICONINFORMATION|MB_OK|MB_TASKMODAL);
          GetPrivateProfileString(L"Input", L"Scroll", L"Nothing", txt, ARRAY_SIZE(txt), inipath);
          for (i=0; wcscmp(txt,scroll_actions[i].action) && i < ARRAY_SIZE(scroll_actions)-1; i++) {}
          ComboBox_SetCurSel(control, i);
        }
        else {
          WritePrivateProfileString(L"Input", L"Scroll", scroll_actions[j].action, inipath);
        }
      }
    }
    else if (LOWORD(wParam) == IDC_LOWERWITHMMB) {
      int val = Button_GetCheck(GetDlgItem(hwnd, IDC_LOWERWITHMMB));
      WritePrivateProfileString(L"Input", L"LowerWithMMB", _itow(val,txt,10), inipath);
//.........这里部分代码省略.........
开发者ID:alex310110,项目名称:altdrag,代码行数:101,代码来源:config.c

示例5: PhpOptionsGeneralDlgProc


//.........这里部分代码省略.........
                    SendMessage(GetDlgItem(hwndDlg, IDC_FONT), WM_SETFONT, (WPARAM)CurrentFontInstance, TRUE);
            }
        }
        break;
    case WM_DESTROY:
        {
            if (CurrentFontInstance)
                DeleteObject(CurrentFontInstance);

            PhClearReference(&NewFontSelection);
        }
        break;
    case WM_COMMAND:
        {
            switch (LOWORD(wParam))
            {
            case IDC_STARTATLOGON:
                {
                    EnableWindow(GetDlgItem(hwndDlg, IDC_STARTHIDDEN), Button_GetCheck(GetDlgItem(hwndDlg, IDC_STARTATLOGON)) == BST_CHECKED);
                }
                break;
            case IDC_FONT:
                {
                    LOGFONT font;
                    CHOOSEFONT chooseFont;

                    if (!GetCurrentFont(&font))
                    {
                        // Can't get LOGFONT from the existing setting, probably
                        // because the user hasn't ever chosen a font before.
                        // Set the font to something familiar.
                        GetObject((HFONT)SendMessage(PhMainWndHandle, WM_PH_GET_FONT, 0, 0), sizeof(LOGFONT), &font);
                    }

                    memset(&chooseFont, 0, sizeof(CHOOSEFONT));
                    chooseFont.lStructSize = sizeof(CHOOSEFONT);
                    chooseFont.hwndOwner = hwndDlg;
                    chooseFont.lpLogFont = &font;
                    chooseFont.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS;

                    if (ChooseFont(&chooseFont))
                    {
                        PhMoveReference(&NewFontSelection, PhBufferToHexString((PUCHAR)&font, sizeof(LOGFONT)));

                        // Update the button's font.

                        if (CurrentFontInstance)
                            DeleteObject(CurrentFontInstance);

                        CurrentFontInstance = CreateFontIndirect(&font);
                        SendMessage(GetDlgItem(hwndDlg, IDC_FONT), WM_SETFONT, (WPARAM)CurrentFontInstance, TRUE);
                    }
                }
                break;
            }
        }
        break;
    case WM_NOTIFY:
        {
            LPNMHDR header = (LPNMHDR)lParam;

            switch (header->code)
            {
            case PSN_APPLY:
                {
                    BOOLEAN startAtLogon;
                    BOOLEAN startHidden;

                    PhSetStringSetting2(L"SearchEngine", &(PhaGetDlgItemText(hwndDlg, IDC_SEARCHENGINE)->sr));
                    PhSetStringSetting2(L"ProgramInspectExecutables", &(PhaGetDlgItemText(hwndDlg, IDC_PEVIEWER)->sr));
                    PhSetIntegerSetting(L"MaxSizeUnit", PhMaxSizeUnit = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_MAXSIZEUNIT)));
                    PhSetIntegerSetting(L"IconProcesses", GetDlgItemInt(hwndDlg, IDC_ICONPROCESSES, NULL, FALSE));
                    SetSettingForDlgItemCheck(hwndDlg, IDC_ALLOWONLYONEINSTANCE, L"AllowOnlyOneInstance");
                    SetSettingForDlgItemCheck(hwndDlg, IDC_HIDEONCLOSE, L"HideOnClose");
                    SetSettingForDlgItemCheck(hwndDlg, IDC_HIDEONMINIMIZE, L"HideOnMinimize");
                    SetSettingForDlgItemCheck(hwndDlg, IDC_COLLAPSESERVICES, L"CollapseServicesOnStart");
                    SetSettingForDlgItemCheck(hwndDlg, IDC_ICONSINGLECLICK, L"IconSingleClick");
                    SetSettingForDlgItemCheck(hwndDlg, IDC_ICONTOGGLESVISIBILITY, L"IconTogglesVisibility");
                    SetSettingForDlgItemCheckRestartRequired(hwndDlg, IDC_ENABLEPLUGINS, L"EnablePlugins");

                    startAtLogon = Button_GetCheck(GetDlgItem(hwndDlg, IDC_STARTATLOGON)) == BST_CHECKED;
                    startHidden = Button_GetCheck(GetDlgItem(hwndDlg, IDC_STARTHIDDEN)) == BST_CHECKED;
                    WriteCurrentUserRun(startAtLogon, startHidden);

                    if (NewFontSelection)
                    {
                        PhSetStringSetting2(L"Font", &NewFontSelection->sr);
                        PostMessage(PhMainWndHandle, WM_PH_UPDATE_FONT, 0, 0);
                    }

                    SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
                }
                return TRUE;
            }
        }
        break;
    }

    return FALSE;
}
开发者ID:processhacker2,项目名称:processhacker2,代码行数:101,代码来源:options.c

示例6: PSPProcOrigin


//.........这里部分代码省略.........

				TranslateDialogDefault(hDlg);
				SetTimer(hDlg, 1, 5000, NULL);

				pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STREET, SET_CONTACT_ORIGIN_STREET, DBVT_TCHAR));
				pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_ZIP, SET_CONTACT_ORIGIN_ZIP, DBVT_TCHAR));
				pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_CITY, SET_CONTACT_ORIGIN_CITY, DBVT_TCHAR));
				pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STATE, SET_CONTACT_ORIGIN_STATE, DBVT_TCHAR));

				GetCountryList(&nList, &pList);
				pCtrlList->insert(CCombo::CreateObj(hDlg, EDIT_COUNTRY, SET_CONTACT_ORIGIN_COUNTRY, DBVT_WORD, pList, nList));

				pCtrlList->insert(CTzCombo::CreateObj(hDlg, EDIT_TIMEZONE, NULL));
			}
		}
		break;

	case WM_NOTIFY:
		{
			switch (((LPNMHDR) lParam)->idFrom) {
			case 0:
				{
					MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
					LPCSTR pszProto;
					
					switch (((LPNMHDR) lParam)->code) {
					case PSN_INFOCHANGED:
						{
							if (!PSGetBaseProto(hDlg, pszProto) || *pszProto == 0)
								break;

							if (hContact) {
								MTime mt;
								
								if (mt.DBGetStamp(hContact, USERINFO, SET_CONTACT_ADDEDTIME) && strstr(pszProto, "ICQ")) {
									DWORD dwStamp;
									
									dwStamp = DB::Contact::WhenAdded(db_get_dw(hContact, pszProto, "UIN", 0), pszProto);
									if (dwStamp > 0)
										mt.FromStampAsUTC(dwStamp);
								}
								if (mt.IsValid()) {
									TCHAR szTime[MAX_PATH];
									LPTSTR ptr;
									
									mt.UTCToLocal();
									mt.DateFormatLong(szTime, _countof(szTime));
									
									mir_tstrcat(szTime, _T(" - "));
									ptr = szTime + mir_tstrlen(szTime);
									mt.TimeFormat(ptr, _countof(szTime) - (ptr - szTime));
									SetDlgItemText(hDlg, TXT_DATEADDED, szTime);
								}
							}
						 
							SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 0);
						}
						break;
				
					case PSN_ICONCHANGED:
						{
							const ICONCTRL idIcon[] = {
								{ ICO_COMMON_ADDRESS, STM_SETIMAGE, ICO_ADDRESS },
								{ ICO_COMMON_CLOCK,   STM_SETIMAGE, ICO_CLOCK },
							};

							IcoLib_SetCtrlIcons(hDlg, idIcon, _countof(idIcon));
						}
					}
				}
			} /* switch (((LPNMHDR)lParam)->idFrom) */
		}
		break;

	case WM_COMMAND:
		{
			switch (LOWORD(wParam)) {
			case EDIT_COUNTRY:
				if (HIWORD(wParam) == CBN_SELCHANGE) {
					LPIDSTRLIST pd = (LPIDSTRLIST)ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam));
					UpDate_CountryIcon(GetDlgItem(hDlg, ICO_COUNTRY), pd->nID);
				}
				break;
			}
		}
		break;

	case WM_TIMER:
		{
			TCHAR szTime[32];
			CTzCombo::GetObj(hDlg, EDIT_TIMEZONE)->GetTime(szTime, _countof(szTime));
			SetDlgItemText(hDlg, TXT_TIME, szTime);
			break;
		}

	case WM_DESTROY:
		KillTimer(hDlg, 1);
	}
	return PSPBaseProc(hDlg, uMsg, wParam, lParam);
}
开发者ID:kmdtukl,项目名称:miranda-ng,代码行数:101,代码来源:psp_origin.cpp

示例7: SpectrumPopupProc


//.........这里部分代码省略.........
		return TRUE;
	case WM_ERASEBKGND:
		SetWindowLongPtr(wnd, DWLP_MSGRESULT, TRUE);
		return TRUE;
	case WM_PAINT:
		uih::HandleModernBackgroundPaint(wnd, GetDlgItem(wnd, IDOK));
		return TRUE;
	case WM_CTLCOLORSTATIC:
		{
			spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER));
			if (GetDlgItem(wnd, IDC_PATCH_FORE) == (HWND)lp) {
				HDC dc =(HDC)wp;
				if (!ptr->br_fore) 
				{
					ptr->br_fore = CreateSolidBrush(ptr->cr_fore);
				}
				return (BOOL)ptr->br_fore;
			} 
			else if (GetDlgItem(wnd, IDC_PATCH_BACK) == (HWND)lp) 
			{
				HDC dc =(HDC)wp;
				if (!ptr->br_back) 
				{
					ptr->br_back = CreateSolidBrush(ptr->cr_back);
				}
				return (BOOL)ptr->br_back;
			}
			else
			return (BOOL)GetSysColorBrush(COLOR_3DHIGHLIGHT);
		}
		break;
	case WM_COMMAND:
		switch(wp)
		{
		case IDCANCEL:
			EndDialog(wnd,0);
			return TRUE;
		case IDC_CHANGE_BACK:
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER));
				COLORREF COLOR = ptr->cr_back;
				COLORREF COLORS[16] = {get_default_colour(colours::COLOUR_BACK),GetSysColor(COLOR_3DFACE),0,0,0,0,0,0,0,0,0,0,0,0,0,0};
				if (uChooseColor(&COLOR, wnd, &COLORS[0]))
				{
					ptr->cr_back = COLOR;
					ptr->flush_back();
					RedrawWindow(GetDlgItem(wnd, IDC_PATCH_BACK), 0, 0, RDW_INVALIDATE|RDW_UPDATENOW);
				}
			}
			break;
		case IDC_CHANGE_FORE:
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER));
				COLORREF COLOR = ptr->cr_fore;
				COLORREF COLORS[16] = {get_default_colour(colours::COLOUR_TEXT),GetSysColor(COLOR_3DSHADOW),0,0,0,0,0,0,0,0,0,0,0,0,0,0};
				if (uChooseColor(&COLOR, wnd, &COLORS[0]))
				{
					ptr->cr_fore = COLOR;
					ptr->flush_fore();
					RedrawWindow(GetDlgItem(wnd, IDC_PATCH_FORE), 0, 0, RDW_INVALIDATE|RDW_UPDATENOW);
				}
			}
			break;
		case IDC_BARS:
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER));
				ptr->mode = (uSendMessage((HWND)lp, BM_GETCHECK, 0, 0) != TRUE ? MODE_STANDARD : MODE_BARS);
			}
			break;
		case IDC_FRAME_COMBO|(CBN_SELCHANGE<<16):
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER));
				ptr->frame = ComboBox_GetCurSel(HWND(lp));
			}
			break;
		case IDC_SCALE|(CBN_SELCHANGE<<16):
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER));
				ptr->m_scale = ComboBox_GetCurSel(HWND(lp));
			}
			break;
		case IDC_VERTICAL_SCALE|(CBN_SELCHANGE<<16):
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER));
				ptr->m_vertical_scale = ComboBox_GetCurSel(HWND(lp));
			}
			break;
		case IDOK:
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER));
				EndDialog(wnd,1);
			}
			return TRUE;
		default:
			return FALSE;
		}
	default:
		return FALSE;
	}
}
开发者ID:ttsping,项目名称:columns_ui,代码行数:101,代码来源:vis_spectrum.cpp

示例8: GetDlgItem

//-----------------------------------------------------------------------------
// Checks if a valid entry in the combo box is selected.
//-----------------------------------------------------------------------------
bool DeviceEnumeration::ComboBoxSomethingSelected( HWND dialog, int id )
{
	HWND control = GetDlgItem( dialog, id );
	int index = ComboBox_GetCurSel( control );
	return ( index >= 0 );
}
开发者ID:asutermo,项目名称:Wolf-Operatives,代码行数:9,代码来源:DeviceEnumeration.cpp

示例9: switch


//.........这里部分代码省略.........
					{
						if( (DWORD)MAKELONG( m_displayModes->GetCurrent()->mode.Width, m_displayModes->GetCurrent()->mode.Height ) == (DWORD)PtrToUlong( ComboBoxSelected( dialog, IDC_RESOLUTION ) ) )
						{
							sprintf( text, "%d Hz", m_displayModes->GetCurrent()->mode.RefreshRate );
							if (!ComboBoxContainsText( dialog, IDC_REFRESH_RATE, text ) )
								ComboBoxAdd( dialog, IDC_REFRESH_RATE, (void*)m_displayModes->GetCurrent()->mode.RefreshRate, text );
						}
					}
					ComboBoxSelect( dialog, IDC_REFRESH_RATE, *m_settingsScript->GetNumberData( "refresh" ) );
				}
			}

			return true;
		}

		case WM_COMMAND:
		{
			switch( LOWORD(wparam) )
			{
				case IDOK:
				{
					// Store the details of the selected display mode.
					m_selectedDisplayMode.Width = LOWORD( PtrToUlong( ComboBoxSelected( dialog, IDC_RESOLUTION ) ) );
					m_selectedDisplayMode.Height = HIWORD( PtrToUlong( ComboBoxSelected( dialog, IDC_RESOLUTION ) ) );
					m_selectedDisplayMode.RefreshRate = PtrToUlong( ComboBoxSelected( dialog, IDC_REFRESH_RATE ) );
					m_selectedDisplayMode.Format = (D3DFORMAT)PtrToUlong( ComboBoxSelected( dialog, IDC_DISPLAY_FORMAT ) );
					m_windowed = IsDlgButtonChecked( dialog, IDC_WINDOWED ) ? true : false;
					m_vsync = IsDlgButtonChecked( dialog, IDC_VSYNC ) ? true : false;

					// Destroy the display modes list.
					SAFE_DELETE( m_displayModes );

					// Get the selected index from each combo box.
					long bpp = ComboBox_GetCurSel( GetDlgItem( dialog, IDC_DISPLAY_FORMAT ) );
					long resolution = ComboBox_GetCurSel( GetDlgItem( dialog, IDC_RESOLUTION ) );
					long refresh = ComboBox_GetCurSel( GetDlgItem( dialog, IDC_REFRESH_RATE ) );

					// Check if the settings script has anything in it.
					if( m_settingsScript->GetBoolData( "windowed" ) == NULL )
					{
						// Add all the settings to the script.
						m_settingsScript->AddVariable( "windowed", VARIABLE_BOOL, &m_windowed );
						m_settingsScript->AddVariable( "vsync", VARIABLE_BOOL, &m_vsync );
						m_settingsScript->AddVariable( "bpp", VARIABLE_NUMBER, &bpp );
						m_settingsScript->AddVariable( "resolution", VARIABLE_NUMBER, &resolution );
						m_settingsScript->AddVariable( "refresh", VARIABLE_NUMBER, &refresh );
					}
					else
					{
						// Set all the settings.
						m_settingsScript->SetVariable( "windowed", &m_windowed );
						m_settingsScript->SetVariable( "vsync", &m_vsync );
						m_settingsScript->SetVariable( "bpp", &bpp );
						m_settingsScript->SetVariable( "resolution", &resolution );
						m_settingsScript->SetVariable( "refresh", &refresh );
					}

					// Save all the settings out to the settings script.
					m_settingsScript->SaveScript();

					// Destroy the settings script.
					SAFE_DELETE( m_settingsScript );

					// Close the dialog.
					EndDialog( dialog, IDOK );
开发者ID:asutermo,项目名称:Wolf-Operatives,代码行数:66,代码来源:DeviceEnumeration.cpp

示例10: AnchorDlgProc

BOOL CALLBACK
    AnchorDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam,
                  AnchorObject *th)
{
    TCHAR text[MAX_PATH];
    int c, camIndex, i, type;
    HWND cb;
    Tab<INode *> cameras;

    switch (message)
    {
    case WM_INITDIALOG:

        th->ParentPickButton = GetICustButton(GetDlgItem(hDlg,
                                                         IDC_PICK_PARENT));
        th->ParentPickButton->SetType(CBT_CHECK);
        th->ParentPickButton->SetButtonDownNotify(TRUE);
        th->ParentPickButton->SetHighlightColor(GREEN_WASH);
        th->ParentPickButton->SetCheck(FALSE);

        th->dlgPrevSel = -1;
        th->hRollup = hDlg;
        if (th->triggerObject)
            Static_SetText(GetDlgItem(hDlg, IDC_TRIGGER_OBJ),
                           th->triggerObject->GetName());
        th->pblock->GetValue(PB_AN_TYPE, th->iObjParams->GetTime(),
                             type, FOREVER);
        th->isJump = type == 0;
        EnableWindow(GetDlgItem(hDlg, IDC_ANCHOR_URL), th->isJump);
        EnableWindow(GetDlgItem(hDlg, IDC_PARAMETER), th->isJump);
        EnableWindow(GetDlgItem(hDlg, IDC_BOOKMARKS), th->isJump);
        EnableWindow(GetDlgItem(hDlg, IDC_CAMERA), !th->isJump);
        GetCameras(th->iObjParams->GetRootNode(), &cameras);
        c = cameras.Count();
        cb = GetDlgItem(hDlg, IDC_CAMERA);
        camIndex = -1;
        for (i = 0; i < c; i++)
        {
            // add the name to the list
            TSTR name = cameras[i]->GetName();
            int ind = ComboBox_AddString(cb, name.data());
            ComboBox_SetItemData(cb, ind, cameras[i]);
            if (cameras[i] == th->cameraObject)
                camIndex = i;
        }
        if (camIndex != -1)
            ComboBox_SelectString(cb, 0, cameras[camIndex]->GetName());

        Edit_SetText(GetDlgItem(hDlg, IDC_DESC), th->description.data());
        Edit_SetText(GetDlgItem(hDlg, IDC_ANCHOR_URL), th->URL.data());
        Edit_SetText(GetDlgItem(hDlg, IDC_PARAMETER), th->parameter.data());

        if (pickMode)
            SetPickMode(th);

        return TRUE;

    case WM_DESTROY:

        if (pickMode)
            SetPickMode(th);
        //th->iObjParams->ClearPickMode();
        //th->previousMode = NULL;
        ReleaseICustButton(th->ParentPickButton);
        return FALSE;

    case WM_MOUSEACTIVATE:
        return FALSE;

    case WM_LBUTTONDOWN:
    case WM_LBUTTONUP:
    case WM_MOUSEMOVE:
        return FALSE;

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDC_BOOKMARKS:
        {
            // do bookmarks
            TSTR url, cam, desc;
            if (GetBookmarkURL(th->iObjParams, &url, &cam, &desc))
            {
                // get the new URL information;
                Edit_SetText(GetDlgItem(hDlg, IDC_ANCHOR_URL), url.data());
                Edit_SetText(GetDlgItem(hDlg, IDC_DESC), desc.data());
            }
        }
        break;
        case IDC_CAMERA:
            if (HIWORD(wParam) == CBN_SELCHANGE)
            {
                cb = GetDlgItem(hDlg, IDC_CAMERA);
                int sel = ComboBox_GetCurSel(cb);
                INode *rtarg;
                rtarg = (INode *)ComboBox_GetItemData(cb, sel);
                th->ReplaceReference(2, rtarg);
            }
            break;
        case IDC_HYPERLINK:
//.........这里部分代码省略.........
开发者ID:nixz,项目名称:covise,代码行数:101,代码来源:anchor.cpp

示例11: Edit_GetText

void CConfigDialog::OnOK(void)
{
	char szTemp[2048];
	int nMaxChar = 2048;
	Edit_GetText(GetDlgItem(m_hWindow, ID_EDIT_LINUS), szTemp, nMaxChar);
	TestConfig::i().m_sLinusUrl = szTemp;
	Edit_GetText(GetDlgItem(m_hWindow, ID_EDIT_WSADDR), szTemp, nMaxChar);
	TestConfig::i().m_sWSUrl = szTemp;
	TestConfig::i().m_bCalliope = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_CALLIOPE));
	TestConfig::i().m_bLoopback = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_LOOPBACK));
	TestConfig::i().m_bEnableCVO = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_CVO));
	TestConfig::i().m_bAppshare = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_AS));
	TestConfig::i().m_bSharer = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_ISSHARER));
    TestConfig::i().m_bMultiStreamEnable = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_MULTI));
    TestConfig::i().m_bQoSEnable = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_QOS));
    TestConfig::i().m_audioParam["enableQos"] = TestConfig::i().m_bQoSEnable;
	TestConfig::i().m_videoParam["enableQos"] = TestConfig::i().m_bQoSEnable;
    bool enableFec = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_FEC));
    if (enableFec)
    {
        TestConfig::i().m_videoParam["fecParams"]["bEnableFec"] = true;
        TestConfig::i().m_videoParam["fecParams"]["uClockRate"] = 8000;
        TestConfig::i().m_videoParam["fecParams"]["uPayloadType"] = 111;
    }
    bool enableDtlsSrtp = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_DTLS_SRTP));
    if (enableDtlsSrtp) {
        TestConfig::i().m_bEnableDtlsSrtp = true;
    } else {
        TestConfig::i().m_bEnableDtlsSrtp = false;
    }
	TestConfig::i().m_bASPreview = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_ASPREVIEW));
	HWND hCheckFilterSelf = GetDlgItem(m_hWindow, ID_CHECK_FILTER_SELF);
	if ( hCheckFilterSelf )
		TestConfig::i().m_bShareFilterSelf = Button_GetCheck(hCheckFilterSelf);
	if (TestConfig::i().m_bAppshare){
		HWND hScreenSource = GetDlgItem(m_hWindow, IDC_COMBO_AS_SOURCE);
		int nIndex = ComboBox_GetCurSel(hScreenSource);
//		char szSelectSource[MAX_PATH] = { 0 };
		WCHAR szSelectSource[MAX_PATH] = { 0 };

		
//		ComboBox_GetLBText(hScreenSource, nIndex, szSelectSource);
		//TestConfig::i().m_strScreenSharingAutoLaunchSourceName = "DISPLAY";

		SendMessageW(hScreenSource, CB_GETLBTEXT, nIndex, (LPARAM)szSelectSource);

		char szUtf8SelectSource[MAX_PATH] = { 0 };
		WideCharToMultiByte(CP_UTF8, 0, szSelectSource, wcslen(szSelectSource), szUtf8SelectSource, MAX_PATH, NULL, NULL);
		std::string strSourceName = szUtf8SelectSource;
		strSourceName = strSourceName.substr(0, strSourceName.find(":"));
		TestConfig::i().m_strScreenSharingAutoLaunchSourceName = strSourceName.c_str();
		if (TestConfig::i().m_bCalliope){
			//			TestConfig::i().m_bFakeVideoByShare = false;
			TestConfig::i().m_bHasVideo = true;
		}
		TestConfig::i().m_bAutoStart = true;
	}
    if (!TestConfig::i().m_bLoopback)
	{
		TestConfig::i().m_bSharer = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_ISSHARER));
    }

	TestConfig::i().m_audioDebugOption["enableICE"] = !!Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_ICE));
	TestConfig::i().m_videoDebugOption["enableICE"] = !!Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_ICE));
	TestConfig::i().m_shareDebugOption["enableICE"] = !!Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_ICE));

	HWND hVideoSize = GetDlgItem(m_hWindow, ID_COMBO_VIDEOSIZE);
    HWND hActiveVideo = GetDlgItem(m_hWindow, ID_COMBO_ACTIVEVIDEO_COUNT);
    TestConfig::i().m_nVideoSize = ComboBox_GetItemData(hVideoSize, ComboBox_GetCurSel(hVideoSize));
    TestConfig::i().m_uMaxVideoStreams = ComboBox_GetItemData(hActiveVideo, ComboBox_GetCurSel(hActiveVideo));
    TestConfig::i().m_bNoSignal = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_NOSIGNAL));;
    Edit_GetText(GetDlgItem(m_hWindow, ID_EDIT_VENUEURL), szTemp, nMaxChar);
    TestConfig::i().m_sVenuUrl = szTemp;

	EndDialog(m_hWindow, IDOK);
}
开发者ID:zzchu,项目名称:wme-ref-app,代码行数:76,代码来源:ConfigDialog.cpp

示例12: GetDlgItem

//-----------------------------------------------------------------------------
// Name: ComboBoxSomethingSelected
// Desc: Returns whether any entry in the combo box is selected.  This is 
//       more useful than ComboBoxSelected() when you need to distinguish 
//       between having no item selected vs. having an item selected whose 
//       itemData is NULL.
//-----------------------------------------------------------------------------
bool CD3DSettingsDialog::ComboBoxSomethingSelected( int id )
{
    HWND hwndCtrl = GetDlgItem( m_hDlg, id );
    int index = ComboBox_GetCurSel( hwndCtrl );
    return ( index >= 0 );
}
开发者ID:xahgo,项目名称:tama,代码行数:13,代码来源:d3dsettings.cpp

示例13: SortMailFrom_OnCommand

/* This function handles the WM_COMMAND message.
 */ 
void FASTCALL SortMailFrom_OnCommand( HWND hwnd, int id, HWND hwndCtl, UINT codeNotify )
{
   switch( id )
      {
      case IDD_EXISTING:
         EnableControl( hwnd, IDD_LIST, TRUE );
         EnableControl( hwnd, IDD_PAD2, FALSE );
         EnableControl( hwnd, IDD_EDIT, FALSE );
         break;

      case IDD_NEW:
         EnableControl( hwnd, IDD_LIST, FALSE );
         EnableControl( hwnd, IDD_PAD2, TRUE );
         EnableControl( hwnd, IDD_EDIT, TRUE );
         SetFocus( GetDlgItem( hwnd, IDD_EDIT ) );
         break;

      case IDOK:
         /* Get the destination folder.
          */
         if( IsDlgButtonChecked( hwnd, IDD_EXISTING ) )
            {
            HWND hwndList;
            int index;

            VERIFY( hwndList = GetDlgItem( hwnd, IDD_LIST ) );
            index = ComboBox_GetCurSel( hwndList );
            ASSERT( CB_ERR != index );
            ptlDest = (PTL)ComboBox_GetItemData( hwndList, index );
            ASSERT( NULL != ptlDest );
            }
         else
            {
            char szMailBox[ LEN_MAILBOX ];
            PCL pcl;

            /* Get the destination folder name.
             */
            GetDlgItemText( hwnd, IDD_EDIT, szMailBox, sizeof( szMailBox ) );
            StripLeadingTrailingSpaces( szMailBox );
            if( !IsValidFolderName( hwnd, szMailBox ) )
               break;
            if( strchr( szMailBox, ' ' ) != NULL )
            {
               wsprintf( lpTmpBuf, GS(IDS_STR1154), ' ' );
               fMessageBox( hwnd, 0, lpTmpBuf, MB_OK|MB_ICONINFORMATION );
               break;
            }
            if( NULL == ( pcl = Amdb_OpenFolder( NULL, "Mail" ) ) )
               pcl = Amdb_CreateFolder( Amdb_GetFirstCategory(), "Mail", CFF_SORT );
            ptlDest = NULL;
            if( pcl )
               {
               if( Amdb_OpenTopic( pcl, szMailBox ) )
                  {
                  fMessageBox( hwnd, 0, GS(IDS_STR832), MB_OK|MB_ICONEXCLAMATION );
                  break;
                  }
               ptlDest = Amdb_CreateTopic( pcl, szMailBox, FTYPE_MAIL );
               Amdb_CommitDatabase( FALSE );
               }

            /* Error if we couldn't create the folder (out of memory?)
             */
            if( NULL == ptlDest )
               {
               wsprintf( lpTmpBuf, GS(IDS_STR845), szMailBox );
               fMessageBox( hwndFrame, 0, lpTmpBuf, MB_OK|MB_ICONINFORMATION );
               break;
               }
            }

         /* Get the address, reject if there isn't one.
          */

         Edit_GetText( GetDlgItem( hwnd, IDD_NAME ), szRuleAuthor, LEN_INTERNETNAME+1 );
         if( strlen( szRuleAuthor ) == 0 )
         {
            fMessageBox( hwnd, 0, GS(IDS_STR783), MB_OK|MB_ICONINFORMATION );
            HighlightField( hwnd, IDD_NAME);
            break;
         }

         /* Set a flag if all messages are moved to the
          * destination folder.
          */
         fMoveExisting = IsDlgButtonChecked( hwnd, IDD_FILEALL );
         EndDialog( hwnd, TRUE );
         break;

      case IDCANCEL:
         EndDialog( hwnd, FALSE );
         break;
      }
}
开发者ID:cixonline,项目名称:ameol,代码行数:97,代码来源:sortfrom.c

示例14: GeneralSettingsDlgProc

INT_PTR CALLBACK
GeneralSettingsDlgProc(HWND hwndDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lParam)
{
    LPPSHNOTIFY psn;
    langProcData langData = {
        .languages = GetDlgItem(hwndDlg, ID_CMB_LANGUAGE),
        .language = GetGUILanguage()
    };

    switch(msg) {

    case WM_INITDIALOG:
        /* Populate UI language selection combo box */
        EnumResourceLanguages( NULL, RT_STRING, MAKEINTRESOURCE(IDS_LANGUAGE_NAME / 16 + 1),
            (ENUMRESLANGPROC) FillLangListProc, (LONG_PTR) &langData );

        /* If none of the available languages matched, select the fallback */
        if (ComboBox_GetCurSel(langData.languages) == CB_ERR)
            ComboBox_SelectString(langData.languages, -1,
                LangListEntry(IDS_LANGUAGE_NAME, fallbackLangId));

        /* Clear language id data for the selected item */
        ComboBox_SetItemData(langData.languages, ComboBox_GetCurSel(langData.languages), 0);

        if (GetLaunchOnStartup())
            Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_STARTUP), BST_CHECKED);

        if (o.log_append)
            Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_LOG_APPEND), BST_CHECKED);
        if (o.silent_connection)
            Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_SILENT), BST_CHECKED);
        if (o.show_balloon == 0)
            CheckRadioButton (hwndDlg, ID_RB_BALLOON0, ID_RB_BALLOON2, ID_RB_BALLOON0);
        else if (o.show_balloon == 1)
            CheckRadioButton (hwndDlg, ID_RB_BALLOON0, ID_RB_BALLOON2, ID_RB_BALLOON1);
        else if (o.show_balloon == 2)
            CheckRadioButton (hwndDlg, ID_RB_BALLOON0, ID_RB_BALLOON2, ID_RB_BALLOON2);
        if (o.show_script_window)
            Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_SHOW_SCRIPT_WIN), BST_CHECKED);

        break;

    case WM_NOTIFY:
        psn = (LPPSHNOTIFY) lParam;
        if (psn->hdr.code == (UINT) PSN_APPLY)
        {
            LANGID langId = (LANGID) ComboBox_GetItemData(langData.languages,
                ComboBox_GetCurSel(langData.languages));

            if (langId != 0)
                SetGUILanguage(langId);

            SetLaunchOnStartup(Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_STARTUP)) == BST_CHECKED);

            o.log_append =
                (Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_LOG_APPEND)) == BST_CHECKED);
            o.silent_connection =
                (Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_SILENT)) == BST_CHECKED);
            if (IsDlgButtonChecked(hwndDlg, ID_RB_BALLOON0))
                o.show_balloon = 0;
            else if (IsDlgButtonChecked(hwndDlg, ID_RB_BALLOON2))
                o.show_balloon = 2;
            else
                o.show_balloon = 1;
            o.show_script_window =
                (Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_SHOW_SCRIPT_WIN)) == BST_CHECKED);

            SaveRegistryKeys();

            SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
            return TRUE;
        }
        break;
    }

    return FALSE;
}
开发者ID:mattock,项目名称:openvpn-gui,代码行数:77,代码来源:localization.c

示例15: switch

INT_PTR CALLBACK DialogPackage::SelectFolderDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg)
	{
	case WM_INITDIALOG:
		{
			EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB);
			c_Dialog->SetDialogFont(hWnd);

			std::wstring* existingPath = (std::wstring*)lParam;
			SetWindowLongPtr(hWnd, GWLP_USERDATA, lParam);

			*existingPath += L'*';
			WIN32_FIND_DATA fd;
			HANDLE hFind = FindFirstFileEx(existingPath->c_str(), FindExInfoBasic, &fd, FindExSearchNameMatch, nullptr, 0);
			existingPath->pop_back();

			if (hFind != INVALID_HANDLE_VALUE)
			{
				const WCHAR* folder = PathFindFileName(existingPath->c_str());

				HWND item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_EXISTING_RADIO);
				std::wstring text = L"Add folder from ";
				text.append(folder, wcslen(folder) - 1);
				text += L':';
				SetWindowText(item, text.c_str());
				Button_SetCheck(item, BST_CHECKED);

				item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_EXISTING_COMBO);

				do
				{
					if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY &&
						!(fd.cFileName[0] == L'.' && (!fd.cFileName[1] || fd.cFileName[1] == L'.' && !fd.cFileName[2])) &&
						wcscmp(fd.cFileName, L"Backup") != 0 &&
						wcscmp(fd.cFileName, L"@Backup") != 0 &&
						wcscmp(fd.cFileName, L"@Vault") != 0)
					{
						ComboBox_InsertString(item, -1, fd.cFileName);
					}
				}
				while (FindNextFile(hFind, &fd));

				ComboBox_SetCurSel(item, 0);

				FindClose(hFind);
			}
		}
		break;

	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDC_PACKAGESELECTFOLDER_EXISTING_RADIO:
			{
				HWND item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_EXISTING_COMBO);
				EnableWindow(item, TRUE);
				int sel = ComboBox_GetCurSel(item);
				item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_CUSTOM_EDIT);
				EnableWindow(item, FALSE);
				item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_CUSTOMBROWSE_BUTTON);
				EnableWindow(item, FALSE);

				item = GetDlgItem(hWnd, IDOK);
				EnableWindow(item, sel != -1);
			}
			break;

		case IDC_PACKAGESELECTFOLDER_CUSTOM_RADIO:
			{
				HWND item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_EXISTING_COMBO);
				EnableWindow(item, FALSE);
				item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_CUSTOM_EDIT);
				EnableWindow(item, TRUE);
				item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_CUSTOMBROWSE_BUTTON);
				EnableWindow(item, TRUE);

				SendMessage(hWnd, WM_COMMAND, MAKEWPARAM(IDC_PACKAGESELECTFOLDER_CUSTOM_EDIT, EN_CHANGE), 0);
			}
			break;

		case IDC_PACKAGESELECTFOLDER_CUSTOM_EDIT:
			if (HIWORD(wParam) == EN_CHANGE)
			{
				WCHAR buffer[MAX_PATH];
				int len = Edit_GetText((HWND)lParam, buffer, MAX_PATH);

				// Disable Add button if invalid directory
				DWORD attributes = GetFileAttributes(buffer);
				BOOL state = (attributes != INVALID_FILE_ATTRIBUTES &&
					attributes & FILE_ATTRIBUTE_DIRECTORY);
				EnableWindow(GetDlgItem(hWnd, IDOK), state);
			}
			break;

		case IDC_PACKAGESELECTFOLDER_CUSTOMBROWSE_BUTTON:
			{
				WCHAR buffer[MAX_PATH];
				BROWSEINFO bi = {0};
				bi.hwndOwner = hWnd;
//.........这里部分代码省略.........
开发者ID:rainmeter,项目名称:rainmeter,代码行数:101,代码来源:DialogPackage.cpp


注:本文中的ComboBox_GetCurSel函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。