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


C++ GetDlgItemText函数代码示例

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


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

示例1: DlgProfileNew

static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	struct DlgProfData *dat = (struct DlgProfData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
	switch (msg) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hwndDlg);
		SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
		dat = (struct DlgProfData *)lParam;
		{
			HWND hwndCombo = GetDlgItem(hwndDlg, IDC_PROFILEDRIVERS);

			// what, no plugins?!
			if (arDbPlugins.getCount() == 0) {
				EnableWindow(hwndCombo, FALSE);
				EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILENAME), FALSE);
				ShowWindow(GetDlgItem(hwndDlg, IDC_NODBDRIVERS), TRUE);
			}
			else {
				for (int i = 0; i < arDbPlugins.getCount(); i++) {
					DATABASELINK *p = arDbPlugins[i];
					LRESULT index = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)TranslateTS(p->szFullName));
					SendMessage(hwndCombo, CB_SETITEMDATA, index, (LPARAM)p);
				}
			}

			// default item
			SendMessage(hwndCombo, CB_SETCURSEL, 0, 0);

			// subclass the profile name box
			mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PROFILENAME), ProfileNameValidate);
		}

		// decide if there is a default profile name given in the INI and if it should be used
		if (dat->pd->noProfiles || (shouldAutoCreate(dat->pd->szProfile) && _taccess(dat->pd->szProfile, 0))) {
			TCHAR *profile = _tcsrchr(dat->pd->szProfile, '\\');
			if (profile) ++profile;
			else profile = dat->pd->szProfile;

			TCHAR *p = _tcsrchr(profile, '.');
			TCHAR c = 0;
			if (p) { c = *p; *p = 0; }

			SetDlgItemText(hwndDlg, IDC_PROFILENAME, profile);
			if (c) *p = c;
		}

		// focus on the textbox
		PostMessage(hwndDlg, WM_FOCUSTEXTBOX, 0, 0);
		return TRUE;

	case WM_FOCUSTEXTBOX:
		SetFocus(GetDlgItem(hwndDlg, IDC_PROFILENAME));
		break;

	case WM_INPUTCHANGED: // when input in the edit box changes
		SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
		EnableWindow(dat->hwndOK, GetWindowTextLength(GetDlgItem(hwndDlg, IDC_PROFILENAME)) > 0);
		break;

	case WM_SHOWWINDOW:
		if (wParam) {
			EnableWindow(dat->hwndSM, FALSE);
			SetWindowText(dat->hwndOK, TranslateT("&Create"));
			SendMessage(hwndDlg, WM_INPUTCHANGED, 0, 0);
		}
		break;

	case WM_NOTIFY:
		NMHDR *hdr = (NMHDR*)lParam;
		if (hdr && hdr->code == PSN_APPLY && dat && IsWindowVisible(hwndDlg)) {
			TCHAR szName[MAX_PATH];
			LRESULT curSel = SendDlgItemMessage(hwndDlg, IDC_PROFILEDRIVERS, CB_GETCURSEL, 0, 0);
			if (curSel == CB_ERR)
				break; // should never happen

			GetDlgItemText(hwndDlg, IDC_PROFILENAME, szName, SIZEOF(szName));
			if (szName[0] == 0)
				break;

			// profile placed in "profile_name" subfolder
			mir_sntprintf(dat->pd->szProfile, MAX_PATH, _T("%s\\%s\\%s.dat"), dat->pd->szProfileDir, szName, szName);
			dat->pd->newProfile = 1;
			dat->pd->dblink = (DATABASELINK *)SendDlgItemMessage(hwndDlg, IDC_PROFILEDRIVERS, CB_GETITEMDATA, (WPARAM)curSel, 0);

			if (CreateProfile(dat->pd->szProfile, dat->pd->dblink, hwndDlg) == 0)
				SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
		}
		break;
	}

	return FALSE;
}
开发者ID:Ganster41,项目名称:miranda-ng,代码行数:92,代码来源:profilemanager.cpp

示例2: CounterDlgHandler

