这篇教程C++ wxStrlcpy函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wxStrlcpy函数的典型用法代码示例。如果您正苦于以下问题:C++ wxStrlcpy函数的具体用法?C++ wxStrlcpy怎么用?C++ wxStrlcpy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wxStrlcpy函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: wxGetEmailAddress// Get Full RFC822 style email addressbool wxGetEmailAddress(wxChar *address, int maxSize){ wxString email = wxGetEmailAddress(); if ( !email ) return false; wxStrlcpy(address, email.t_str(), maxSize); return true;}
开发者ID:Aced14,项目名称:pcsx2,代码行数:11,
示例2: memsetbool wxTaskBarButtonImpl::InitOrUpdateThumbBarButtons(){ THUMBBUTTON buttons[MAX_BUTTON_COUNT]; HRESULT hr; for ( size_t i = 0; i < MAX_BUTTON_COUNT; ++i ) { memset(&buttons[i], 0, sizeof buttons[i]); buttons[i].iId = i; buttons[i].dwFlags = THBF_HIDDEN; buttons[i].dwMask = static_cast<THUMBBUTTONMASK>(THB_FLAGS); } for ( size_t i = 0; i < m_thumbBarButtons.size(); ++i ) { buttons[i].hIcon = GetHiconOf(m_thumbBarButtons[i]->GetIcon()); buttons[i].dwFlags = GetNativeThumbButtonFlags(*m_thumbBarButtons[i]); buttons[i].dwMask = static_cast<THUMBBUTTONMASK>(THB_ICON | THB_FLAGS); wxString tooltip = m_thumbBarButtons[i]->GetTooltip(); if ( tooltip.empty() ) continue; // Truncate the tooltip if its length longer than szTip(THUMBBUTTON) // allowed length (260). tooltip.Truncate(260); wxStrlcpy(buttons[i].szTip, tooltip.t_str(), tooltip.length()); buttons[i].dwMask = static_cast<THUMBBUTTONMASK>(buttons[i].dwMask | THB_TOOLTIP); } if ( !m_hasInitThumbnailToolbar ) { hr = m_taskbarList->ThumbBarAddButtons(m_parent->GetHWND(), MAX_BUTTON_COUNT, buttons); if ( FAILED(hr) ) { wxLogApiError(wxT("ITaskbarList3::ThumbBarAddButtons"), hr); } m_hasInitThumbnailToolbar = true; } else { hr = m_taskbarList->ThumbBarUpdateButtons(m_parent->GetHWND(), MAX_BUTTON_COUNT, buttons); if ( FAILED(hr) ) { wxLogApiError(wxT("ITaskbarList3::ThumbBarUpdateButtons"), hr); } } return SUCCEEDED(hr);}
开发者ID:EEmmanuel7,项目名称:wxWidgets,代码行数:54,
示例3: wxGetUserId// returns %UserName%, $USER or just "user"//bool wxGetUserId(wxChar *buf, int n){ const wxChar *user = wxGetenv(wxT("UserName")); if (!user) user = wxGetenv(wxT("USER")); if (!user) user = wxT("user"); wxStrlcpy(buf, user, n); return true;}
开发者ID:yinglang,项目名称:newton-dynamics,代码行数:15,
示例4: wxGetHostName// returns %ComputerName%, or $HOSTNAME, or "host"//bool wxGetHostName(wxChar *buf, int n){ const wxChar *host = wxGetenv(wxT("ComputerName")); if (!host) host = wxGetenv(wxT("HOSTNAME")); if (!host) host = wxT("host"); wxStrlcpy(buf, host, n); return true;}
开发者ID:yinglang,项目名称:newton-dynamics,代码行数:15,
示例5: wxGetUserIdbool wxGetUserId(wxChar *buf, int sz){ struct passwd *who; *buf = wxT('/0'); if ((who = getpwuid(getuid ())) != NULL) { wxStrlcpy (buf, wxSafeConvertMB2WX(who->pw_name), sz); return true; } return false;}
开发者ID:ahlekoofe,项目名称:gamekit,代码行数:13,
示例6: wxStrlcpyvoid wxFontEnumeratorHelper::DoEnumerate(){ HDC hDC = ::GetDC(NULL); LOGFONT lf; lf.lfCharSet = (BYTE)m_charset; wxStrlcpy(lf.lfFaceName, m_facename.c_str(), WXSIZEOF(lf.lfFaceName)); lf.lfPitchAndFamily = 0; ::EnumFontFamiliesEx(hDC, &lf, (FONTENUMPROC)wxFontEnumeratorProc, (LPARAM)this, 0 /* reserved */) ; ::ReleaseDC(NULL, hDC);}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:13,
示例7: bufbool wxSockAddressImpl::SetPath(const wxString& path){ sockaddr_un * const addr = Get<sockaddr_un>(); if ( !addr ) return false; const wxScopedCharBuffer buf(path.utf8_str()); if ( strlen(buf) >= UNIX_PATH_MAX ) return false; wxStrlcpy(addr->sun_path, buf, UNIX_PATH_MAX); return true;}
开发者ID:FuTingyan,项目名称:wxWidgets,代码行数:14,
示例8: wxStrlcpy// debugger helper: this function can be called from a debugger to show what// the date really isextern const char *wxDumpFont(const wxFont *font){ static char buf[256]; wxString s; s.Printf(wxS("%s-%d-%s-%.2f-%d"), font->GetFaceName(), font->GetNumericWeight(), font->GetStyle() == wxFONTSTYLE_NORMAL ? "regular" : "italic", font->GetFractionalPointSize(), font->GetEncoding()); wxStrlcpy(buf, s.mb_str(), WXSIZEOF(buf)); return buf;}
开发者ID:catalinr,项目名称:wxWidgets,代码行数:17,
示例9: wxGetHostName// Get full hostname (eg. DoDo.BSn-Germany.crg.de)bool wxGetHostName( wxChar* zBuf, int nMaxSize ){ if (!zBuf) return false;#if defined(wxUSE_NET_API) && wxUSE_NET_API char zServer[256]; char zComputer[256]; unsigned long ulLevel = 0; unsigned char* zBuffer = NULL; unsigned long ulBuffer = 256; unsigned long* pulTotalAvail = NULL; NetBios32GetInfo( (const unsigned char*)zServer ,(const unsigned char*)zComputer ,ulLevel ,zBuffer ,ulBuffer ,pulTotalAvail ); strcpy(zBuf, zServer);#else wxChar* zSysname; const wxChar* zDefaultHost = _T("noname"); if ((zSysname = wxGetenv(_T("SYSTEM_NAME"))) == NULL && (zSysname = wxGetenv(_T("HOSTNAME"))) == NULL) { ::PrfQueryProfileString( HINI_PROFILE ,(PSZ)WX_SECTION ,(PSZ)eHOSTNAME ,(PSZ)zDefaultHost ,(void*)zBuf ,(ULONG)nMaxSize - 1 ); zBuf[nMaxSize] = _T('/0'); } else { wxStrlcpy(zBuf, zSysname, nMaxSize); }#endif return *zBuf ? true : false;}
开发者ID:jonntd,项目名称:dynamica,代码行数:45,
示例10: wxTaskBarIconWindow// Operationsbool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip){ // NB: we have to create the window lazily because of backward compatibility, // old applications may create a wxTaskBarIcon instance before wxApp // is initialized (as samples/taskbar used to do) if (!m_win) { m_win = new wxTaskBarIconWindow(this); } m_icon = icon; m_strTooltip = tooltip; NotifyIconData notifyData(GetHwndOf(m_win)); if (icon.IsOk()) { notifyData.uFlags |= NIF_ICON; notifyData.hIcon = GetHiconOf(icon); } // set NIF_TIP even for an empty tooltip: otherwise it would be impossible // to remove an existing tooltip using this function notifyData.uFlags |= NIF_TIP; if ( !tooltip.empty() ) { wxStrlcpy(notifyData.szTip, tooltip.t_str(), WXSIZEOF(notifyData.szTip)); } bool ok = Shell_NotifyIcon(m_iconAdded ? NIM_MODIFY : NIM_ADD, ¬ifyData) != 0; if ( !ok ) { wxLogLastError(wxT("Shell_NotifyIcon(NIM_MODIFY/ADD)")); } if ( !m_iconAdded && ok ) m_iconAdded = true; return ok;}
开发者ID:EEmmanuel7,项目名称:wxWidgets,代码行数:43,
示例11: wxTestFontEncodingbool wxTestFontEncoding(const wxNativeEncodingInfo& info){ // try to create such font LOGFONT lf; wxZeroMemory(lf); // all default values lf.lfCharSet = (BYTE)info.charset; wxStrlcpy(lf.lfFaceName, info.facename.c_str(), WXSIZEOF(lf.lfFaceName)); HFONT hfont = ::CreateFontIndirect(&lf); if ( !hfont ) { // no such font return false; } ::DeleteObject((HGDIOBJ)hfont); return true;}
开发者ID:Richard-Ni,项目名称:wxWidgets,代码行数:20,
示例12: wxGetUserNamebool wxGetUserName(wxChar *buf, int sz){#ifdef HAVE_PW_GECOS struct passwd *who; *buf = wxT('/0'); if ((who = getpwuid (getuid ())) != NULL) { char *comma = strchr(who->pw_gecos, ','); if (comma) *comma = '/0'; // cut off non-name comment fields wxStrlcpy(buf, wxSafeConvertMB2WX(who->pw_gecos), sz); return true; } return false;#else // !HAVE_PW_GECOS return wxGetUserId(buf, sz);#endif // HAVE_PW_GECOS/!HAVE_PW_GECOS}
开发者ID:ahlekoofe,项目名称:gamekit,代码行数:20,
示例13: wxStrlcpyvoid wxFontEnumeratorHelper::DoEnumerate(){#ifndef __WXMICROWIN__ HDC hDC = ::GetDC(NULL);#ifdef __WXWINCE__ ::EnumFontFamilies(hDC, m_facename.empty() ? NULL : m_facename.wx_str(), (wxFONTENUMPROC)wxFontEnumeratorProc, (LPARAM)this) ;#else // __WIN32__ LOGFONT lf; lf.lfCharSet = (BYTE)m_charset; wxStrlcpy(lf.lfFaceName, m_facename.c_str(), WXSIZEOF(lf.lfFaceName)); lf.lfPitchAndFamily = 0; ::EnumFontFamiliesEx(hDC, &lf, (wxFONTENUMPROC)wxFontEnumeratorProc, (LPARAM)this, 0 /* reserved */) ;#endif // Win32/CE ::ReleaseDC(NULL, hDC);#endif}
开发者ID:beanhome,项目名称:dev,代码行数:22,
示例14: notifyData// Operationsbool gcTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip){#ifdef WIN32 m_icon = icon; m_strTooltip = tooltip; NotifyIconData notifyData(GetHwndOf(m_win)); if (icon.Ok()) { notifyData.uFlags |= NIF_ICON; notifyData.hIcon = GetHiconOf(icon); } // set NIF_TIP even for an empty tooltip: otherwise it would be impossible // to remove an existing tooltip using this function notifyData.uFlags |= NIF_TIP; if ( !tooltip.empty() ) { wxStrlcpy(notifyData.szTip, tooltip.wx_str(), WXSIZEOF(notifyData.szTip)); } bool ok = wxShellNotifyIcon(m_iconAdded ? NIM_MODIFY : NIM_ADD, ¬ifyData) != 0; if ( !ok ) { wxLogLastError(wxT("wxShellNotifyIcon(NIM_MODIFY/ADD)")); } if ( !m_iconAdded && ok ) m_iconAdded = true; return ok;#else return wxTaskBarIcon::SetIcon(icon, tooltip);#endif}
开发者ID:Mailaender,项目名称:Desurium,代码行数:39,
示例15: wxT// debugger helper: this function can be called from a debugger to show what// the date really isextern const char *wxDumpFont(const wxFont *font){ static char buf[256]; const wxFontWeight weight = font->GetWeight(); wxString s; s.Printf(wxS("%s-%s-%s-%d-%d"), font->GetFaceName(), weight == wxFONTWEIGHT_NORMAL ? wxT("normal") : weight == wxFONTWEIGHT_BOLD ? wxT("bold") : wxT("light"), font->GetStyle() == wxFONTSTYLE_NORMAL ? wxT("regular") : wxT("italic"), font->GetPointSize(), font->GetEncoding()); wxStrlcpy(buf, s.mb_str(), WXSIZEOF(buf)); return buf;}
开发者ID:Annovae,项目名称:Dolphin-Core,代码行数:25,
示例16: wxGetHostName// Get hostname only (without domain name)bool wxGetHostName(wxChar *buf, int maxSize){#if defined(__WXWINCE__) // GetComputerName() is not supported but the name seems to be stored in // this location in the registry, at least for PPC2003 and WM5 wxString hostName; wxRegKey regKey(wxRegKey::HKLM, wxT("Ident")); if ( !regKey.HasValue(wxT("Name")) || !regKey.QueryValue(wxT("Name"), hostName) ) return false; wxStrlcpy(buf, hostName.t_str(), maxSize);#else // !__WXWINCE__ DWORD nSize = maxSize; if ( !::GetComputerName(buf, &nSize) ) { wxLogLastError(wxT("GetComputerName")); return false; }#endif // __WXWINCE__/!__WXWINCE__ return true;}
开发者ID:jonfoster,项目名称:wxWidgets,代码行数:25,
示例17: wxGetFullHostName// get full hostname (with domain name if possible)bool wxGetFullHostName(wxChar *buf, int maxSize){#if wxUSE_DYNLIB_CLASS && wxUSE_SOCKETS // TODO should use GetComputerNameEx() when available // we don't want to always link with Winsock DLL as we might not use it at // all, so load it dynamically here if needed (and don't complain if it is // missing, we handle this) wxLogNull noLog; wxDynamicLibrary dllWinsock(wxT("ws2_32.dll"), wxDL_VERBATIM); if ( dllWinsock.IsLoaded() ) { typedef int (PASCAL *WSAStartup_t)(WORD, WSADATA *); typedef int (PASCAL *gethostname_t)(char *, int); typedef hostent* (PASCAL *gethostbyname_t)(const char *); typedef hostent* (PASCAL *gethostbyaddr_t)(const char *, int , int); typedef int (PASCAL *WSACleanup_t)(void); #define LOAD_WINSOCK_FUNC(func) / func ## _t / pfn ## func = (func ## _t)dllWinsock.GetSymbol(wxT(#func)) LOAD_WINSOCK_FUNC(WSAStartup); WSADATA wsa; if ( pfnWSAStartup && pfnWSAStartup(MAKEWORD(1, 1), &wsa) == 0 ) { LOAD_WINSOCK_FUNC(gethostname); wxString host; if ( pfngethostname ) { char bufA[256]; if ( pfngethostname(bufA, WXSIZEOF(bufA)) == 0 ) { // gethostname() won't usually include the DNS domain name, // for this we need to work a bit more if ( !strchr(bufA, '.') ) { LOAD_WINSOCK_FUNC(gethostbyname); struct hostent *pHostEnt = pfngethostbyname ? pfngethostbyname(bufA) : NULL; if ( pHostEnt ) { // Windows will use DNS internally now LOAD_WINSOCK_FUNC(gethostbyaddr); pHostEnt = pfngethostbyaddr ? pfngethostbyaddr(pHostEnt->h_addr, 4, AF_INET) : NULL; } if ( pHostEnt ) { host = pHostEnt->h_name; } } } } LOAD_WINSOCK_FUNC(WSACleanup); if ( pfnWSACleanup ) pfnWSACleanup(); if ( !host.empty() ) { wxStrlcpy(buf, host.c_str(), maxSize); return true; } } }#endif // wxUSE_DYNLIB_CLASS && wxUSE_SOCKETS return wxGetHostName(buf, maxSize);}
开发者ID:jonfoster,项目名称:wxWidgets,代码行数:83,
示例18: wxMSW_CONV_LPTSTRbool wxWindowsPrintNativeData::TransferFrom( const wxPrintData &data ){ WinPrinter printer; LPTSTR szPrinterName = wxMSW_CONV_LPTSTR(data.GetPrinterName()); if (!m_devMode) InitializeDevMode(data.GetPrinterName(), &printer); HGLOBAL hDevMode = static_cast<HGLOBAL>(m_devMode); if ( hDevMode ) { GlobalPtrLock lockDevMode(hDevMode); DEVMODE * const devMode = static_cast<DEVMODE *>(lockDevMode.Get()); //// Orientation devMode->dmOrientation = (short)data.GetOrientation(); //// Collation devMode->dmCollate = (data.GetCollate() ? DMCOLLATE_TRUE : DMCOLLATE_FALSE); devMode->dmFields |= DM_COLLATE; //// Number of copies devMode->dmCopies = (short)data.GetNoCopies(); devMode->dmFields |= DM_COPIES; //// Printer name wxString name = data.GetPrinterName(); if (!name.empty()) { // NB: the cast is needed in the ANSI build, strangely enough // dmDeviceName is BYTE[] and not char[] there wxStrlcpy(reinterpret_cast<wxChar *>(devMode->dmDeviceName), name.t_str(), WXSIZEOF(devMode->dmDeviceName)); } //// Colour if (data.GetColour()) devMode->dmColor = DMCOLOR_COLOR; else devMode->dmColor = DMCOLOR_MONOCHROME; devMode->dmFields |= DM_COLOR; //// Paper size // Paper id has priority over paper size. If id is specified, then size // is ignored (as it can be filled in even for standard paper sizes) wxPrintPaperType *paperType = NULL; const wxPaperSize paperId = data.GetPaperId(); if ( paperId != wxPAPER_NONE && wxThePrintPaperDatabase ) { paperType = wxThePrintPaperDatabase->FindPaperType(paperId); } if ( paperType ) { devMode->dmPaperSize = (short)paperType->GetPlatformId(); devMode->dmFields |= DM_PAPERSIZE; } else // custom (or no) paper size { const wxSize paperSize = data.GetPaperSize(); if ( paperSize != wxDefaultSize ) { // Fall back on specifying the paper size explicitly if(m_customWindowsPaperId != 0) devMode->dmPaperSize = m_customWindowsPaperId; else devMode->dmPaperSize = DMPAPER_USER; devMode->dmPaperWidth = (short)(paperSize.x * 10); devMode->dmPaperLength = (short)(paperSize.y * 10); devMode->dmFields |= DM_PAPERWIDTH; devMode->dmFields |= DM_PAPERLENGTH; // A printer driver may or may not also want DM_PAPERSIZE to // be specified. Also, if the printer driver doesn't implement the DMPAPER_USER // size, then this won't work, and even if you found the correct id by // enumerating the driver's paper sizes, it probably won't change the actual size, // it'll just select that custom paper type with its own current setting. // For a discussion on this, see http://www.codeguru.com/forum/showthread.php?threadid=458617 // Although m_customWindowsPaperId is intended to work around this, it's // unclear how it can help you set the custom paper size programmatically. } //else: neither paper type nor size specified, don't fill DEVMODE // at all so that the system defaults are used } //// Duplex short duplex; switch (data.GetDuplex()) { case wxDUPLEX_HORIZONTAL: duplex = DMDUP_HORIZONTAL; break; case wxDUPLEX_VERTICAL: duplex = DMDUP_VERTICAL; break;//.........这里部分代码省略.........
开发者ID:mael15,项目名称:wxWidgets,代码行数:101,
示例19: wxStrlcpy/* static */void wxCrashReport::SetFileName(const wxString& filename){ wxStrlcpy(gs_reportFilename, filename.wx_str(), WXSIZEOF(gs_reportFilename));}
开发者ID:BloodRedd,项目名称:gamekit,代码行数:5,
示例20: wxGetUserName// Get user name e.g. Julian Smartbool wxGetUserName(wxChar *buf, int maxSize){ wxCHECK_MSG( buf && ( maxSize > 0 ), false, wxT("empty buffer in wxGetUserName") );#if defined(__WXWINCE__) && wxUSE_REGKEY wxLogNull noLog; wxRegKey key(wxRegKey::HKCU, wxT("ControlPanel//Owner")); if(!key.Open(wxRegKey::Read)) return false; wxString name; if(!key.QueryValue(wxT("Owner"),name)) return false; wxStrlcpy(buf, name.c_str(), maxSize); return true;#elif defined(USE_NET_API) CHAR szUserName[256]; if ( !wxGetUserId(szUserName, WXSIZEOF(szUserName)) ) return false; // TODO how to get the domain name? CHAR *szDomain = ""; // the code is based on the MSDN example (also see KB article Q119670) WCHAR wszUserName[256]; // Unicode user name WCHAR wszDomain[256]; LPBYTE ComputerName; USER_INFO_2 *ui2; // User structure // Convert ANSI user name and domain to Unicode MultiByteToWideChar( CP_ACP, 0, szUserName, strlen(szUserName)+1, wszUserName, WXSIZEOF(wszUserName) ); MultiByteToWideChar( CP_ACP, 0, szDomain, strlen(szDomain)+1, wszDomain, WXSIZEOF(wszDomain) ); // Get the computer name of a DC for the domain. if ( NetGetDCName( NULL, wszDomain, &ComputerName ) != NERR_Success ) { wxLogError(wxT("Cannot find domain controller")); goto error; } // Look up the user on the DC NET_API_STATUS status = NetUserGetInfo( (LPWSTR)ComputerName, (LPWSTR)&wszUserName, 2, // level - we want USER_INFO_2 (LPBYTE *) &ui2 ); switch ( status ) { case NERR_Success: // ok break; case NERR_InvalidComputer: wxLogError(wxT("Invalid domain controller name.")); goto error; case NERR_UserNotFound: wxLogError(wxT("Invalid user name '%s'."), szUserName); goto error; default: wxLogSysError(wxT("Can't get information about user")); goto error; } // Convert the Unicode full name to ANSI WideCharToMultiByte( CP_ACP, 0, ui2->usri2_full_name, -1, buf, maxSize, NULL, NULL ); return true;error: wxLogError(wxT("Couldn't look up full user name.")); return false;#else // !USE_NET_API // Could use NIS, MS-Mail or other site specific programs // Use wxWidgets configuration data bool ok = GetProfileString(WX_SECTION, eUSERNAME, wxEmptyString, buf, maxSize - 1) != 0; if ( !ok ) { ok = wxGetUserId(buf, maxSize); } if ( !ok ) { wxStrlcpy(buf, wxT("Unknown User"), maxSize); } return true;#endif // Win32/16}
开发者ID:jonfoster,项目名称:wxWidgets,代码行数:98,
示例21: definedbool gcTaskBarIcon::ShowBalloon(const wxString& title, const wxString& text, unsigned msec, int flags){#if defined(WIN32) wxCHECK_MSG( m_iconAdded, false, _T("can't be used before the icon is created") ); const HWND hwnd = GetHwndOf(m_win); // we need to enable version 5.0 behaviour to receive notifications about // the balloon disappearance NotifyIconData notifyData(hwnd); notifyData.uFlags = 0; notifyData.uVersion = 3 /* NOTIFYICON_VERSION for Windows XP */; if ( !wxShellNotifyIcon(NIM_SETVERSION, ¬ifyData) ) { wxLogLastError(wxT("wxShellNotifyIcon(NIM_SETVERSION)")); } // do show the balloon now notifyData = NotifyIconData(hwnd); notifyData.uFlags |= NIF_INFO; notifyData.uTimeout = msec; wxStrlcpy(notifyData.szInfo, text.wx_str(), WXSIZEOF(notifyData.szInfo)); wxStrlcpy(notifyData.szInfoTitle, title.wx_str(), WXSIZEOF(notifyData.szInfoTitle)); if ( flags & wxICON_INFORMATION ) notifyData.dwInfoFlags |= NIIF_INFO; else if ( flags & wxICON_WARNING ) notifyData.dwInfoFlags |= NIIF_WARNING; else if ( flags & wxICON_ERROR ) notifyData.dwInfoFlags |= NIIF_ERROR; bool ok = wxShellNotifyIcon(NIM_MODIFY, ¬ifyData) != 0; if ( !ok ) { wxLogLastError(wxT("wxShellNotifyIcon(NIM_MODIFY)")); } return ok;#elif defined(NIX) const char* icon = NULL; if ( flags & wxICON_INFORMATION ) icon = "dialog-information"; else if ( flags & wxICON_WARNING ) icon = "dialog-warning"; else if ( flags & wxICON_ERROR ) icon = "dialog-error"; NotifyNotification* notification = notify_notification_new( title.c_str(), text.c_str(), icon); notify_notification_show(notification, NULL); return true;#else return false;#endif}
开发者ID:Mailaender,项目名称:Desurium,代码行数:64,
示例22: wxSysErrorCode// get error message from systemconst wxChar *wxSysErrorMsg(unsigned long nErrCode){ if ( nErrCode == 0 ) nErrCode = wxSysErrorCode();#if defined(__WXMSW__) && !defined(__WXMICROWIN__) static wxChar s_szBuf[1024]; // get error message from system LPVOID lpMsgBuf; if ( ::FormatMessage ( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, nErrCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL ) == 0 ) { // if this happens, something is seriously wrong, so don't use _() here // for safety wxSprintf(s_szBuf, wxS("unknown error %lx"), nErrCode); return s_szBuf; } // copy it to our buffer and free memory // Crashes on SmartPhone (FIXME)#if !defined(__SMARTPHONE__) /* of WinCE */ if( lpMsgBuf != 0 ) { wxStrlcpy(s_szBuf, (const wxChar *)lpMsgBuf, WXSIZEOF(s_szBuf)); LocalFree(lpMsgBuf); // returned string is capitalized and ended with '/r/n' - bad s_szBuf[0] = (wxChar)wxTolower(s_szBuf[0]); size_t len = wxStrlen(s_szBuf); if ( len > 0 ) { // truncate string if ( s_szBuf[len - 2] == wxS('/r') ) s_szBuf[len - 2] = wxS('/0'); } } else#endif // !__SMARTPHONE__ { s_szBuf[0] = wxS('/0'); } return s_szBuf;#else // !__WXMSW__ #if wxUSE_UNICODE static wchar_t s_wzBuf[1024]; wxConvCurrent->MB2WC(s_wzBuf, strerror((int)nErrCode), WXSIZEOF(s_wzBuf) - 1); return s_wzBuf; #else return strerror((int)nErrCode); #endif#endif // __WXMSW__/!__WXMSW__}
开发者ID:madnessw,项目名称:thesnow,代码行数:65,
示例23: wxOS2SelectMatchingFontByNamevoid wxOS2SelectMatchingFontByName( PFATTRS pFattrs, PFACENAMEDESC pFaceName, PFONTMETRICS pFM, int nNumFonts, const wxFont* pFont){ int i; int nPointSize; int nIs; int nMinDiff0; int anDiff[16]; int anMinDiff[16]; int nIndex = 0; wxChar zFontFaceName[FACESIZE]; wxString sFaceName; USHORT usWeightClass; int fsSelection = 0; nMinDiff0 = 0xf000; for(i = 0;i < 16; i++) anMinDiff[i] = nMinDiff0; switch (pFont->GetFamily()) { case wxSCRIPT: sFaceName = wxT("Tms Rmn"); break; case wxDECORATIVE: sFaceName = wxT("WarpSans"); break; case wxROMAN: sFaceName = wxT("Tms Rmn"); break; case wxTELETYPE: sFaceName = wxT("Courier") ; break; case wxMODERN: sFaceName = wxT("System VIO") ; break; case wxSWISS: sFaceName = wxT("Helv") ; break; case wxDEFAULT: default: sFaceName = wxT("System VIO") ; } switch (pFont->GetWeight()) { default: wxFAIL_MSG(wxT("unknown font weight")); // fall through usWeightClass = FWEIGHT_DONT_CARE; break; case wxNORMAL: usWeightClass = FWEIGHT_NORMAL; break; case wxLIGHT: usWeightClass = FWEIGHT_LIGHT; break; case wxBOLD: usWeightClass = FWEIGHT_BOLD; break; case wxFONTWEIGHT_MAX: usWeightClass = FWEIGHT_ULTRA_BOLD; break; } pFaceName->usWeightClass = usWeightClass; switch (pFont->GetStyle()) { case wxITALIC: case wxSLANT: fsSelection = FM_SEL_ITALIC; pFaceName->flOptions = FTYPE_ITALIC; break; default: wxFAIL_MSG(wxT("unknown font slant")); // fall through case wxNORMAL: fsSelection = 0; break; } wxStrlcpy(zFontFaceName, sFaceName.c_str(), WXSIZEOF(zFontFaceName)); nPointSize = pFont->GetPointSize();//.........这里部分代码省略.........
开发者ID:chromylei,项目名称:third_party,代码行数:101,
注:本文中的wxStrlcpy函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ wxStrlen函数代码示例 C++ wxStripMenuCodes函数代码示例 |