• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ wxDynamicLibrary类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: wxAssocQueryString

// Helper wrapping AssocQueryString() Win32 function: returns the value of the
// given associated string for the specified extension (which may or not have
// the leading period).
//
// Returns empty string if the association is not found.
static
wxString wxAssocQueryString(ASSOCSTR assoc,
                            wxString ext,
                            const wxString& verb = wxString())
{
    typedef HRESULT (WINAPI *AssocQueryString_t)(ASSOCF, ASSOCSTR,
                                                  LPCTSTR, LPCTSTR, LPTSTR,
                                                  DWORD *);
    static AssocQueryString_t s_pfnAssocQueryString = (AssocQueryString_t)-1;
    static wxDynamicLibrary s_dllShlwapi;

    if ( s_pfnAssocQueryString == (AssocQueryString_t)-1 )
    {
        if ( !s_dllShlwapi.Load(wxT("shlwapi.dll"), wxDL_VERBATIM | wxDL_QUIET) )
            s_pfnAssocQueryString = NULL;
        else
            wxDL_INIT_FUNC_AW(s_pfn, AssocQueryString, s_dllShlwapi);
    }

    if ( !s_pfnAssocQueryString )
        return wxString();


    DWORD dwSize = MAX_PATH;
    TCHAR bufOut[MAX_PATH] = { 0 };

    if ( ext.empty() || ext[0] != '.' )
        ext.Prepend('.');

    HRESULT hr = s_pfnAssocQueryString
                 (
                    wxASSOCF_NOTRUNCATE,// Fail if buffer is too small.
                    assoc,              // The association to retrieve.
                    ext.t_str(),        // The extension to retrieve it for.
                    verb.empty() ? NULL
                                 : static_cast<const TCHAR*>(verb.t_str()),
                    bufOut,             // The buffer for output value.
                    &dwSize             // And its size
                 );

    // Do not use SUCCEEDED() here as S_FALSE could, in principle, be returned
    // but would still be an error in this context.
    if ( hr != S_OK )
    {
        // The only really expected error here is that no association is
        // defined, anything else is not expected. The confusing thing is that
        // different errors are returned for this expected error under
        // different Windows versions: XP returns ERROR_FILE_NOT_FOUND while 7
        // returns ERROR_NO_ASSOCIATION. Just check for both to be sure.
        if ( hr != HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) &&
                hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) )
        {
            wxLogApiError("AssocQueryString", hr);
        }

        return wxString();
    }

    return wxString(bufOut);
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:65,代码来源:mimetype.cpp


示例2: HRESULT

bool wxTextEntry::AutoCompleteFileNames()
{
#ifdef HAS_AUTOCOMPLETE
    typedef HRESULT (WINAPI *SHAutoComplete_t)(HWND, DWORD);
    static SHAutoComplete_t s_pfnSHAutoComplete = (SHAutoComplete_t)-1;
    static wxDynamicLibrary s_dllShlwapi;
    if ( s_pfnSHAutoComplete == (SHAutoComplete_t)-1 )
    {
        if ( !s_dllShlwapi.Load(wxT("shlwapi.dll"), wxDL_VERBATIM | wxDL_QUIET) )
        {
            s_pfnSHAutoComplete = NULL;
        }
        else
        {
            wxDL_INIT_FUNC(s_pfn, SHAutoComplete, s_dllShlwapi);
        }
    }

    if ( !s_pfnSHAutoComplete )
        return false;

    HRESULT hr = (*s_pfnSHAutoComplete)(GetEditHwnd(), SHACF_FILESYS_ONLY);
    if ( FAILED(hr) )
    {
        wxLogApiError(wxT("SHAutoComplete()"), hr);

        return false;
    }
    return true;
#else // !HAS_AUTOCOMPLETE
    return false;
#endif // HAS_AUTOCOMPLETE/!HAS_AUTOCOMPLETE
}
开发者ID:DumaGit,项目名称:winsparkle,代码行数:33,代码来源:textentry.cpp


示例3: GetHtmlHelpFunction

