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

C++ HRESULT函数代码示例

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

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



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

示例1: Sys_SetHighDPIMode

void Sys_SetHighDPIMode(void)
{
  /* For Vista, Win7 and Win8 */
  BOOL(WINAPI * SetProcessDPIAware)(void) = NULL;

  /* Win8.1 and later */
  HRESULT(WINAPI * SetProcessDpiAwareness)
  (YQ2_PROCESS_DPI_AWARENESS dpiAwareness) = NULL;

  HINSTANCE userDLL = LoadLibrary("USER32.DLL");

  if (userDLL) {
    SetProcessDPIAware = (BOOL(WINAPI *)(void)) GetProcAddress(userDLL, "SetProcessDPIAware");
  }

  HINSTANCE shcoreDLL = LoadLibrary("SHCORE.DLL");

  if (shcoreDLL) {
    SetProcessDpiAwareness =
        (HRESULT(WINAPI *)(YQ2_PROCESS_DPI_AWARENESS)) GetProcAddress(shcoreDLL, "SetProcessDpiAwareness");
  }

  if (SetProcessDpiAwareness) {
    SetProcessDpiAwareness(YQ2_PROCESS_PER_MONITOR_DPI_AWARE);
  } else if (SetProcessDPIAware) {
    SetProcessDPIAware();
  }
}
开发者ID:greck2908,项目名称:qengine,代码行数:28,代码来源:system.c


示例2: HRESULT

bool WinSevenTaskbar::setTaskbarState(QWidget *window, WinSevenTaskbarState state)
{
	bool result = false;
	
	if(m_ptbl && window)
	{
		HRESULT hr = HRESULT(-1);

		switch(state)
		{
		case WinSevenTaskbarNoState:
			hr = m_ptbl->SetProgressState(reinterpret_cast<HWND>(window->winId()), TBPF_NOPROGRESS);
			break;
		case WinSevenTaskbarNormalState:
			hr = m_ptbl->SetProgressState(reinterpret_cast<HWND>(window->winId()), TBPF_NORMAL);
			break;
		case WinSevenTaskbarIndeterminateState:
			hr = m_ptbl->SetProgressState(reinterpret_cast<HWND>(window->winId()), TBPF_INDETERMINATE);
			break;
		case WinSevenTaskbarErrorState:
			hr = m_ptbl->SetProgressState(reinterpret_cast<HWND>(window->winId()), TBPF_ERROR);
			break;
		case WinSevenTaskbarPausedState:
			hr = m_ptbl->SetProgressState(reinterpret_cast<HWND>(window->winId()), TBPF_PAUSED);
			break;
		}

		result = SUCCEEDED(hr);
	}

	return result;
}
开发者ID:Rub3nCT,项目名称:LameXP,代码行数:32,代码来源:WinSevenTaskbar.cpp


示例3: lock

bool Taskbar::setTaskbarState(QWidget *window, TaskbarState state)
{
	QMutexLocker lock(&s_lock);
	
	if(s_data && s_data->ptbl && window)
	{
		HRESULT hr = HRESULT(-1);

		switch(state)
		{
		case TaskbarNoState:
			hr = s_data->ptbl->SetProgressState(reinterpret_cast<HWND>(window->winId()), TBPF_NOPROGRESS);
			break;
		case TaskbarNormalState:
			hr = s_data->ptbl->SetProgressState(reinterpret_cast<HWND>(window->winId()), TBPF_NORMAL);
			break;
		case TaskbarIndeterminateState:
			hr = s_data->ptbl->SetProgressState(reinterpret_cast<HWND>(window->winId()), TBPF_INDETERMINATE);
			break;
		case TaskbarErrorState:
			hr = s_data->ptbl->SetProgressState(reinterpret_cast<HWND>(window->winId()), TBPF_ERROR);
			break;
		case TaskbarPausedState:
			hr = s_data->ptbl->SetProgressState(reinterpret_cast<HWND>(window->winId()), TBPF_PAUSED);
			break;
		}

		return SUCCEEDED(hr);
	}

	return false;
}
开发者ID:lordmulder,项目名称:DoubleFilerScanner,代码行数:32,代码来源:Taskbar.cpp