LRESULT CALLBACK CounterDlgHandler( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
    static int init;
    COUNTEROBJ * st;

    st = (COUNTEROBJ *) actobject;
    if ((st==NULL)||(st->type!=OB_COUNTER)) return(FALSE);

    switch( message )
    {
    case WM_INITDIALOG:
        SCROLLINFO lpsi;
        lpsi.cbSize=sizeof(SCROLLINFO);
        lpsi.fMask=SIF_RANGE|SIF_POS;
        lpsi.nMin=4;
        lpsi.nMax=300;
        SetScrollInfo(GetDlgItem(hDlg,IDC_FONTSIZEBAR),SB_CTL,&lpsi, TRUE);
        SetScrollPos(GetDlgItem(hDlg,IDC_FONTSIZEBAR), SB_CTL,st->fontsize, TRUE);
        SetDlgItemInt(hDlg, IDC_FONTSIZE, st->fontsize, FALSE);
        SetDlgItemText(hDlg, IDC_CAPTION, st->wndcaption);


        SetDlgItemInt(hDlg, IDC_RESETVALUE, (int)st->resetvalue,TRUE);
        switch (st->mode)
        {
        case 0:
            CheckDlgButton(hDlg, IDC_COUNTFT,TRUE);
            break;
        case 1:
            CheckDlgButton(hDlg, IDC_COUNTTF,TRUE);
            break;
        case 2:
            CheckDlgButton(hDlg, IDC_COUNTIV,TRUE);
            break;
        case 3:
            CheckDlgButton(hDlg, IDC_COUNTFREQ,TRUE);
            break;
        }
        CheckDlgButton(hDlg, IDC_SHOWCOUNTER,st->showcounter);
        CheckDlgButton(hDlg, IDC_INTEGER,st->integer);

        return TRUE;

    case WM_CLOSE:
        EndDialog(hDlg, LOWORD(wParam));
        return TRUE;
        break;

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDC_COUNTFT:
            st->mode=0;
            break;
        case IDC_COUNTTF:
            st->mode=1;
            break;
        case IDC_COUNTIV:
            st->mode=2;
            break;
        case IDC_COUNTFREQ:
            st->mode=3;
            break;

        case IDC_RESETCOUNTER:
            st->countervalue=st->resetvalue;
            break;
        case IDC_RESETVALUE:
            st->resetvalue=(float)GetDlgItemInt(hDlg, IDC_RESETVALUE,NULL, 1);
            break;

        case IDC_FONTCOLOR:
            st->fontcolor=select_color(hDlg);
            InvalidateRect(hDlg,NULL,FALSE);
            InvalidateRect(st->displayWnd,NULL,TRUE);
            break;
        case IDC_BKCOLOR:
            st->bkcolor=select_color(hDlg);
            InvalidateRect(hDlg,NULL,FALSE);
            InvalidateRect(st->displayWnd,NULL,TRUE);
            break;
        case IDC_CAPTION:
            GetDlgItemText(hDlg,IDC_CAPTION,st->wndcaption,50);
            SetWindowText(st->displayWnd,st->wndcaption);
            break;

        case IDC_INTEGER:
            st->integer=IsDlgButtonChecked(hDlg,IDC_INTEGER);
            InvalidateRect(st->displayWnd,NULL,TRUE);
            break;

        case IDC_SHOWCOUNTER:
        {   int i;
            i=IsDlgButtonChecked(hDlg,IDC_SHOWCOUNTER);
            if ((st->showcounter)&&(!i)&&(st->displayWnd))  {
                DestroyWindow(st->displayWnd);
                st->displayWnd=NULL;
            }
            if ((!st->showcounter)&&(i))
            {
//.........这里部分代码省略.........
开发者ID:ra--,项目名称:BrainBay,代码行数:101,代码来源:ob_counter.cpp

示例3: EnableToolTips

BOOL COptionTab10::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
  EnableToolTips(true);     // TOOL TIPS

  /* hide password */
  CString st;
  GetDlgItemText(IDC_prox,st);
  if (st.Find('@')>=0) {
    m_ctl_pwdhide.SetCheck(1);
    OnPwdhide();
  } else {
    m_ctl_pwdhide.SetCheck(0);
    OnPwdhide();
  }

  if (LANG_T(-1)) {    // Patcher en français
    SetDlgItemTextCP(this, IDC_proxyconfigure,LANG(LANG_I47b)); // "Configurer"
    SetDlgItemTextCP(this, IDC_ftpprox,LANG(LANG_I47c));
    SetDlgItemTextCP(this, IDC_PWDHIDE,LANG_HIDEPWD);  /* Hide password */
  }  

  // mode modif à la volée
  if (modify==1) {
    GetDlgItem(IDC_prox           ) ->ModifyStyle(0,WS_DISABLED);
    GetDlgItem(IDC_portprox       ) ->ModifyStyle(0,WS_DISABLED);
    GetDlgItem(IDC_proxyconfigure ) ->ModifyStyle(0,WS_DISABLED);
    GetDlgItem(IDC_proxtitle      ) ->ModifyStyle(0,WS_DISABLED);
    GetDlgItem(IDC_ftpprox        ) ->ModifyStyle(0,WS_DISABLED);
  } else {
    GetDlgItem(IDC_prox           ) ->ModifyStyle(WS_DISABLED,0);
    GetDlgItem(IDC_portprox       ) ->ModifyStyle(WS_DISABLED,0);
    GetDlgItem(IDC_proxyconfigure ) ->ModifyStyle(WS_DISABLED,0);
    GetDlgItem(IDC_proxtitle      ) ->ModifyStyle(WS_DISABLED,0);
    GetDlgItem(IDC_ftpprox        ) ->ModifyStyle(WS_DISABLED,0);
  }

  CString str;
  GetDlgItemText(IDC_prox,str);
  m_ctl_prox.ResetContent();
  m_ctl_prox.AddString("");

  HKEY phkResult;
  if (RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",0,KEY_READ,&phkResult)==ERROR_SUCCESS) {
    DWORD type=0;
    DWORD datasize=1000;
    char data[1024];
    data[0]='\0';
    if (RegQueryValueEx(phkResult,"ProxyServer",0,&type,(unsigned char*)&data,&datasize)==ERROR_SUCCESS) {
      if (datasize) {
        char* a=strchr(data,':');
        if (a)
          *a='\0';
        m_ctl_prox.AddString(data);
      }
    }
    RegCloseKey(phkResult);
  }
  SetDlgItemTextCP(this, IDC_prox,str);

  // Do not search for a proxy everytime
  CWinApp* pApp = AfxGetApp();
  if (pApp->GetProfileInt("Interface","FirstProxySearch",0) != 1) {
    pApp->WriteProfileInt("Interface","FirstProxySearch",1);
    
    // Launch proxy name search
    int i=0;
    WSAAsyncGetHostByName(this->m_hWnd,wm_ProxySearch+i,(ProxyDetectName[i]="proxy")   ,this->ProxyDetectBuff[i],sizeof(this->ProxyDetectBuff[i])); i++;
    WSAAsyncGetHostByName(this->m_hWnd,wm_ProxySearch+i,(ProxyDetectName[i]="www")     ,this->ProxyDetectBuff[i],sizeof(this->ProxyDetectBuff[i])); i++;
    WSAAsyncGetHostByName(this->m_hWnd,wm_ProxySearch+i,(ProxyDetectName[i]="ns")      ,this->ProxyDetectBuff[i],sizeof(this->ProxyDetectBuff[i])); i++;
    WSAAsyncGetHostByName(this->m_hWnd,wm_ProxySearch+i,(ProxyDetectName[i]="web")     ,this->ProxyDetectBuff[i],sizeof(this->ProxyDetectBuff[i])); i++;
    WSAAsyncGetHostByName(this->m_hWnd,wm_ProxySearch+i,(ProxyDetectName[i]="ntserv")  ,this->ProxyDetectBuff[i],sizeof(this->ProxyDetectBuff[i])); i++;
    WSAAsyncGetHostByName(this->m_hWnd,wm_ProxySearch+i,(ProxyDetectName[i]="gate")    ,this->ProxyDetectBuff[i],sizeof(this->ProxyDetectBuff[i])); i++;
    WSAAsyncGetHostByName(this->m_hWnd,wm_ProxySearch+i,(ProxyDetectName[i]="gateway") ,this->ProxyDetectBuff[i],sizeof(this->ProxyDetectBuff[i])); i++;
    WSAAsyncGetHostByName(this->m_hWnd,wm_ProxySearch+i,(ProxyDetectName[i]="firewall"),this->ProxyDetectBuff[i],sizeof(this->ProxyDetectBuff[i])); i++;
    WSAAsyncGetHostByName(this->m_hWnd,wm_ProxySearch+i,(ProxyDetectName[i]="cache")   ,this->ProxyDetectBuff[i],sizeof(this->ProxyDetectBuff[i])); i++;
    
  }
  
  return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
开发者ID:Mr-Kumar-Abhishek,项目名称:httrack-windows,代码行数:83,代码来源:OptionTab10.cpp

示例4: GetDlgItemText

void CKrbAddRealm::OnChangeEditRealm()
{
	if (!m_startup)
	  GetDlgItemText(IDC_EDIT_REALM, m_newRealm);
}
开发者ID:Akasurde,项目名称:krb5,代码行数:5,代码来源:KrbAddRealm.cpp

示例5: DlgProcChange


//.........这里部分代码省略.........
			if (dbv.ptszVal[0]) CheckDlgButton(hwndDlg, IDC_External, BST_CHECKED);
			db_free(&dbv);
		}
		// enable/disable the browse button depending on the value of external log checkbox
		EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE), (BYTE)IsDlgButtonChecked(hwndDlg, IDC_External));

		// other checkbox options
		CheckDlgButton(hwndDlg, IDC_DPop, db_get_b(hContact, WEATHERPROTONAME, "DPopUp", FALSE) ? BST_CHECKED : BST_UNCHECKED);
		CheckDlgButton(hwndDlg, IDC_DAutoUpdate, db_get_b(hContact, WEATHERPROTONAME, "DAutoUpdate", FALSE) ? BST_CHECKED : BST_UNCHECKED);
		CheckDlgButton(hwndDlg, IDC_Internal, db_get_b(hContact, WEATHERPROTONAME, "History", 0) ? BST_CHECKED : BST_UNCHECKED);

		if ( !db_get_ts(hContact, WEATHERPROTONAME, "InfoURL", &dbv)) {
			SetDlgItemText(hwndDlg, IDC_IURL, dbv.ptszVal);
			db_free(&dbv);
		}
		if ( !db_get_ts(hContact, WEATHERPROTONAME, "MapURL", &dbv)) {
			SetDlgItemText(hwndDlg, IDC_MURL, dbv.ptszVal);
			db_free(&dbv);
		}

		// display the dialog box and free memory
		Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, WEATHERPROTONAME, "EditSetting_");
		ShowWindow(hwndDlg, SW_SHOW);
		break;

	case WM_COMMAND:
		wndData = (CntSetWndDataType*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
		hContact = wndData ? wndData->hContact : NULL;

		switch(LOWORD(wParam)) {
		case IDC_ID:
			// check if there are 2 parts in the ID (svc/id) seperated by "/"
			// if not, don't let user change the setting
			GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str));
			chop = _tcsstr(str, _T("/"));
			if (chop == NULL)
				EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), FALSE);
			else
				EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), TRUE);
			break;

		case IDC_NAME:
			// check if station name is entered
			// if not, don't let user change the setting
			GetDlgItemText(hwndDlg, IDC_NAME, str, SIZEOF(str));
			EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), str[0] != 0);
			break;

		case IDC_GETNAME: 
			{
				// the button for getting station name from the internet
				// this function uses the ID search for add/find weather station

				if ( !CheckSearch()) return TRUE;	// don't download if update is in progress
				// get the weather update data using the string in the ID field
				GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str));
				GetSvc(str);
				WIDATA *sData = GetWIData(str);
				GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str));
				GetID(str);
				// if ID search is available, do it
				if (sData->IDSearch.Available) {
					TCHAR *szData = NULL;

					// load the page
					mir_snprintf(loc, SIZEOF(loc), sData->IDSearch.SearchURL, str);
开发者ID:martok,项目名称:miranda-ng,代码行数:67,代码来源:weather_contacts.cpp

示例6: PropertyDlgProc


//.........这里部分代码省略.........
            SendDlgItemMessage(hDlg,IDC_CBPLANECOLOR,CB_ADDSTRING,0,(LPARAM)arColor[i]);
            SendDlgItemMessage(hDlg,IDC_CBFONTCOLOR,CB_ADDSTRING,0,(LPARAM)arColor[i]);
        }
        SendDlgItemMessage(hDlg,IDC_SPLINEWIDTH,UDM_SETRANGE,0,MAKELONG(10,0));

        Obj=(DObject *)lParam;
        SetDlgItemInt(hDlg,IDC_EDLINEWIDTH,Obj->LineWidth,FALSE);
        for (i=0; i<sizeof(arColor)/sizeof(arColor[0]); i++) {
            if (arColor[i] == Obj->LineColor) {
                break;
            }
        }
        SendDlgItemMessage(hDlg,IDC_CBLINECOLOR,CB_SETCURSEL,i,0);
        for (i=0; i<sizeof(arColor)/sizeof(arColor[0]); i++) {
            if (arColor[i] == Obj->PlaneColor) {
                break;
            }
        }
        SendDlgItemMessage(hDlg,IDC_CBPLANECOLOR,CB_SETCURSEL,i,0);
        SendDlgItemMessage(hDlg,IDC_SPFONTSIZE,UDM_SETRANGE,0,MAKELONG(72,6));
        SetDlgItemInt(hDlg,IDC_EDFONTSIZE,Obj->FontSize,FALSE);
        for (i=0; i<sizeof(arColor)/sizeof(arColor[0]); i++) {
            if (arColor[i] == Obj->FontColor) {
                break;
            }
        }
        SendDlgItemMessage(hDlg,IDC_CBFONTCOLOR,CB_SETCURSEL,i,0);
        for (i=0; i<FontNum; i++) {
            if (lstrcmp(logfont[i].lfFaceName,Obj->FontFace) == 0) {
                break;
            }
        }
        SendDlgItemMessage(hDlg,IDC_CBFONTFACE,CB_SETCURSEL,i,0);
        if (Obj->Type != -1) {
            if (Obj->Type != DT_TEXT) {
                EnableWindow(GetDlgItem(hDlg,IDC_EDFONTSIZE),FALSE);
                EnableWindow(GetDlgItem(hDlg,IDC_CBFONTCOLOR),FALSE);
                EnableWindow(GetDlgItem(hDlg,IDC_CBFONTFACE),FALSE);
            } else {
                EnableWindow(GetDlgItem(hDlg,IDC_EDLINEWIDTH),FALSE);
                EnableWindow(GetDlgItem(hDlg,IDC_CBLINECOLOR),FALSE);
            }
        }
        return TRUE;
        return TRUE;
    case WM_MEASUREITEM:
        lpmis=(LPMEASUREITEMSTRUCT)lParam;
        lpmis->itemHeight=24;
        return TRUE;
    case WM_DRAWITEM:
        lpdis=(LPDRAWITEMSTRUCT)lParam;

        if (lpdis->itemState & ODS_SELECTED) {
            FillRect(lpdis->hDC, &lpdis->rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
        } else {
            FillRect(lpdis->hDC, &lpdis->rcItem, GetSysColorBrush(COLOR_WINDOW));
        }

        Color=(COLORREF)SendMessage(lpdis->hwndItem, CB_GETITEMDATA, lpdis->itemID, 0);
        if (Color == (COLORREF)-1) {
            ColorBrush=(HBRUSH)GetStockObject(NULL_BRUSH);
        } else {
            ColorBrush=CreateSolidBrush(Color);
        }
        OldBrush=(HBRUSH)SelectObject(lpdis->hDC, ColorBrush);
        Rectangle(lpdis->hDC,lpdis->rcItem.left+5,lpdis->rcItem.top+2,
                  lpdis->rcItem.right-5, lpdis->rcItem.bottom-2);
        SelectObject(lpdis->hDC, OldBrush);
        if (Color == (COLORREF)-1) {
            SetTextAlign(lpdis->hDC,TA_CENTER);
            SetBkMode(lpdis->hDC,TRANSPARENT);
            TextOut(lpdis->hDC,(lpdis->rcItem.right+lpdis->rcItem.left)/2,
                    lpdis->rcItem.top+4,"투명",4);
        } else {
            DeleteObject(ColorBrush);
        }
        return TRUE;
    case WM_COMMAND:
        switch (wParam) {
        case IDOK:
            Obj->LineWidth=GetDlgItemInt(hDlg,IDC_EDLINEWIDTH,NULL,FALSE);
            i=SendDlgItemMessage(hDlg,IDC_CBLINECOLOR,CB_GETCURSEL,0,0);
            Obj->LineColor=arColor[i];
            i=SendDlgItemMessage(hDlg,IDC_CBPLANECOLOR,CB_GETCURSEL,0,0);
            Obj->PlaneColor=arColor[i];
            i=SendDlgItemMessage(hDlg,IDC_CBFONTCOLOR,CB_GETCURSEL,0,0);
            Obj->FontColor=arColor[i];
            Obj->FontSize=GetDlgItemInt(hDlg,IDC_EDFONTSIZE,NULL,FALSE);
            GetDlgItemText(hDlg,IDC_CBFONTFACE,Obj->FontFace,32);
            EndDialog(hDlg,IDOK);
            EndDialog(hDlg,IDOK);
            return TRUE;
        case IDCANCEL:
            EndDialog(hDlg,IDCANCEL);
            return TRUE;
        }
        break;
    }
    return FALSE;
}
开发者ID:MaybeS,项目名称:when_i_was_a_kid,代码行数:101,代码来源:ApiDraw.cpp

示例7: DlgProcText


//.........这里部分代码省略.........
			if (HIWORD(wParam) == EN_CHANGE)
				SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
			break;

		case IDC_MORE:
			// display custom variables list
			MoreVarList();
			break;

		case IDC_TM1:
		case IDC_TM2:
		case IDC_TM3:
		case IDC_TM4:
		case IDC_TM5:
		case IDC_TM6:
		case IDC_TM7:
		case IDC_TM8:
			WEATHERINFO winfo;
			// display the menu
			button = GetDlgItem(hdlg, LOWORD(wParam));
			GetWindowRect(button, &pos);
			hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_TMMENU));
			hMenu1 = GetSubMenu(hMenu, 0);
			TranslateMenu(hMenu1);
			switch (TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, NULL)) {
			case ID_MPREVIEW:
				// show the preview in a message box, using the weather data from the default station
				winfo = LoadWeatherInfo(opt.DefStn);
				GetDisplay(&winfo, *var[LOWORD(wParam) - IDC_TM1], str);
				MessageBox(NULL, str, TranslateT("Weather Protocol Text Preview"), MB_OK | MB_TOPMOST);
				break;

			case ID_MRESET:
				unsigned varo = LOWORD(wParam) - IDC_TM1;
				// remove the old setting from db and free memory
				TCHAR* vartmp = *var[varo];
				wfree(&vartmp);
				SetTextDefault(varname[varo]);
				SetDlgItemText(hdlg, cname[varo], *var[varo]);
				break;
			}
			DestroyMenu(hMenu);
			break;

		case IDC_RESET:
			// left click action selection menu
			button = GetDlgItem(hdlg, IDC_RESET);
			GetWindowRect(button, &pos);
			hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_TMENU));
			hMenu1 = GetSubMenu(hMenu, 0);
			TranslateMenu(hMenu1);
			switch (TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, NULL)) {
			case ID_T1:
				// reset to the strings in memory, discard all changes
				LoadTextSettings(hdlg);
				break;

			case ID_T2:
				// reset to the default setting
				FreeTextVar();
				SetTextDefault("CbBENHX");
				LoadTextSettings(hdlg);
				break;
			}
			DestroyMenu(hMenu);
			break;
		}
		return TRUE;
	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->code) {
		case PSN_APPLY:
			// save the option
			TCHAR textstr[MAX_TEXT_SIZE];
			// free memory for old settings
			FreeTextVar();
			// save new settings to memory
			GetDlgItemText(hdlg, IDC_CTEXT, textstr, SIZEOF(textstr));
			wSetData(&opt.cText, textstr);
			GetDlgItemText(hdlg, IDC_BTEXT, textstr, SIZEOF(textstr));
			wSetData(&opt.bText, textstr);
			GetDlgItemText(hdlg, IDC_BTITLE, textstr, SIZEOF(textstr));
			wSetData(&opt.bTitle, textstr);
			GetDlgItemText(hdlg, IDC_ETEXT, textstr, SIZEOF(textstr));
			wSetData(&opt.eText, textstr);
			GetDlgItemText(hdlg, IDC_NTEXT, textstr, SIZEOF(textstr));
			wSetData(&opt.nText, textstr);
			GetDlgItemText(hdlg, IDC_HTEXT, textstr, SIZEOF(textstr));
			wSetData(&opt.hText, textstr);
			GetDlgItemText(hdlg, IDC_XTEXT, textstr, SIZEOF(textstr));
			wSetData(&opt.xText, textstr);
			GetDlgItemText(hdlg, IDC_BTITLE2, textstr, SIZEOF(textstr));
			wSetData(&opt.sText, textstr);
			SaveOptions();
			UpdateAllInfo(0, 0);
			break;
		}
		break;
	}
	return FALSE;
}
开发者ID:martok,项目名称:miranda-ng,代码行数:101,代码来源:weather_opt.cpp

