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


C++ HRESULT函数代码示例

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


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


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