这篇教程C++ wcstol函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wcstol函数的典型用法代码示例。如果您正苦于以下问题:C++ wcstol函数的具体用法?C++ wcstol怎么用?C++ wcstol使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wcstol函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetDlgItem// Если nCtrlId==0 - hParent==hListint CSetDlgLists::SelectStringExact(HWND hParent, WORD nCtrlId, LPCWSTR asText){ if (!hParent) // был ghOpWnd. теперь может быть вызван и для других диалогов! return -1; HWND hList = nCtrlId ? GetDlgItem(hParent, nCtrlId) : hParent; _ASSERTE(hList!=NULL); int nIdx = SendMessage(hList, CB_FINDSTRINGEXACT, -1, (LPARAM)asText); if (nIdx < 0) { int nCount = SendMessage(hList, CB_GETCOUNT, 0, 0); wchar_t* pszNumEnd = NULL; int nNewVal = wcstol(asText, &pszNumEnd, 10), nCurVal; bool bUseNumCmp = (pszNumEnd && *pszNumEnd) && ((nNewVal != 0) || (lstrcmp(pszNumEnd, L"0") == 0)); // For `Font Sizes` generally if (bUseNumCmp) { wchar_t temp[MAX_PATH] = {}; for (int i = 0; i < nCount; i++) { if (!SendMessage(hList, CB_GETLBTEXT, i, (LPARAM)temp)) break; nCurVal = _wtol(temp); if (nCurVal == nNewVal) { nIdx = i; break; } else if (nCurVal > nNewVal) { nIdx = SendMessage(hList, CB_INSERTSTRING, i, (LPARAM)asText); break; } } } if (nIdx < 0) { nIdx = SendMessage(hList, CB_INSERTSTRING, 0, (LPARAM)asText); } } if (nIdx >= 0) SendMessage(hList, CB_SETCURSEL, nIdx, 0); else SetWindowText(hList, asText); return nIdx;}
开发者ID:2asoft,项目名称:ConEmu,代码行数:56,
示例2: ASSERTBOOL COFSNcDlg2::LoadRectangle(IXMLDOMNode *pXmlRoot, LPCTSTR szRectangleName, CRect &r){ ASSERT(pXmlRoot != NULL); ASSERT(szRectangleName != NULL); BOOL bResult = FALSE; CComPtr<IXMLDOMNode> pRectangle = NULL; CComBSTR bs; WCHAR *szNULL = L"/0x00"; long x=0, y=0, cx=0, cy=0; bs.Empty(); bs = L"Rectangle[@Name=/""; bs += szRectangleName; bs += L"/"]"; pXmlRoot->selectSingleNode(bs, &pRectangle); if(pRectangle) { bs.Empty(); SelectChildNode(pRectangle, CComBSTR(L"XPos"), NULL, &bs); if(bs.m_str != NULL) x = wcstol(bs.m_str, &szNULL, 10); bs.Empty(); SelectChildNode(pRectangle, CComBSTR(L"YPos"), NULL, &bs); if(bs.m_str != NULL) y = wcstol(bs.m_str, &szNULL, 10); bs.Empty(); SelectChildNode(pRectangle, CComBSTR(L"XLen"), NULL, &bs); if(bs.m_str != NULL) cx = wcstol(bs.m_str, &szNULL, 10); bs.Empty(); SelectChildNode(pRectangle, CComBSTR(L"YLen"), NULL, &bs); if(bs.m_str != NULL) cy = wcstol(bs.m_str, &szNULL, 10); //pRectangle->Release(); r = CRect(CPoint(x, y), CSize(cx, cy)); bResult = TRUE; } return bResult;}
开发者ID:alex765022,项目名称:IBN,代码行数:42,
示例3: SetTimeout HRESULT SetTimeout(PCWSTR pszTimeout) { // Convert the specified timeout to an integer. PWSTR pszEnd; _dwTimeout = wcstol(pszTimeout, &pszEnd, 0); HRESULT hr = (*pszEnd ? E_INVALIDARG : S_OK); if (FAILED(hr)) { ParseError(L"Invalid timeout: %s/n", pszTimeout); } return hr; }
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:12,
示例4: strtobool// strtobool - Converts string values (e.g. "yes", "no", "on", "off") to boolean// values.//// - s (IN): String value to convert.//// Return Value://// Returns TRUE if the string is recognized as a "true" string. Otherwise// returns FALSE.//BOOL strtobool (LPCWSTR s) { WCHAR *end; if ((_wcsicmp(s, L"true") == 0) || (_wcsicmp(s, L"yes") == 0) || (_wcsicmp(s, L"on") == 0) || (wcstol(s, &end, 10) == 1)) { return TRUE; } else { return FALSE; }}
开发者ID:bestustc,项目名称:vld,代码行数:23,
示例5: ParseRectStringbool ParseRectString(LPCWSTR lpszRect, CUIRect& rc){ LPWSTR pstr = NULL; // // left // rc.left = wcstol(lpszRect, &pstr, 10); if (pstr == NULL && *pstr != L','){ return false; } // // top // rc.top = wcstol(pstr + 1, &pstr, 10); if (pstr == NULL && *pstr != L','){ return false; } // // right // rc.right = wcstol(pstr + 1, &pstr, 10); if (pstr == NULL && *pstr != L','){ return false; } rc.bottom = wcstol(pstr + 1, &pstr, 10); if (pstr == NULL){ return false; } return true;}
开发者ID:asdlei00,项目名称:gtkduilib,代码行数:38,
示例6: XML_GetTupelstatic bool XML_GetTupel(cgMSXML::IXMLElement* pElem, const wchar_t* pszAttrName, long* pa, long* pb){ VARIANT val; wchar_t* pszEnd; bool bOk = true; long a; long b; VariantInit(&val); if(FAILED(pElem->getAttribute((wchar_t*)/*cast ok?*/pszAttrName, &val)) || val.vt!=VT_BSTR) return false; a = wcstol(val.bstrVal, &pszEnd, 10); if(pa) *pa = a; while(iswspace(*pszEnd)) pszEnd++; if(*pszEnd == L';') pszEnd++; else bOk = false; b = wcstol(pszEnd, &pszEnd, 10); if(pb) *pb = b; while(iswspace(*pszEnd)) pszEnd++; if(*pszEnd) bOk = false; VariantClear(&val); return bOk;}
开发者ID:LM25TTD,项目名称:ATCMcontrol_Engineering,代码行数:38,
示例7: unify_uri_authority_componentsstatic intunify_uri_authority_components(term_t components, size_t len, const pl_wchar_t *s){ const pl_wchar_t *end = &s[len]; const pl_wchar_t *e; range user = {0}; range passwd = {0}; range host = {0}; range port = {0}; term_t t = PL_new_term_refs(5); term_t av = t+1; if ( (e=skip_not(s, end, L"@")) && e<end ) { user.start = s; user.end = e; s = e+1; if ( (e=skip_not(user.start, user.end, L":")) && e<user.end ) { passwd.start = e+1; passwd.end = user.end; user.end = e; } } host.start = s; host.end = skip_not(s, end, L":"); if ( host.end < end ) { port.start = host.end+1; port.end = end; } if ( user.start ) unify_decoded_atom(av+0, &user, ESC_USER); if ( passwd.start ) unify_decoded_atom(av+1, &passwd, ESC_PASSWD); unify_decoded_atom(av+2, &host, ESC_HOST); if ( port.start ) { wchar_t *ep; long pn = wcstol(port.start, &ep, 10); if ( ep == port.end ) { if ( !PL_put_integer(av+3, pn) ) return FALSE; } else { unify_decoded_atom(av+3, &port, ESC_PORT); } } return (PL_cons_functor_v(t, FUNCTOR_uri_authority4, av) && PL_unify(components, t));}
开发者ID:lamby,项目名称:pkg-swi-prolog,代码行数:49,
示例8: CS_strtollong32_t EXP_LVL9 CS_strtol (Const char *ptr,char **endPtr,int base){#ifdef __WINCE__ wchar_t *wEndPtr; long32_t rtnValue; wchar_t wAscii [64]; mbstowcs (wAscii,ptr,64); rtnValue = (long32_t)wcstol (wAscii,&wEndPtr,base); *endPtr = (char *)ptr + (wEndPtr - wAscii); return rtnValue;#else /* time is ANSI standard, so this part is easy. */ return (long32_t)strtol (ptr,endPtr,base);#endif}
开发者ID:asir6,项目名称:Colt,代码行数:15,
示例9: ParseSizeStringbool ParseSizeString(LPCWSTR lpszSize, CUISize& Size){ LPWSTR pstr = NULL; // // parse x // Size.cx = wcstol(lpszSize, &pstr, 10); if (pstr == NULL && *pstr != L','){ return false; } // // parse y // Size.cy = wcstol(pstr + 1, &pstr, 10); if (pstr == NULL){ return false; } return true;}
开发者ID:asdlei00,项目名称:gtkduilib,代码行数:24,
示例10: wcstolTimeDelta SampleModePrefUI::GetSampleInterval() const { int time_value = wcstol(sample_interval_edit_->GetText(), NULL, 10); TimeScale scale = static_cast<TimeScale>(sample_interval_combo_->GetCurSel()); switch (scale) { case SECOND: return TimeDelta::FromSeconds(time_value); case MINUTE: return TimeDelta::FromMinutes(time_value); case HOUR: return TimeDelta::FromHours(time_value); case DAY: return TimeDelta::FromDays(time_value); } return TimeDelta::Max();}
开发者ID:liuxiong332,项目名称:IRCamera,代码行数:15,
示例11: GetLimit //----------------------------------------------------------------------------// Function: GetLimit//// Description:// Get the resource limit value in long type given the command line argument.//// Returns:// TRUE: If successfully get the value// FALSE: otherwisestatic BOOL GetLimit(__in const wchar_t *str, __out long *value){ wchar_t *end = NULL; if (str == NULL || value == NULL) return FALSE; *value = wcstol(str, &end, 10); if (end == NULL || *end != '/0') { *value = -1; return FALSE; } else { return TRUE; }}
开发者ID:tejala30,项目名称:ADS_Hadoop,代码行数:24,
示例12: cmdHelpMsgINT cmdHelpMsg(INT argc, WCHAR **argv){ LPWSTR endptr; LPWSTR lpBuffer; LONG errNum; INT i; if (argc < 3) { PrintResourceString(IDS_HELPMSG_SYNTAX); return 1; } for (i = 2; i < argc; i++) { if (_wcsicmp(argv[i], L"/help") == 0) { PrintResourceString(IDS_HELPMSG_HELP); return 1; } } errNum = wcstol(argv[2], &endptr, 10); if (*endptr != 0) { PrintResourceString(IDS_HELPMSG_SYNTAX); return 1; } /* Unicode printing is not supported in ReactOS yet */ if (FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, errNum, LANG_USER_DEFAULT, (LPWSTR)&lpBuffer, 0, NULL)) { printf("/n%S/n", lpBuffer); LocalFree(lpBuffer); } else { printf("Unrecognized error code: %ld/n", errNum); } return 0;}
开发者ID:Nevermore2015,项目名称:reactos,代码行数:48,
示例13: switch // SingleRegWatcher INT_PTR CALLBACK SingleRegWatcher::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ switch(uMsg){ case WM_INITDIALOG: { // Create subclass of edit box function SetWindowSubclass(GetDlgItem(hWnd, IDC_REGVALUE), &EditSubclassProc, m_editSubclassID, NULL); } break; case WM_CLOSE: { RemoveWindowSubclass(GetDlgItem(hWnd, IDC_REGVALUE), &EditSubclassProc, m_editSubclassID); break; } case WM_ENABLE: EnableWindow(GetDlgItem(hWnd, IDC_REGVALUE), (BOOL)wParam); break; case H86_UPDATE_SYS_DATA: { Mutex sysMutex((void*)wParam); sys_state_ptr sysState=(sys_state_ptr)lParam; sysMutex.Lock(); nsEmulator::Emulator* e=nsEmulator::Emulator::GetInstance(); uint16 val=e->ReadReg(m_regNum); wchar_t data[5]; _itow((uint32)val, data, 16); SetDlgItemText(hWnd, IDC_REGVALUE, data); sysMutex.Unlock(); } break; case H86_USER_INPUT: { sys_state_ptr sysState=(sys_state_ptr)lParam; nsEmulator::Emulator* e=nsEmulator::Emulator::GetInstance(); wchar_t data[5]; GetDlgItemText(hWnd, IDC_REGVALUE, data, 5); uint16 val=wcstol(data, NULL, 16); e->WriteReg(m_regNum, val); } break; default: return 0; } return 0; }
开发者ID:zsteve,项目名称:hard86,代码行数:49,
示例14: OpenProcessAndInjectint OpenProcessAndInject(wchar_t *processId) { HANDLE hProcess = (HANDLE)wcstol(processId, nullptr, 0); if (hProcess == NULL) { printf("Failed to get process handle/n"); return -1; } if (!InjectOpenVR(hProcess) || !InjectLibRevive(hProcess)) { return -1; } printf("Injected dlls succesfully/n"); return 0;}
开发者ID:Wesley1000070,项目名称:Revive,代码行数:16,
示例15: GetConfigDWORDstatic DWORD GetConfigDWORD(LPCWSTR wzName, DWORD dwDefault){ WRAPPER_CONTRACT; WCHAR wzValue[16]; DWORD dwValue; if (PAL_FetchConfigurationString(TRUE, wzName, wzValue, sizeof(wzValue) / sizeof(WCHAR))) { LPWSTR pEnd; dwValue = wcstol(wzValue, &pEnd, 16); // treat it has hex if (pEnd != wzValue) // success return dwValue; } return dwDefault;}
开发者ID:Anupam-,项目名称:shared-source-cli-2.0,代码行数:16,
示例16: wcslenLONG UsbDeviceList::FindNextInterfaceFilterField(LPCWSTR str, DWORD offset, LPDWORD nextOffset, LPINTERFACE_FILTER_FIELD field){ // Initialise field to match-all (*) field->match = TRUE; field->value = USB_NO_INFO; (*nextOffset) = offset; for (DWORD i = offset; i <= wcslen(str); i++) { // Field is terminated by ':', ';' or end of string if (str[i] == ':' || str[i] == ';' || str[i] == '/0') { // Represent ';' as reaching end of string (only flags occur after // this seperator) if (str[i] == ';') { (*nextOffset) = wcslen(str) + 1; } else { (*nextOffset) = i + 1; } LONG result = ERROR_SUCCESS; // Empty fields are disallowed // Fields may contain '*' or a base 10 value (possibly prepended with '!' // to invert match). if (i == offset) { // Invalid (empty field) result = ERROR_INVALID_PARAMETER; } else if (!(i == offset + 1 && str[offset] == '*')) { // Field contains base 10 value wchar_t* endptr = NULL; if (str[offset] == '!') { field->match = FALSE; offset++; } field->value = wcstol(&str[offset], &endptr, 10); if (endptr == &str[offset] || (endptr[0] != ':' && endptr[0] != ';' && endptr[0] != '/0')) { result = ERROR_INVALID_PARAMETER; } } return result; } } // Offset beyond end of string (this may occur if we're looking // for optional fields that are not present). return ERROR_INVALID_PARAMETER;}
开发者ID:dsdwew,项目名称:CEUSBKWrapper,代码行数:47,
示例17: StatusCodeAnalysisbool Inet::StatusCodeAnalysis(wstring sctext,int* res){ int i,n,pos; wchar_t *err; if(pos=sctext.find(' ')==wstring::npos){ return false; } sctext.erase(0,pos+1); if(pos=sctext.find(' ')==wstring::npos){ return false; } sctext.erase(pos); *res=wcstol(sctext.c_str(),&err,10); if(lstrlen(err)!=0){ return false; } return true;}
开发者ID:tiku,项目名称:test,代码行数:17,
示例18: DIB_CreateWindowint DIB_CreateWindow(_THIS){ char *windowid = SDL_getenv("SDL_WINDOWID"); SDL_RegisterApp(NULL, 0, 0); SDL_windowid = (windowid != NULL); if ( SDL_windowid ) {#if defined(_WIN32_WCE) && (_WIN32_WCE < 300) /* wince 2.1 does not have strtol */ wchar_t *windowid_t = SDL_malloc((SDL_strlen(windowid) + 1) * sizeof(wchar_t)); MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, windowid, -1, windowid_t, SDL_strlen(windowid) + 1); SDL_Window = (HWND)wcstol(windowid_t, NULL, 0); SDL_free(windowid_t);#else SDL_Window = (HWND)SDL_strtoull(windowid, NULL, 0);#endif if ( SDL_Window == NULL ) { SDL_SetError("Couldn't get user specified window"); return(-1); } /* DJM: we want all event's for the user specified window to be handled by SDL. */ userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWLP_WNDPROC); SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)WinMessage); } else { SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, SDL_Instance, NULL); if ( SDL_Window == NULL ) { SDL_SetError("Couldn't create window"); return(-1); } ShowWindow(SDL_Window, SW_HIDE); } /* JC 14 Mar 2006 Flush the message loop or this can cause big problems later Especially if the user decides to use dialog boxes or assert()! */ WIN_FlushMessageQueue(); return(0);}
开发者ID:BITINT,项目名称:DEFCON2,代码行数:46,
示例19: DisplayInforMessageBoxbool CFanmotorDlg::GetActiveDevice(BYTE& DeviceAddress){ DeviceAddress = 255; CListBox* listBoxDevices = (CListBox*)GetDlgItem(IDC_DEVICE_LISTBOX); listBoxDevices->SetCurSel(0); if (listBoxDevices->GetCurSel() < 0) { DisplayInforMessageBox((LPCWSTR)L"Error", L"Select Active DEVICE!/r/nPress /"Device List/" button and Select Device"); return false; } CString s; int n = listBoxDevices->GetTextLen(listBoxDevices->GetCurSel()); WCHAR *ch, *buf = s.GetBuffer(n); listBoxDevices->GetText(listBoxDevices->GetCurSel(), buf); DeviceAddress = (BYTE)wcstol(buf,&ch,16); s.ReleaseBuffer(); return true;}
开发者ID:ChenChengCC,项目名称:test2,代码行数:17,
示例20: sizeofBOOL TRegistry::GetLongW(const WCHAR *subKey, long *val){ DWORD type = REG_DWORD, dw_size = sizeof(long); if (::RegQueryValueExW(hKey[openCnt -1], subKey, 0, &type, (BYTE *)val, &dw_size) == ERROR_SUCCESS) { return TRUE; }// 昔の互 C++ wcstombs函数代码示例 C++ wcstok函数代码示例
|