示例8: GetDlgItemText

void CKrb4AddToRealmHostList::OnChangeEditDefaultRealm()
{
	if (!m_startup)
	  GetDlgItemText(IDC_EDIT_DEFAULT_REALM, m_newRealm);
}
开发者ID:Akasurde,项目名称:krb5,代码行数:5,代码来源:Krb4AddToRealmHostList.cpp

示例9: BrowserDlgProc

//
//  FUNCTION: BrowserDlgProc()
//
//  PURPOSE: Browser dialog windows message handler.
//
//  COMMENTS:
//
//    The code for handling buttons and menu actions is here.
//
INT_PTR CALLBACK BrowserDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    // Get the browser and other pointers since they are used a lot below
    HWND hwndBrowser = GetDlgItem(hwndDlg, IDC_BROWSER);
    nsIWebBrowserChrome *chrome = nullptr ;
    if (hwndBrowser)
    {
        chrome = (nsIWebBrowserChrome *) GetWindowLongPtr(hwndBrowser, GWLP_USERDATA);
    }
    nsCOMPtr<nsIWebBrowser> webBrowser;
    nsCOMPtr<nsIWebNavigation> webNavigation;
    if (chrome)
    {
        chrome->GetWebBrowser(getter_AddRefs(webBrowser));
        webNavigation = do_QueryInterface(webBrowser);
    }

    // Test the message
    switch (uMsg)
    {
    case WM_INITDIALOG:
        return TRUE;

    case WM_INITMENU:
        UpdateUI(chrome);
        return TRUE;

    case WM_SYSCOMMAND:
        if (wParam == SC_CLOSE)
        {
            WebBrowserChromeUI::Destroy(chrome);
            return TRUE;
        }
        break;

    case WM_DESTROY:
        return TRUE;

    case WM_COMMAND:
        if (!webBrowser)
        {
            return TRUE;
        }

        // Test which command was selected
        switch (LOWORD(wParam))
        {
        case IDC_ADDRESS:
            if (HIWORD(wParam) == CBN_EDITCHANGE || HIWORD(wParam) == CBN_SELCHANGE)
            {
                // User has changed the address field so enable the Go button
                EnableWindow(GetDlgItem(hwndDlg, IDC_GO), TRUE);
            }
            break;

        case IDC_GO:
            {
                TCHAR szURL[2048];
                memset(szURL, 0, sizeof(szURL));
                GetDlgItemText(hwndDlg, IDC_ADDRESS, szURL,
                    sizeof(szURL) / sizeof(szURL[0]) - 1);
                webNavigation->LoadURI(
                    NS_ConvertASCIItoUTF16(szURL).get(),
                    nsIWebNavigation::LOAD_FLAGS_NONE,
                    nullptr,
                    nullptr,
                    nullptr);
            }
            break;

        case IDC_STOP:
            webNavigation->Stop(nsIWebNavigation::STOP_ALL);
            UpdateUI(chrome);
            break;

        case IDC_RELOAD:
            webNavigation->Reload(nsIWebNavigation::LOAD_FLAGS_NONE);
            break;

        case IDM_EXIT:
            PostMessage(hwndDlg, WM_SYSCOMMAND, SC_CLOSE, 0);
            break;

        // File menu commands

        case MOZ_NewBrowser:
            OpenWebPage(gFirstURL);
            break;

        // Edit menu commands

//.........这里部分代码省略.........
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:101,代码来源:winEmbed.cpp

示例10: UpdateData

void CIPFindDlg::OnBnClickedButtonStart()
{
	UpdateData(TRUE);
	CString strMac;
	GetDlgItemText(IDC_EDIT_MAC, strMac);
	if (0 != strMac.GetLength() && !CheckMACAddr(strMac))
	{
		MessageBox(MAC_ADDR_ERROR_MSG, MAC_ADDR_ERROR_TITLE);
		return;
	}

	GetDlgItem(IDC_BUTTON_START)->EnableWindow(false);

	CListCtrl *m_pList =(CListCtrl*)GetDlgItem(IDC_LIST_IPMAC);
	if (!m_pList) 
	{
		AfxMessageBox(_T("Failed to get point of CListCtrl"));
		return ;
	}

	// Delete all items and update immediately
	m_pList->DeleteAllItems();
	ASSERT(m_pList->GetItemCount() == 0);
	m_pList->SetRedraw(TRUE);
	m_pList->Invalidate();
	m_pList->UpdateWindow();
	
	// do find
	vtIpMac.swap(vector<st_ip_mac>());
	IPFind(m_strFindIP, m_strFindMask, vtIpMac);

	int nItem;
	st_ip_mac ipmac;
	int len = vtIpMac.size();

	USES_CONVERSION;

	if (FALSE == strMac.IsEmpty())
	{
		strMac.MakeUpper();
		strMac.Replace(_T(":"), _T("-"));
		string strMacFind = T2A(strMac);

		for (int i=0; i<len; i++)
		{
			if (0 == strMacFind.compare(vtIpMac.at(i).mac))
			{
				nItem = m_pList->GetItemCount();
				m_pList->InsertItem(nItem, A2T(vtIpMac.at(i).ip.c_str()));
				m_pList->SetItemText(nItem, 1, A2T(vtIpMac.at(i).mac.c_str()));
			}
		}
	}
	else
	{
		for (int i=0; i<len; i++)
		{
			nItem = m_pList->GetItemCount();
			m_pList->InsertItem(nItem, A2T(vtIpMac.at(i).ip.c_str()));
			m_pList->SetItemText(nItem, 1, A2T(vtIpMac.at(i).mac.c_str()));
		}
	}

	GetDlgItem(IDC_BUTTON_START)->EnableWindow(true);
}
开发者ID:matrix207,项目名称:VC,代码行数:65,代码来源:IPFindDlg.cpp

示例11: CFG_AddNewInstall_Proc

LRESULT CALLBACK  CFG_AddNewInstall_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	TCHAR szFile[360];
	switch(uMsg)
	{
		case WM_INITDIALOG:
			{
				g_cfgScriptTmp.clear();
				g_cfgFilterNameTmp.clear();
				SetWindowText(hDlg,g_lang.GetString("TitleNewInstall"));
				SetDlgItemText(hDlg,IDC_BUTTON_EXE_CFG_OK,g_lang.GetString("Save"));
				SetDlgItemText(hDlg,IDC_BUTTON_CFG_EXE_CANCEL,g_lang.GetString("Cancel"));
				SetDlgItemText(hDlg,IDC_STATIC_ADDNEWINSTALL,g_lang.GetString("AddNewInstall"));
				SetDlgItemText(hDlg,IDC_STATIC_EXE,g_lang.GetString("ColumnExePath"));
				SetDlgItemText(hDlg,IDC_STATIC_COMMAND,g_lang.GetString("ColumnCommand"));
				SetDlgItemText(hDlg,IDC_EDIT_CFG_PROPNAME,"Default");
				int gameID = CFG_GetGameID(g_currSelCfg);
				if(gm.GamesInfo[gameID].vGAME_INST_DEFAULT.size()>0)
				{
					SetDlgItemText(hDlg,IDC_EDIT_CMD,gm.GamesInfo[gameID].vGAME_INST_DEFAULT.at(0).szGAME_CMD.c_str());
				}
				
				break;
			}
		case WM_COMMAND:
			{
				switch (LOWORD(wParam))
	            {
					case IDC_BUTTON_EDIT_SCRIPT:
						DialogBoxParam(g_hInst, (LPCTSTR)IDD_DLG_EDIT_FILTER, hDlg, (DLGPROC)FilterEditor_Dlg,-1);
						g_cfgScriptTmp = g_EditorTI.sScript;
						g_cfgFilterNameTmp = g_EditorTI.sName;
						SetDlgItemText(hDlg,IDC_EDIT_SCRIPTNAME,g_cfgFilterNameTmp.c_str());
					break;
					case IDC_BUTTON_CFG_EXE_CANCEL:
						EndDialog(hDlg,0);
						break;
					case IDC_BUTTON_EXE_CFG_OK:
						{
							int gameID = CFG_GetGameID(g_currSelCfg);
							TCHAR szTemp[MAX_PATH*2];
							GAME_INSTALLATIONS gi;
							GetDlgItemText(hDlg,IDC_EDIT_CFG_PROPNAME,szTemp,MAX_PATH);
							if(strlen(szTemp)==0)
							{
								MessageBox(hDlg,g_lang.GetString("NoName"),"Error saving",MB_OK);
								return TRUE;
							}
							if(IsDlgButtonChecked(hDlg,IDC_CHECK_CONDITION)==BST_CHECKED)
								gi.bActiveScript=TRUE;
							else
								gi.bActiveScript=FALSE;

							gi.sFilterName = g_cfgFilterNameTmp;
							gi.sScript = g_cfgScriptTmp;
							gi.sName = szTemp;
							GetDlgItemText(hDlg,IDC_EDIT_PATH,szTemp,MAX_PATH*2);
							gi.szGAME_PATH = szTemp;
							GetDlgItemText(hDlg,IDC_EDIT_CMD,szTemp,MAX_PATH*2);
							gi.szGAME_CMD = szTemp;

//USE below function for above code!!!
//GetDlgItemTextToString(HWND hWnd,int nID, string &pOutString)
							GamesInfoCFG[gameID].vGAME_INST.push_back(gi);

							EndDialog(hDlg,0);
						}
						break;

					case IDC_BUTTON_ET_PATH:
					{	
						 
						OPENFILENAME ofn;
						memset(&ofn,0,sizeof(OPENFILENAME));
						ofn.lStructSize = sizeof (OPENFILENAME);
						ofn.hwndOwner = hDlg;
						ofn.lpstrFilter = NULL;
						ofn.lpstrFile = szFile;

						// Set lpstrFile[0] to '\0' so that GetOpenFileName does not 
						// use the contents of szFile to initialize itself.
						//
						ofn.lpstrFile[0] = '\0';
						ofn.nMaxFile = sizeof(szFile);
						ofn.lpstrFilter = "All\0*.*\0Executable\0*.exe\0";
						ofn.nFilterIndex = 2;
						ofn.lpstrFileTitle = NULL;
						ofn.nMaxFileTitle = 0;
						ofn.lpstrInitialDir = NULL;
						int gameID=-1;
						gameID = CFG_GetGameID(g_currSelCfg);

						if(gameID!=-1)
						{
								if(GamesInfoCFG[gameID].vGAME_INST.size()>0)
									ofn.lpstrInitialDir = GamesInfoCFG[gameID].vGAME_INST[CFG_editexeIdx].szGAME_PATH.c_str();
						}
						ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

						if(GetOpenFileName(&ofn))
//.........这里部分代码省略.........
开发者ID:elitak,项目名称:gamescanner,代码行数:101,代码来源:config.cpp

示例12: CFG_EditInstall_Proc

LRESULT CALLBACK  CFG_EditInstall_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	TCHAR szFile[260];
	switch(uMsg)
	{
		case WM_INITDIALOG:
			{
				CFG_editexeIdx = lParam;
				int gameID = CFG_GetGameID(g_currSelCfg);	
				GAME_INSTALLATIONS gi;
				gi = GamesInfoCFG[gameID].vGAME_INST.at(lParam);

				g_cfgScriptTmp.clear();
				g_cfgFilterNameTmp.clear();

				g_EditorTI.sScript = gi.sScript;
				g_EditorTI.sName  = gi.sFilterName;


				CheckDlgButton(hDlg,IDC_CHECK_CONDITION,gi.bActiveScript);			
				SetDlgItemText(hDlg,IDC_EDIT_SCRIPTNAME,gi.sFilterName.c_str());

				SetDlgItemText(hDlg,IDC_EDIT_CFG_PROPNAME,gi.sName.c_str());
				SetDlgItemText(hDlg,IDC_EDIT_PATH,gi.szGAME_PATH.c_str());
				SetDlgItemText(hDlg,IDC_EDIT_CMD,gi.szGAME_CMD.c_str());
		//		SetDlgItemText(hDlg,IDC_EDIT_CFG_MOD,gi.sMod.c_str());
		//		SetDlgItemText(hDlg,IDC_EDIT_CFG_VERSION,gi.sVersion.c_str());
				break;
			}
		case WM_COMMAND:
			{
				switch (LOWORD(wParam))
	            {
					case IDC_BUTTON_EDIT_SCRIPT:
						DialogBoxParam(g_hInst, (LPCTSTR)IDD_DLG_EDIT_FILTER, hDlg, (DLGPROC)FilterEditor_Dlg,-2);
						g_cfgScriptTmp = g_EditorTI.sScript;
						g_cfgFilterNameTmp = g_EditorTI.sName;
						SetDlgItemText(hDlg,IDC_EDIT_SCRIPTNAME,g_cfgFilterNameTmp.c_str());
					break;
					case IDC_BUTTON_CFG_EXE_CANCEL:
						EndDialog(hDlg,0);
						break;
					case IDC_BUTTON_EXE_CFG_OK:
						{
							int gameID = CFG_GetGameID(g_currSelCfg);
							TCHAR szTemp[MAX_PATH*2];
							GAME_INSTALLATIONS gi;
							GetDlgItemText(hDlg,IDC_EDIT_CFG_PROPNAME,szTemp,MAX_PATH);
							if(strlen(szTemp)==0)
							{
								MessageBox(hDlg,g_lang.GetString("NoName"),"Error saving",MB_OK);
								return TRUE;
							}
							if(IsDlgButtonChecked(hDlg,IDC_CHECK_CONDITION)==BST_CHECKED)
								gi.bActiveScript=TRUE;
							else
								gi.bActiveScript=FALSE;

							gi.sFilterName = g_cfgFilterNameTmp;
							gi.sScript = g_cfgScriptTmp;

							gi.sName = szTemp;
							GetDlgItemText(hDlg,IDC_EDIT_PATH,szTemp,MAX_PATH);
							gi.szGAME_PATH = szTemp;
							GetDlgItemText(hDlg,IDC_EDIT_CMD,szTemp,MAX_PATH*2);
							gi.szGAME_CMD = szTemp;
							GamesInfoCFG[gameID].vGAME_INST.at(CFG_editexeIdx) = gi;
							EndDialog(hDlg,0);
						}
						break;

					case IDC_BUTTON_ET_PATH:
					{	
						 
						OPENFILENAME ofn;
						memset(&ofn,0,sizeof(OPENFILENAME));
						ofn.lStructSize = sizeof (OPENFILENAME);
						ofn.hwndOwner = hDlg;
						ofn.lpstrFilter = NULL;
						ofn.lpstrFile = szFile;

						// Set lpstrFile[0] to '\0' so that GetOpenFileName does not 
						// use the contents of szFile to initialize itself.
						//
						ofn.lpstrFile[0] = '\0';
						ofn.nMaxFile = sizeof(szFile);
						ofn.lpstrFilter = "All\0*.*\0Executable\0*.exe\0";
						ofn.nFilterIndex = 2;
						ofn.lpstrFileTitle = NULL;
						ofn.nMaxFileTitle = 0;
						ofn.lpstrInitialDir = NULL;
						int gameID=-1;
						gameID = CFG_GetGameID(g_currSelCfg);

						if(gameID!=-1)
						{
							if(GamesInfoCFG[gameID].vGAME_INST.size()>0)
								ofn.lpstrInitialDir = GamesInfoCFG[gameID].vGAME_INST[CFG_editexeIdx].szGAME_PATH.c_str();
						}
						ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
//.........这里部分代码省略.........
开发者ID:elitak,项目名称:gamescanner,代码行数:101,代码来源:config.cpp

示例13: GetDlgItemText

void TcompatibilityList::dlg2dlg(const char_t *newFileName)
{
    char_t complist0[MAX_COMPATIBILITYLIST_LENGTH];
    GetDlgItemText(m_hwnd, IDC_ED_COMPATIBILITYLIST, complist0, MAX_COMPATIBILITYLIST_LENGTH);
    cfg2dlgI(complist0, newFileName, _l("\r\n"));
}
开发者ID:TheRyuu,项目名称:ffdshow,代码行数:6,代码来源:TcompatibilityList.cpp

示例14: HandleCommandMessage

BOOL HandleCommandMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    int wmID, wmEvent;
    wmID = LOWORD(wParam);
    wmEvent = HIWORD(wParam);

    switch (wmEvent)
    {
    case BN_CLICKED:
        switch (wmID)
        {
        case IDC_ADD:
            {
                SaveLocalizationText(); // save any current changes to the database

                plString buttonText;
                wchar_t buff[256];
                GetDlgItemText(gEditDlg, IDC_ADD, buff, 256);
                buttonText = plString::FromWchar(buff);

                if (buttonText == "Add Element")
                {
                    plAddElementDlg dlg(gCurrentPath);
                    if (dlg.DoPick(gEditDlg))
                    {
                        plString path = dlg.GetValue(); // path is age.set.name
                        if (!pfLocalizationDataMgr::Instance().AddElement(path))
                            MessageBox(gEditDlg, L"Couldn't add new element because one already exists with that name!", L"Error", MB_ICONERROR | MB_OK);
                        else
                        {
                            gCurrentPath = "";
                            plLocTreeView::ClearTreeView(gTreeView);
                            plLocTreeView::FillTreeViewFromData(gTreeView, path);
                            UpdateEditDlg(path);
                        }
                    }
                }
                else if (buttonText == "Add Localization")
                {
                    plAddLocalizationDlg dlg(gCurrentPath);
                    if (dlg.DoPick(gEditDlg))
                    {
                        plString newLanguage = dlg.GetValue();
                        plString ageName, setName, elementName, elementLanguage;
                        SplitLocalizationPath(gCurrentPath, ageName, setName, elementName, elementLanguage);
                        plString key = plString::Format("%s.%s.%s", ageName.c_str(), setName.c_str(), elementName.c_str());
                        if (!pfLocalizationDataMgr::Instance().AddLocalization(key, newLanguage))
                            MessageBox(gEditDlg, L"Couldn't add additional localization!", L"Error", MB_ICONERROR | MB_OK);
                        else
                        {
                            plString path = plString::Format("%s.%s", key.c_str(), newLanguage.c_str());
                            gCurrentPath = "";
                            plLocTreeView::ClearTreeView(gTreeView);
                            plLocTreeView::FillTreeViewFromData(gTreeView, path);
                            UpdateEditDlg(path);
                        }
                    }
                }
                return FALSE;
            }
        case IDC_DELETE:
            {
                SaveLocalizationText(); // save any current changes to the database

                plString messageText = plString::Format("Are you sure that you want to delete %s?", gCurrentPath.c_str());
                int res = MessageBoxW(gEditDlg, messageText.ToWchar(), L"Delete", MB_ICONQUESTION | MB_YESNO);
                if (res == IDYES)
                {
                    plString buttonText;
                    wchar_t buff[256];
                    GetDlgItemText(gEditDlg, IDC_DELETE, buff, 256);
                    buttonText = plString::FromWchar(buff);

                    if (buttonText == "Delete Element")
                    {
                        if (!pfLocalizationDataMgr::Instance().DeleteElement(gCurrentPath))
                            MessageBox(gEditDlg, L"Couldn't delete element!", L"Error", MB_ICONERROR | MB_OK);
                        else
                        {
                            plString path = gCurrentPath;
                            gCurrentPath = "";
                            plLocTreeView::ClearTreeView(gTreeView);
                            plLocTreeView::FillTreeViewFromData(gTreeView, path);
                            UpdateEditDlg(path);
                        }
                    }
                    else if (buttonText == "Delete Localization")
                    {
                        plString ageName, setName, elementName, elementLanguage;
                        SplitLocalizationPath(gCurrentPath, ageName, setName, elementName, elementLanguage);
                        plString key = plString::Format("%s.%s.%s", ageName.c_str(), setName.c_str(), elementName.c_str());
                        if (!pfLocalizationDataMgr::Instance().DeleteLocalization(key, elementLanguage))
                            MessageBox(gEditDlg, L"Couldn't delete localization!", L"Error", MB_ICONERROR | MB_OK);
                        else
                        {
                            plString path = gCurrentPath;
                            gCurrentPath = "";
                            plLocTreeView::ClearTreeView(gTreeView);
                            plLocTreeView::FillTreeViewFromData(gTreeView, path);
                            UpdateEditDlg(path);
//.........这里部分代码省略.........
开发者ID:Filtik,项目名称:Plasma,代码行数:101,代码来源:plEditDlg.cpp

示例15: DlgProc_EMail

/**
 * name:	 DlgProc_EditEMail()
 * desc:	 dialog procedure
 *
 * return:	 0 or 1
 **/
static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	LPCBEXITEM cbi = (LPCBEXITEM)GetUserData(hDlg);

	switch (msg) {
	case WM_INITDIALOG:
		cbi = (LPCBEXITEM)lParam;
		if (!cbi)
			return FALSE;
		SetUserData(hDlg, lParam);

		SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)IcoLib_GetIcon(ICO_DLG_EMAIL, TRUE));
		if (db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1)) {
			SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK));
			SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL));
		}

		if (*cbi->pszVal)
			SetWindowText(hDlg, LPGENT("Edit e-mail"));
		TranslateDialogDefault(hDlg);
		SendDlgItemMessage(hDlg, EDIT_CATEGORY, EM_LIMITTEXT, cbi->ccCat - 1, 0);
		SendDlgItemMessage(hDlg, EDIT_EMAIL, EM_LIMITTEXT, cbi->ccVal - 1, 0);
		SetDlgItemText(hDlg, EDIT_CATEGORY, cbi->pszCat);
		SetDlgItemText(hDlg, EDIT_EMAIL, cbi->pszVal);
		EnableWindow(GetDlgItem(hDlg, EDIT_CATEGORY), !(cbi->wFlags & CBEXIF_CATREADONLY));
		EnableWindow(GetDlgItem(hDlg, IDOK), *cbi->pszVal);

		// translate Userinfo buttons
		{
			TCHAR szButton[MAX_PATH];
			HWND hBtn = GetDlgItem(hDlg, IDOK);
			GetWindowText(hBtn, szButton, _countof(szButton));
			SetWindowText(hBtn, TranslateTS(szButton));

			hBtn = GetDlgItem(hDlg, IDCANCEL);
			GetWindowText(hBtn, szButton, _countof(szButton));
			SetWindowText(hBtn, TranslateTS(szButton));
		}
		return TRUE;

	case WM_CTLCOLORSTATIC:
		SetBkColor((HDC)wParam, RGB(255, 255, 255));
		return (INT_PTR)GetStockObject(WHITE_BRUSH);

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
			case IDOK: {
				if (HIWORD(wParam) == BN_CLICKED) {
					if (cbi->pszVal && cbi->ccVal > 0)
						GetDlgItemText(hDlg, EDIT_EMAIL, cbi->pszVal, cbi->ccVal);
					if (cbi->pszCat && cbi->ccCat > 0)
						GetDlgItemText(hDlg, EDIT_CATEGORY, cbi->pszCat, cbi->ccCat);
				}
				break;
			}
			case IDCANCEL: {
				if (HIWORD(wParam) == BN_CLICKED) 
					EndDialog(hDlg, LOWORD(wParam));
				break;
			}
			case EDIT_EMAIL:
				if (HIWORD(wParam) == EN_UPDATE) {
					TCHAR szText[MAXDATASIZE];
					LPTSTR pszAdd, pszDot;
					if (PtrIsValid(cbi)) {
						GetWindowText((HWND)lParam, szText, _countof(szText));
						EnableWindow(GetDlgItem(hDlg, IDOK), 
							((pszAdd = _tcschr(szText, '@')) && 
							*(pszAdd + 1) != '.' &&
							(pszDot = _tcschr(pszAdd, '.')) &&
							*(pszDot + 1) &&
							mir_tstrcmp(szText, cbi->pszVal)));
					}
				}
				break;
		}
		break;
	}
	return FALSE;
}
开发者ID:Seldom,项目名称:miranda-ng,代码行数:86,代码来源:ctrl_contact.cpp


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