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


C++ wxStrlcpy函数代码示例

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


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

示例1: wxGetEmailAddress

// Get Full RFC822 style email address
bool wxGetEmailAddress(wxChar *address, int maxSize)
{
    wxString email = wxGetEmailAddress();
    if ( !email )
        return false;

    wxStrlcpy(address, email.t_str(), maxSize);

    return true;
}
开发者ID:Aced14,项目名称:pcsx2,代码行数:11,代码来源:utilscmn.cpp

示例2: memset

bool 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,代码来源:taskbarbutton.cpp

示例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,代码来源:utilsdos.cpp

示例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,代码来源:utilsdos.cpp

示例5: wxGetUserId

bool 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,代码来源:utilsunx.cpp

示例6: wxStrlcpy

void 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,代码来源:fontenum.cpp

示例7: buf

bool 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,代码来源:sckaddr.cpp

示例8: wxStrlcpy

// debugger helper: this function can be called from a debugger to show what
// the date really is
extern 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,代码来源:fontcmn.cpp

示例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,代码来源:utils.cpp

示例10: wxTaskBarIconWindow

// Operations
bool 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, &notifyData) != 0;

    if ( !ok )
    {
        wxLogLastError(wxT("Shell_NotifyIcon(NIM_MODIFY/ADD)"));
    }

    if ( !m_iconAdded && ok )
        m_iconAdded = true;

    return ok;
}
开发者ID:EEmmanuel7,项目名称:wxWidgets,代码行数:43,代码来源:taskbar.cpp

示例11: wxTestFontEncoding

bool 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,代码来源:fontutil.cpp

示例12: wxGetUserName

bool 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,代码来源:utilsunx.cpp

示例13: wxStrlcpy

void 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,代码来源:fontenum.cpp

示例14: notifyData

// Operations
bool 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, &notifyData) != 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,代码来源:gcTaskBar.cpp

示例15: wxT

// debugger helper: this function can be called from a debugger to show what
// the date really is
extern 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,代码来源:fontcmn.cpp


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