HTMLHELP GetHtmlHelpFunction()
{
    static HTMLHELP s_htmlHelp = NULL;

    if ( !s_htmlHelp )
    {
        static wxDynamicLibrary s_dllHtmlHelp(wxT("HHCTRL.OCX"), wxDL_VERBATIM);

        if ( !s_dllHtmlHelp.IsLoaded() )
        {
            wxLogError(_("MS HTML Help functions are unavailable because the MS HTML Help library is not installed on this machine. Please install it."));
        }
        else
        {
            s_htmlHelp = (HTMLHELP)s_dllHtmlHelp.GetSymbol(HTMLHELP_NAME);
            if ( !s_htmlHelp )
            {
                wxLogError(_("Failed to initialize MS HTML Help."));
            }
        }
    }

    return s_htmlHelp;
}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:24,代码来源:helpchm.cpp


示例4: wxRendererFromDynLib

 // create the object wrapping the given renderer created from this DLL
 //
 // we take ownership of the pointer and will delete it (and also unload the
 // DLL) when we're deleted
 wxRendererFromDynLib(wxDynamicLibrary& dll, wxRendererNative *renderer)
     : wxDelegateRendererNative(*renderer),
       m_renderer(renderer),
       m_dllHandle(dll.Detach())
     {
     }
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:10,代码来源:rendcmn.cpp


示例5: OnInit

bool wxSocketMSWManager::OnInit()
{
  LPCTSTR pclassname = NULL;
  int i;

  /* Create internal window for event notifications */
  hWin = wxCreateHiddenWindow(&pclassname, CLASSNAME, wxSocket_Internal_WinProc);
  if (!hWin)
      return false;

  /* Initialize socket list */
  for (i = 0; i < MAXSOCKETS; i++)
  {
    socketList[i] = NULL;
  }
  firstAvailable = 0;

  // we don't link with wsock32.dll statically to avoid
  // dependencies on it for all the application using wx even if they don't use
  // sockets
    #define WINSOCK_DLL_NAME wxT("wsock32.dll")

    gs_wsock32dll.Load(WINSOCK_DLL_NAME, wxDL_VERBATIM | wxDL_QUIET);
    if ( !gs_wsock32dll.IsLoaded() )
        return false;

    wxDL_INIT_FUNC(gs_, WSAAsyncSelect, gs_wsock32dll);
    if ( !gs_WSAAsyncSelect )
        return false;

  // finally initialize WinSock
  WSADATA wsaData;
  return WSAStartup((1 << 8) | 1, &wsaData) == 0;
}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:34,代码来源:sockmsw.cpp


示例6: OnInit

bool wxSocketMSWManager::OnInit()
{
  static LPCTSTR pclassname = NULL;
  int i;

  /* Create internal window for event notifications */
  hWin = wxCreateHiddenWindow(&pclassname, CLASSNAME, wxSocket_Internal_WinProc);
  if (!hWin)
      return false;

  /* Initialize socket list */
  for (i = 0; i < MAXSOCKETS; i++)
  {
    socketList[i] = NULL;
  }
  firstAvailable = 0;

  // we don't link with wsock32.dll (or ws2 in CE case) statically to avoid
  // dependencies on it for all the application using wx even if they don't use
  // sockets
#ifdef __WXWINCE__
    #define WINSOCK_DLL_NAME wxT("ws2.dll")
#else
    #define WINSOCK_DLL_NAME wxT("wsock32.dll")
#endif

    gs_wsock32dll.Load(WINSOCK_DLL_NAME, wxDL_VERBATIM | wxDL_QUIET);
    if ( !gs_wsock32dll.IsLoaded() )
        return false;

#ifndef __WXWINCE__
    wxDL_INIT_FUNC(gs_, WSAAsyncSelect, gs_wsock32dll);
    if ( !gs_WSAAsyncSelect )
        return false;
#else
    wxDL_INIT_FUNC(gs_, WSAEventSelect, gs_wsock32dll);
    if ( !gs_WSAEventSelect )
        return false;

    wxDL_INIT_FUNC(gs_, WSACreateEvent, gs_wsock32dll);
    if ( !gs_WSACreateEvent )
        return false;

    wxDL_INIT_FUNC(gs_, WSAWaitForMultipleEvents, gs_wsock32dll);
    if ( !gs_WSAWaitForMultipleEvents )
        return false;

    wxDL_INIT_FUNC(gs_, WSAEnumNetworkEvents, gs_wsock32dll);
    if ( !gs_WSAEnumNetworkEvents )
        return false;

    currSocket = 0;
#endif // !__WXWINCE__/__WXWINCE__

  // finally initialize WinSock
  WSADATA wsaData;
  return WSAStartup((1 << 8) | 1, &wsaData) == 0;
}
开发者ID:iokto,项目名称:newton-dynamics,代码行数:58,代码来源:sockmsw.cpp