示例4: LoadLibrary

BOOL CCoolInterface::EnableTheme(CWnd* pWnd, BOOL bEnable)
{
	HINSTANCE hTheme = LoadLibrary( _T("UxTheme.dll") );
	if ( ! hTheme ) return FALSE;

	HRESULT (WINAPI *pfnSetWindowTheme)(HWND, LPCWSTR, LPCWSTR);

	(FARPROC&)pfnSetWindowTheme = GetProcAddress( hTheme, "SetWindowTheme" );

	BOOL bResult = FALSE;

	if ( pfnSetWindowTheme )
	{
		if ( bEnable )
		{
			bResult = SUCCEEDED( (*pfnSetWindowTheme)( pWnd->GetSafeHwnd(), NULL, NULL ) );
		}
		else
		{
			bResult = SUCCEEDED( (*pfnSetWindowTheme)( pWnd->GetSafeHwnd(), L" ", L" " ) );
		}
	}

	FreeLibrary( hTheme );

	return bResult;
}
开发者ID:pics860,项目名称:callcenter,代码行数:27,代码来源:CoolInterface.cpp


示例5: vertexHeights

//laddar heightmap från en rawfil.
void HeigthMap::Load(std::string filename, int Width, int Height)
{
    m_Width		= Width;
    m_Height	= Height;

    m_Map = new float*[Height];
    for (int z = 0; z < Height; z++)
        m_Map[z] = new float[Width];

    std::vector<unsigned char> vertexHeights(Width * Height);

    //läser in data från raw filen.
    std::ifstream fin;
    fin.open(filename, std::ios_base::binary);

    if (!fin) HRESULT(E_FAIL);

    fin.read((char *)&vertexHeights[0], (std::streamsize)vertexHeights.size());
    fin.close();

    //sparar den inladdade informationen i heigtmappen.
    for (int z = 0; z < Height; z++)
    {
        //Inverterar data i Z axeln.
        int Z = Height - 1 - z;
        for (int x = 0; x < Width; x++)
        {
            m_Map[Z][x] = (float) vertexHeights[z*Width + x];
        }
    }

    //filtrerar höjdmappen 20 gånger.
    //Filter(20);
}
开发者ID:CarlRapp,项目名称:CodenameGamma,代码行数:35,代码来源:HeigthMap.cpp


示例6: ret

CComPtr<IHTMLElement> CWtlHtmlView::GetElement(CComPtr<IWebBrowser2> pWebBrowser, const TCHAR *id)
{ 
	CComPtr<IHTMLElement> ret(NULL); 
	if (id==0) 
		return 0;

	CComPtr<IHTMLDocument2>  doc	= this->GetDocument(pWebBrowser);
	if (doc==0) 
		throw std::exception("CMainDlg::GetElement() pHTMLDocument NULL\n");

	CComPtr<IHTMLElementCollection> doc_all;
	HRESULT hr = doc->get_all(&doc_all);      // this is like doing document.all
	if (hr==S_OK)
	{ 
		VARIANT v0; VariantInit(&v0);

		CComPtr<IDispatch> disp;
		_variant_t vid((BSTR) _bstr_t(id));
		hr = doc_all->item(vid,v0,&disp);       // this is like doing document.all["messages"]
		if (hr==S_OK && disp!=0)
		{ 
			hr = disp->QueryInterface(IID_IHTMLElement,(void **)&ret); // it's the caller's responsibility to release ret
			if(FAILED(hr))
				throw HRESULT(hr);
		}
	}
	return ret;
}
开发者ID:johnmichaloski,项目名称:SoftwareGadgets,代码行数:28,代码来源:WTLHtmlView.cpp


示例7: gfx_set_dwm

static void gfx_set_dwm(void)
{
   HRESULT ret;
   HRESULT (WINAPI *composition_enable)(UINT);
   settings_t *settings = config_get_ptr();

   if (!gfx_init_dwm())
      return;

   if (settings->bools.video_disable_composition == dwm_composition_disabled)
      return;

#ifdef HAVE_DYNAMIC
   composition_enable =
      (HRESULT (WINAPI*)(UINT))dylib_proc(dwmlib, "DwmEnableComposition");
#endif

   if (!composition_enable)
   {
      RARCH_ERR("Did not find DwmEnableComposition ...\n");
      return;
   }

   ret = composition_enable(!settings->bools.video_disable_composition);
   if (FAILED(ret))
      RARCH_ERR("Failed to set composition state ...\n");
   dwm_composition_disabled = settings->bools.video_disable_composition;
}
开发者ID:leiradel,项目名称:RetroArch,代码行数:28,代码来源:platform_win32.c


示例8: FindDevicesCallback

static int FindDevicesCallback(vlc_object_t *object, const char *name,
                               char ***values, char ***descs)
{
    enum_context_t ctx;

    ctx.values = xmalloc(sizeof(char *));
    ctx.descs = xmalloc(sizeof(char *));
    ctx.values[0] = strdup("");
    ctx.descs[0] = strdup(_("Default"));
    ctx.count = 1;

    /* Load direct draw DLL */
    HINSTANCE hddraw_dll = LoadLibrary(_T("DDRAW.DLL"));
    if (hddraw_dll != NULL)
    {
        /* Enumerate displays */
        HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEXA,
                                                   LPVOID, DWORD) =
              (void *)GetProcAddress(hddraw_dll, DIRECTDRAWENUMERATEEX_NAME);
        if (OurDirectDrawEnumerateEx != NULL)
            OurDirectDrawEnumerateEx(DirectXEnumCallback2, &ctx,
                                     DDENUM_ATTACHEDSECONDARYDEVICES);
        FreeLibrary(hddraw_dll);
    }

    VLC_UNUSED(object);
    VLC_UNUSED(name);

    *values = ctx.values;
    *descs = ctx.descs;
    return ctx.count;
}
开发者ID:Kubink,项目名称:vlc,代码行数:32,代码来源:directx.c


示例9: gfx_init_dwm

static bool gfx_init_dwm(void)
{
   static bool inited = false;

   if (inited)
      return true;

   dwmlib = dylib_load("dwmapi.dll");
   if (!dwmlib)
   {
      RARCH_LOG("Did not find dwmapi.dll.\n");
      return false;
   }
   atexit(gfx_dwm_shutdown);

   HRESULT (WINAPI *mmcss)(BOOL) = 
      (HRESULT (WINAPI*)(BOOL))dylib_proc(dwmlib, "DwmEnableMMCSS");
   if (mmcss)
   {
      RARCH_LOG("Setting multimedia scheduling for DWM.\n");
      mmcss(TRUE);
   }

   inited = true;
   return true;
}
开发者ID:caa1211,项目名称:RetroArch,代码行数:26,代码来源:platform_win32.c


示例10: dsPause

//--------------------------------------------------------------------------------------------
//	関数名		:	dsPause
//	作成者		:	植山沙欧 
//	作成日		:	2014.01.20
//	機能		:	再生中のバッファを一時停止させます
//	機能効果	:	「numBuffer」バッファのサウンドを一時停止します
//	引数		:	<入力>	numBuffer		一時停止させたいバッファ番号
//	使用変数	:	ありません
//	使用関数	:	IDirectSoundBuffer8::Stop
//	戻り値	:	IDirectSoundBuffer8::Stopの戻り値が返ります
//				バッファが生成されていない場合は0が返ります
//	更新履歴	:	2014.01.20	Ver1.00		植山沙欧	機能の実現
//--------------------------------------------------------------------------------------------
HRESULT dsPause(int numBuffer)
{
	if(!g_ds.sec_ptr[numBuffer])
	{
		return HRESULT(0);
	}
	return g_ds.sec_ptr[numBuffer]->Stop();
}
开发者ID:jecDiceButtle,项目名称:DiceBattle_Beta,代码行数:21,代码来源:Ds2008.cpp


示例11: StatusProc

// ステータスメッセージ処理
BOOL CALLBACK StatusProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
    switch (uMsg)
    {
    case WM_INITDIALOG:
        bCancel = false;
        libarcdll_CenterWindow((HWND)lParam,hWnd);
        SendMessage(hWnd,WM_SETICON,ICON_BIG,(LPARAM)LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MAIN)));
        SendMessage(hWnd,WM_SETICON,ICON_SMALL,(LPARAM)LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MAIN)));
        if (libarcdll_GetCursorMode() == TRUE)
        {
            SetClassLong(hWnd,GCL_HCURSOR,(LONG)LoadCursor((HINSTANCE)GetWindowLong(hWnd,GWL_HINSTANCE),MAKEINTRESOURCE(IDC_MAIN)));
            SetClassLong(GetDlgItem(hWnd,IDC_PROGRESS),GCL_HCURSOR,(LONG)LoadCursor((HINSTANCE)GetWindowLong(hWnd,GWL_HINSTANCE),MAKEINTRESOURCE(IDC_MAIN)));
            SetClassLong(GetDlgItem(hWnd,IDC_CANCEL),GCL_HCURSOR,(LONG)LoadCursor((HINSTANCE)GetWindowLong(hWnd,GWL_HINSTANCE),MAKEINTRESOURCE(IDC_MAIN)));
        }
        if (libarcdll_GetOSType() >= OS_WINNT_XP)
        {
            HMODULE hDll;
            HRESULT (WINAPI *SetWindowTheme)(HWND,LPCWSTR,LPCWSTR);
            if ((hDll = LoadLibrary("UxTheme.dll")) != NULL)
            {
                SetWindowTheme = (HRESULT(WINAPI*)(HWND,LPCWSTR,LPCWSTR))GetProcAddress(hDll,"SetWindowTheme");
                if (SetWindowTheme != NULL)
                {
                    SetWindowTheme(GetDlgItem(hWnd,IDC_CANCEL),L"",L"");
                    SetWindowTheme(GetDlgItem(hWnd,IDC_INTASK),L"",L"");
                    SetWindowTheme(GetDlgItem(hWnd,IDC_PROGRESS),L"",L"");
                }
                FreeLibrary(hDll);
            }
        }
        return TRUE;
    case WM_DESTROY:
        return TRUE;
    case WM_SYSCOMMAND:
        switch (wParam)
        {
        case SC_CLOSE:
            if (MessageBox(hWnd,"展開を中止しますか?","UnImp32.dll",MB_YESNO) == IDYES)
            {
                bCancel = true;
            }
            return TRUE;
        }
        return FALSE;
    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDC_CANCEL:
            SendMessage(hWnd,WM_SYSCOMMAND,SC_CLOSE,0);
            return TRUE;
        }
        return FALSE;
    case WM_TASKCALLBACK:
        return TRUE;
    }
    return FALSE;
}
开发者ID:wkoiking,项目名称:xyzzy,代码行数:59,代码来源:Extract.cpp


示例12: _DwmIsCompositionEnabled

bool _DwmIsCompositionEnabled()
{
    HMODULE library = LoadLibrary(L"dwmapi.dll");
    bool result = false;
    if (library) {
        BOOL enabled = false;
        HRESULT (WINAPI *pFn)(BOOL *enabled) = (HRESULT (WINAPI *)(BOOL *enabled))(GetProcAddress(library, "DwmIsCompositionEnabled"));
        result = SUCCEEDED(pFn(&enabled)) && enabled;
        FreeLibrary(library);
    }
    return result;
}
开发者ID:chillin2,项目名称:nulloy,代码行数:12,代码来源:mainWindow.cpp


示例13: throw

/**
	Given an audio file, this method kicks off the SAPI 5.1 DICTATION grammar
	on it. This is Microsoft's Speaker Independent Speech Recognition.

	@see ::run_sapi_textless_lipsync for an example

	Results are handled in the sapi_textless_lipsync::callback. 
	@param strAudioFile - [in] the source audio file
	@retval true if lipsync got started
	@retval false if it failed to start
**/	
bool sapi_textless_lipsync::lipsync(const std::wstring& strAudioFile)
{
    HRESULT hr;
    try
    {
        
        if (!this->initializeObjects())
            throw (HRESULT(E_FAIL));
        
        if (!this->loadAudio(strAudioFile))
             throw (HRESULT(E_FAIL));
        
        // initialize the grammar
        hr = m_grammar->LoadDictation(NULL, SPLO_STATIC);
        if (hr != S_OK)
        {
            m_err = L"Error: Cannot load SAPI Dictation Grammar";
        }
    
        hr = m_grammar->SetDictationState(SPRS_ACTIVE);

        if (hr != S_OK)
        {
            m_err = L"Cannot activate the SAPI Dictation Grammar";
            throw (hr);
        }
        
        m_recog->SetRecoState(SPRST_ACTIVE);
       

        // now we should be running!

    }
    catch (HRESULT _hr)
    {
        hr = _hr;
    }
    return (hr == S_OK);
}
开发者ID:xianyinchen,项目名称:Horde3DGameEngine,代码行数:50,代码来源:sapi_lipsync.cpp


示例14: HRESULT

CDateTimeCtrlEx::~CDateTimeCtrlEx()
{
	if (m_hUxTheme!=NULL)
	{
		HRESULT(STDAPICALLTYPE *pCloseThemeData)(HTHEME)=(HRESULT(STDAPICALLTYPE *)(HTHEME))GetProcAddress(m_hUxTheme,"CloseThemeData");
		if (pCloseThemeData!=NULL)
		{
			if (m_hTheme!=NULL)     
				pCloseThemeData(m_hTheme);
		}
		FreeLibrary(m_hUxTheme);
	}
}
开发者ID:joshball,项目名称:locate32-cogit.net,代码行数:13,代码来源:misc.cpp


示例15: DDrawInitialize

void DDrawInitialize(int width, int height)
{
  if ( !ghMainWnd || wmode )
    return;

  // Initialize module
  ShowWindow(ghMainWnd, SW_NORMAL);
  if ( !ddLib )
  {
    ddLib = LoadLibrary("ddraw.dll");
    DDCHECK(ddLib);
  }

  // Obtain function DirectDrawCreate
  HRESULT (WINAPI *_DirectDrawCreate)(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnknown FAR* pUnkOuter);
  *(FARPROC*)&_DirectDrawCreate = GetProcAddress(ddLib, "DirectDrawCreate");
  DDCHECK(_DirectDrawCreate);

  // Create and initialize DirectDrawInterface
  DDCHECK( _DirectDrawCreate(NULL, BW::BWDATA_DDInterface, NULL) == DD_OK );
  DDCHECK( (*BW::BWDATA_DDInterface)->SetCooperativeLevel(ghMainWnd, DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE) == DD_OK );
  if ( (*BW::BWDATA_DDInterface)->SetDisplayMode(width, height, 8) != DD_OK )
    DDCHECK( (*BW::BWDATA_DDInterface)->SetDisplayMode(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), 8) == DD_OK );

  // Create DirectDrawPalette
  DDCHECK( (*BW::BWDATA_DDInterface)->CreatePalette(DDPCAPS_8BIT | DDPCAPS_ALLOW256, BW::BWDATA_GamePalette, BW::BWDATA_PrimaryPalette, NULL) == DD_OK );

  DDSURFACEDESC surfaceDesc = { 0 };
  surfaceDesc.dwSize          = sizeof(DDSURFACEDESC);
  surfaceDesc.dwFlags         = DDSD_CAPS;
  surfaceDesc.ddsCaps.dwCaps  = DDSCAPS_PRIMARYSURFACE;

  DDCHECK( (*BW::BWDATA_DDInterface)->CreateSurface(&surfaceDesc, BW::BWDATA_PrimarySurface, NULL) == DD_OK );
  DDCHECK( (*BW::BWDATA_PrimarySurface)->SetPalette(*BW::BWDATA_PrimaryPalette) == DD_OK );
  if ( (*BW::BWDATA_PrimarySurface)->Lock(NULL, &surfaceDesc, DDLOCK_WAIT, NULL) != DD_OK )
  {
    memset(&surfaceDesc, 0, sizeof(DDSURFACEDESC));
    surfaceDesc.dwSize          = sizeof(DDSURFACEDESC);
    surfaceDesc.dwFlags         = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
    surfaceDesc.ddsCaps.dwCaps  = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
    surfaceDesc.dwWidth         = width;
    surfaceDesc.dwHeight        = height;

    DDCHECK( (*BW::BWDATA_DDInterface)->CreateSurface(&surfaceDesc, BW::BWDATA_BackSurface, NULL) == DD_OK );
  }
  else
  {
    (*BW::BWDATA_PrimarySurface)->Unlock(&surfaceDesc);
  }
  SDrawManualInitialize(ghMainWnd, *BW::BWDATA_DDInterface, *BW::BWDATA_PrimarySurface, NULL, NULL, *BW::BWDATA_BackSurface, *BW::BWDATA_PrimaryPalette, NULL);
}
开发者ID:oenayet,项目名称:bwapi,代码行数:51,代码来源:Resolution.cpp


示例16: register_fake_dll

static void register_fake_dll( const WCHAR *name, const void *data, size_t size )
{
    static const WCHAR atlW[] = {'a','t','l','.','d','l','l',0};
    static const WCHAR moduleW[] = {'M','O','D','U','L','E',0};
    static const WCHAR regtypeW[] = {'W','I','N','E','_','R','E','G','I','S','T','R','Y',0};
    static const WCHAR manifestW[] = {'W','I','N','E','_','M','A','N','I','F','E','S','T',0};
    const IMAGE_RESOURCE_DIRECTORY *resdir;
    LDR_RESOURCE_INFO info;
    HRESULT hr = S_OK;
    HMODULE module = (HMODULE)((ULONG_PTR)data | 1);
    HRSRC rsrc;

    if ((rsrc = FindResourceW( module, manifestW, MAKEINTRESOURCEW(RT_MANIFEST) )))
    {
        char *manifest = LoadResource( module, rsrc );
        register_manifest( name, manifest, SizeofResource( module, rsrc ), data, size );
    }

    info.Type = (ULONG_PTR)regtypeW;
    if (LdrFindResourceDirectory_U( module, &info, 1, &resdir )) return;

    if (!registrar)
    {
        /* create the object by hand since we can't guarantee that atl and ole32 are registered */
        IClassFactory *cf;
        HRESULT (WINAPI *pDllGetClassObject)( REFCLSID clsid, REFIID iid, LPVOID *ppv );
        HMODULE atl = LoadLibraryW( atlW );

        if ((pDllGetClassObject = (void *)GetProcAddress( atl, "DllGetClassObject" )))
        {
            hr = pDllGetClassObject( &CLSID_Registrar, &IID_IClassFactory, (void **)&cf );
            if (SUCCEEDED( hr ))
            {
                hr = IClassFactory_CreateInstance( cf, NULL, &IID_IRegistrar, (void **)&registrar );
                IClassFactory_Release( cf );
            }
        }
        if (!registrar)
        {
            ERR( "failed to create IRegistrar: %x\n", hr );
            return;
        }
    }

    TRACE( "registering %s\n", debugstr_w(name) );
    IRegistrar_ClearReplacements( registrar );
    IRegistrar_AddReplacement( registrar, moduleW, name );
    EnumResourceNamesW( module, regtypeW, register_resource, (LONG_PTR)&hr );
    if (FAILED(hr)) ERR( "failed to register %s: %x\n", debugstr_w(name), hr );
}
开发者ID:CSRedRat,项目名称:RosWine,代码行数:50,代码来源:fakedll.c


示例17: set_app_id

static void set_app_id(LPWSTR app_id)
{
	HMODULE shell32;
	HRESULT (*set_app_id)(LPWSTR app_id);

	shell32 = LoadLibrary(L"shell32.dll");
	if (!shell32)
		return;
	set_app_id = (void *) GetProcAddress(shell32,
			"SetCurrentProcessExplicitAppUserModelID");
	if (!set_app_id)
		return;
	if (!SUCCEEDED(set_app_id(app_id)))
		print_error(L"warning: could not set app ID", GetLastError());
}
开发者ID:578723746,项目名称:git,代码行数:15,代码来源:git-wrapper.c


示例18: gfx_set_dwm

void gfx_set_dwm(void)
{
   static bool inited = false;
   if (inited)
      return;
   inited = true;

   dwmlib = dylib_load("dwmapi.dll");
   if (!dwmlib)
   {
      RARCH_LOG("Did not find dwmapi.dll.\n");
      return;
   }
   atexit(gfx_dwm_shutdown);

   HRESULT (WINAPI *mmcss)(BOOL) = (HRESULT (WINAPI*)(BOOL))dylib_proc(dwmlib, "DwmEnableMMCSS");
   if (mmcss)
   {
      RARCH_LOG("Setting multimedia scheduling for DWM.\n");
      mmcss(TRUE);
   }

   if (!g_settings.video.disable_composition)
      return;

   HRESULT (WINAPI *composition_enable)(UINT) = (HRESULT (WINAPI*)(UINT))dylib_proc(dwmlib, "DwmEnableComposition");
   if (!composition_enable)
   {
      RARCH_ERR("Did not find DwmEnableComposition ...\n");
      return;
   }

   HRESULT ret = composition_enable(0);
   if (FAILED(ret))
      RARCH_ERR("Failed to set composition state ...\n");
}
开发者ID:freakdave,项目名称:RetroArch,代码行数:36,代码来源:gfx_common.c


示例19: install_cab

static BOOL install_cab(LPCWSTR file_name)
{
    HMODULE advpack;
    char install_dir[MAX_PATH];
    HRESULT (WINAPI *pExtractFilesA)(LPCSTR,LPCSTR,DWORD,LPCSTR,LPVOID,DWORD);
    LPSTR file_name_a;
    DWORD res;
    HRESULT hres;

    static const WCHAR wszAdvpack[] = {'a','d','v','p','a','c','k','.','d','l','l',0};

    TRACE("(%s)\n", debugstr_w(file_name));

    GetWindowsDirectoryA(install_dir, sizeof(install_dir));
    strcat(install_dir, "\\gecko\\");
    res = CreateDirectoryA(install_dir, NULL);
    if(!res && GetLastError() != ERROR_ALREADY_EXISTS) {
        ERR("Could not create directory: %08u\n", GetLastError());
        return FALSE;
    }

    strcat(install_dir, GECKO_VERSION);
    res = CreateDirectoryA(install_dir, NULL);
    if(!res && GetLastError() != ERROR_ALREADY_EXISTS) {
        ERR("Could not create directory: %08u\n", GetLastError());
        return FALSE;
    }

    advpack = LoadLibraryW(wszAdvpack);
    pExtractFilesA = (void *)GetProcAddress(advpack, "ExtractFiles");

    /* FIXME: Use unicode version (not yet implemented) */
    file_name_a = heap_strdupWtoA(file_name);
    hres = pExtractFilesA(file_name_a, install_dir, 0, NULL, NULL, 0);
    FreeLibrary(advpack);
    heap_free(file_name_a);
    if(FAILED(hres)) {
        ERR("Could not extract package: %08x\n", hres);
        clean_up();
        return FALSE;
    }

    set_registry(install_dir);
    clean_up();

    return TRUE;
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:47,代码来源:install.c


示例20: gfx_init_dwm

static bool gfx_init_dwm(void)
{
   HRESULT (WINAPI *mmcss)(BOOL);
   static bool inited = false;

   if (inited)
      return true;

   atexit(gfx_dwm_shutdown);

#ifdef HAVE_DYNAMIC
   shell32lib = dylib_load("shell32.dll");
   if (!shell32lib)
   {
      RARCH_WARN("Did not find shell32.dll.\n");
   }

   dwmlib = dylib_load("dwmapi.dll");
   if (!dwmlib)
   {
      RARCH_WARN("Did not find dwmapi.dll.\n");
      return false;
   }

   DragAcceptFiles_func =
      (VOID (WINAPI*)(HWND, BOOL))dylib_proc(shell32lib, "DragAcceptFiles");

   mmcss =
	   (HRESULT(WINAPI*)(BOOL))dylib_proc(dwmlib, "DwmEnableMMCSS");
#else
   DragAcceptFiles_func = DragAcceptFiles;
#if 0
   mmcss                = DwmEnableMMCSS;
#endif
#endif

   if (mmcss)
   {
	   RARCH_LOG("Setting multimedia scheduling for DWM.\n");
	   mmcss(TRUE);
   }

   inited = true;
   return true;
}
开发者ID:leiradel,项目名称:RetroArch,代码行数:45,代码来源:platform_win32.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ HRESULT_CODE函数代码示例发布时间:2022-05-30
下一篇:
C++ HR函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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