示例7: OnExit

void wxSocketMSWManager::OnExit()
{
  /* Destroy internal window */
  DestroyWindow(hWin);
  UnregisterClass(CLASSNAME, wxGetInstance());

  WSACleanup();

  gs_wsock32dll.Unload();
}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:10,代码来源:sockmsw.cpp


示例8: OnExit

void wxSocketMSWManager::OnExit()
{
#ifdef __WXWINCE__
/* Delete the threads here */
    for(unsigned int i=0; i < currSocket; i++)
        CloseHandle(hThread[i]);
#endif
  /* Destroy internal window */
  DestroyWindow(hWin);
  UnregisterClass(CLASSNAME, wxGetInstance());

  WSACleanup();

  gs_wsock32dll.Unload();
}
开发者ID:iokto,项目名称:newton-dynamics,代码行数:15,代码来源:sockmsw.cpp


示例9: GetVolumes

//=============================================================================
// Function: GetVolumes
// Purpose: Generate and return a list of all volumes (drives) available.
// Notes:
//=============================================================================
wxArrayString wxFSVolumeBase::GetVolumes(int flagsSet, int flagsUnset)
{
    ::InterlockedExchange(&s_cancelSearch, FALSE);     // reset

#if wxUSE_DYNLIB_CLASS
    if (!s_mprLib.IsLoaded() && s_mprLib.Load(wxT("mpr.dll")))
    {
#ifdef UNICODE
        s_pWNetOpenEnum = (WNetOpenEnumPtr)s_mprLib.GetSymbol(wxT("WNetOpenEnumW"));
        s_pWNetEnumResource = (WNetEnumResourcePtr)s_mprLib.GetSymbol(wxT("WNetEnumResourceW"));
#else
        s_pWNetOpenEnum = (WNetOpenEnumPtr)s_mprLib.GetSymbol(wxT("WNetOpenEnumA"));
        s_pWNetEnumResource = (WNetEnumResourcePtr)s_mprLib.GetSymbol(wxT("WNetEnumResourceA"));
#endif
        s_pWNetCloseEnum = (WNetCloseEnumPtr)s_mprLib.GetSymbol(wxT("WNetCloseEnum"));
    }
#endif

    wxArrayString list;

    //-------------------------------
    // Local and mapped drives first.
    //-------------------------------
    // Allocate the required space for the API call.
    const DWORD chars = GetLogicalDriveStrings(0, NULL);
    TCHAR* buf = new TCHAR[chars+1];

    // Get the list of drives.
    GetLogicalDriveStrings(chars, buf);

    // Parse the list into an array, applying appropriate filters.
    TCHAR *pVol;
    pVol = buf;
    while (*pVol)
    {
        FilteredAdd(list, pVol, flagsSet, flagsUnset);
        pVol = pVol + wxStrlen(pVol) + 1;
    }

    // Cleanup.
    delete[] buf;

    //---------------------------
    // Network Neighborhood next.
    //---------------------------

    // not exclude remote and not removable
    if (!(flagsUnset & wxFS_VOL_REMOTE) &&
        !(flagsSet & wxFS_VOL_REMOVABLE)
       )
    {
        // The returned list will be sorted alphabetically.  We don't pass
        // our in since we don't want to change to order of the local drives.
        wxArrayString nn;
        if (BuildRemoteList(nn, 0, flagsSet, flagsUnset))
        {
            for (size_t idx = 0; idx < nn.GetCount(); idx++)
                list.Add(nn[idx]);
        }
    }

    return list;
} // GetVolumes
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:68,代码来源:volume.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ wxEraseEvent类代码示例发布时间:2022-05-31
下一篇:
C++ wxDropFilesEvent类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap