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


C++ GetIconInfo函数代码示例

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


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

示例1: BindOverlayIcon

HICON BindOverlayIcon(HICON SourceIcon,HICON OverlayIcon)
{
	ICONINFO OverlayIconInfo, TargetIconInfo;
	BITMAP OverlayBitmapInfo, TargetBitmapInfo;
	HBITMAP OldOverlayBitmap, OldTargetBitmap;
	HICON TargetIcon, TempIcon;
	HDC OverlayDC, TargetDC;
	BLENDFUNCTION bf = {0,0,255,1};

	TempIcon = CopyIcon(SourceIcon);
	if ( !GetIconInfo( TempIcon, &TargetIconInfo ))
		return NULL;

	MakeBitmap32(&TargetIconInfo.hbmColor);
	CorrectBitmap32Alpha(TargetIconInfo.hbmColor, FALSE);
	GetObject(TargetIconInfo.hbmColor, sizeof(BITMAP), &TargetBitmapInfo);

	if ( !GetIconInfo(OverlayIcon, &OverlayIconInfo) || !GetObject(OverlayIconInfo.hbmColor, sizeof(BITMAP), &OverlayBitmapInfo))
		return NULL;

	TargetDC = CreateCompatibleDC(NULL);
	OldTargetBitmap = (HBITMAP)SelectObject(TargetDC, TargetIconInfo.hbmColor);

	OverlayDC = CreateCompatibleDC(NULL);
	OldOverlayBitmap = (HBITMAP)SelectObject(OverlayDC, OverlayIconInfo.hbmColor);

	AlphaBlend(TargetDC, 0, 0, TargetBitmapInfo.bmWidth, TargetBitmapInfo.bmHeight,
		   OverlayDC, 0, 0, OverlayBitmapInfo.bmWidth, OverlayBitmapInfo.bmHeight, bf);

	SelectObject(TargetDC, TargetIconInfo.hbmMask);
	SelectObject(OverlayDC, OverlayIconInfo.hbmMask);

	BitBlt(TargetDC, 0, 0, TargetBitmapInfo.bmWidth, TargetBitmapInfo.bmHeight,
	       OverlayDC, 0, 0, SRCCOPY);

	TargetIcon = CreateIconIndirect(&TargetIconInfo);
	DestroyIcon(TempIcon);

	SelectObject(TargetDC, OldTargetBitmap);
	DeleteObject(TargetIconInfo.hbmColor);
	DeleteObject(TargetIconInfo.hbmMask);
	DeleteDC(TargetDC);

	SelectObject(OverlayDC, OldOverlayBitmap);
	DeleteObject(OverlayIconInfo.hbmColor);
	DeleteObject(OverlayIconInfo.hbmMask);
	DeleteDC(OverlayDC);

	return TargetIcon;
}
开发者ID:aventado,项目名称:secureimplugin,代码行数:50,代码来源:images.cpp

示例2: DrawIconExAlpha

void DrawIconExAlpha(HDC hdc, int xLeft, int yTop, HICON hIcon, int cxWidth, int cyWidth, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags, bool bIsSmiley)
{
    bool restore = false;

    if (skin.bNeedLayerUpdate && !bIsSmiley) {
        ICONINFO icon;
        if ( GetIconInfo(hIcon, &icon)) {
            if ( !IsAlphaTransparent(icon.hbmColor)) {
                RECT rc;
                SetRect(&rc, xLeft, yTop, xLeft + cxWidth, yTop + cyWidth);
                SaveAlpha(&rc);
                restore = true;
            }

            DeleteObject(icon.hbmColor);
            DeleteObject(icon.hbmMask);
        }
    }

    DrawIconEx(hdc, xLeft, yTop, hIcon, cxWidth, cyWidth, istepIfAniCur, hbrFlickerFreeDraw, diFlags);

    if (skin.bNeedLayerUpdate && restore) {
        RECT rc;
        SetRect(&rc, xLeft, yTop, xLeft + cxWidth, yTop + cyWidth);
        RestoreAlpha(&rc);
    }
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:27,代码来源:bitmap_func.cpp

示例3: ConvertBufferToPARGB32

///////////////////////////////////////////////////////////////////////////////////////
// private helper for IconToPARGB32Bitmap
BOOL ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hdc, HICON hicon, SIZE& sizIcon)
{
    RGBQUAD *prgbQuad = NULL;
    int cxRow = 0;

	if (CThemed::GetBufferedPaintBits(hPaintBuffer, &prgbQuad, &cxRow))
	{
		ARGB *pargb = reinterpret_cast<ARGB *>(prgbQuad);

		if (!HasAlpha(pargb, sizIcon, cxRow))
		{
			ICONINFO info = { 0 };

			if (GetIconInfo(hicon, &info))
			{
				if (info.hbmMask)
				{
					ConvertToPARGB32(hdc, pargb, info.hbmMask, sizIcon, cxRow);
				}

				// cleanup
				VERIFY(DeleteObject(info.hbmColor));
				VERIFY(DeleteObject(info.hbmMask));
			}
		}
		
		return TRUE;
	}
	
    return FALSE;
}
开发者ID:Fox-Heracles,项目名称:TodoList,代码行数:33,代码来源:GraphicsMisc.cpp

示例4: ImmGetIMEFileName

void CIme::SetImeIcon()
{
	HICON hIcon = NULL;
	if( ImmIsIME( m_hCurKL ) )
	{
		char buf[256];
		ImmGetIMEFileName( m_hCurKL, buf, 256 );
		HMODULE hDll = LoadLibrary( buf );
		EnumResourceNames( hDll, RT_GROUP_ICON, (ENUMRESNAMEPROC)EnumResNameProc, (int32)(void*)&hIcon );
		FreeLibrary( hDll );
	}

	m_ImeImage.Release();
	if( hIcon )
	{
		IGraphic* pGraphic = CGraphic::GetInst();

		CFRect rt = CFRect( 0, 0, 16, 16 );
		m_ImeImage.AddImage( pGraphic, -1, NULL, &rt, CFPos(0.0f, 0.0f), 0xffffffff );
		pGraphic->CreateTexture( 16, 16, TF_UNKNOW, &m_ImeImage.GetImage(0).pTexture );

		ICONINFO Info; 
		GetIconInfo( hIcon, &Info );
		m_ImeImage.GetImage(0).pTexture->FillFromHBitmap( Info.hbmColor, Info.hbmMask );
		::DestroyIcon( hIcon );
	}

	OnImeChanged();
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:29,代码来源:CIme.cpp

示例5: pfnGetBufferedPaintBits

HRESULT CIconMenu::ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hdc, HICON hicon, SIZE& sizIcon)
{
	RGBQUAD *prgbQuad;
	int cxRow;
	HRESULT hr = pfnGetBufferedPaintBits(hPaintBuffer, &prgbQuad, &cxRow);
	if (SUCCEEDED(hr))
	{
		Gdiplus::ARGB *pargb = reinterpret_cast<Gdiplus::ARGB *>(prgbQuad);
		if (!HasAlpha(pargb, sizIcon, cxRow))
		{
			ICONINFO info;
			if (GetIconInfo(hicon, &info))
			{
				if (info.hbmMask)
				{
					hr = ConvertToPARGB32(hdc, pargb, info.hbmMask, sizIcon, cxRow);
				}

				DeleteObject(info.hbmColor);
				DeleteObject(info.hbmMask);
			}
		}
	}

	return hr;
}
开发者ID:hfeeki,项目名称:TortoiseGit,代码行数:26,代码来源:IconMenu.cpp

示例6: SetCaption

void CPropPageFrameDefault::SetCaption(LPCTSTR lpszCaption, HICON hIcon /*= NULL*/)
{
	CPropPageFrame::SetCaption(lpszCaption, hIcon);

	// build image list
	if (m_Images.GetSafeHandle())
		m_Images.DeleteImageList();
	if (hIcon)
	{
		ICONINFO	ii;
		if (!GetIconInfo(hIcon, &ii))
			return;

		CBitmap	bmMask;
		bmMask.Attach(ii.hbmMask);
		if (ii.hbmColor) DeleteObject(ii.hbmColor);

		BITMAP	bm;
		bmMask.GetBitmap(&bm);

		if (!m_Images.Create(bm.bmWidth, bm.bmHeight, ILC_COLOR32|ILC_MASK, 0, 1))
			return;

		if (m_Images.Add(hIcon) == -1)
			m_Images.DeleteImageList();
	}
}
开发者ID:Strongc,项目名称:playasa,代码行数:27,代码来源:PropPageFrameDefault.cpp

示例7: QTreeWidgetItem

StripperWindow::StripperWindow(QTreeWidget *parent, HWND hwnd):
        QTreeWidgetItem(parent, QTreeWidgetItem::Type)
{
    //stubbed out.
    handle = hwnd;

    HICON icon_handle = (HICON)GetClassLongPtr(handle, GCLP_HICON);
    //pre-empt the "failed to GetIconInfo() error" so it speeds through quickly.
    ICONINFO dummy;
    if(!GetIconInfo(icon_handle, &dummy)) {
        icon = QPixmap();
    } else {
        icon = QPixmap::fromWinHICON(icon_handle);
    }

    LPWSTR lpwstr_buf = (WCHAR*)calloc(sizeof(WCHAR), 255);
    GetWindowText(hwnd, lpwstr_buf, 255);
    title = QString::fromWCharArray(lpwstr_buf, 255);
    free(lpwstr_buf);

    borderless_p = false;

    //this might seem like duplication...
    setData(0, Qt::DecorationRole, QVariant(icon));
    setData(1, Qt::DisplayRole, QVariant(title));
    setFont(1, QFont(QString("Verdana"), 0, QFont::Bold, false));
    setData(2, Qt::CheckStateRole, QVariant(StrippedP()));
}
开发者ID:rplacd,项目名称:Striptease,代码行数:28,代码来源:stripperwindow.cpp

示例8: draw_cursor

static void draw_cursor(struct dc_capture *capture, HDC hdc)
{
	HICON icon;
	ICONINFO ii;
	CURSORINFO *ci = &capture->ci;

	if (!(capture->ci.flags & CURSOR_SHOWING))
		return;

	icon = CopyIcon(capture->ci.hCursor);
	if (!icon)
		return;

	if (GetIconInfo(icon, &ii)) {
		POINT pos;
		pos.x = ci->ptScreenPos.x - (int)ii.xHotspot - capture->x;
		pos.y = ci->ptScreenPos.y - (int)ii.yHotspot - capture->y;

		DrawIcon(hdc, pos.x, pos.y, icon);

		DeleteObject(ii.hbmColor);
		DeleteObject(ii.hbmMask);
	}

	DestroyIcon(icon);
}
开发者ID:GamingAtheist,项目名称:obs-studio,代码行数:26,代码来源:dc-capture.c

示例9: IconToBitmap

Gdiplus::GpBitmap* IconToBitmap(HICON hIcon)
{
    ICONINFO iconInfo;
    if (!GetIconInfo(hIcon, &iconInfo))
        return nullptr;

    Gdiplus::GpBitmap* pBitmap = nullptr;
    if (Gdiplus::Ok != gdi_call(GdipCreateBitmapFromHICON)(hIcon, &pBitmap))
        return nullptr;

    Gdiplus::GpBitmap* pBmpMask = nullptr;
    if (Gdiplus::Ok != gdi_call(GdipCreateBitmapFromHBITMAP)(iconInfo.hbmMask, NULL, &pBmpMask))
        return nullptr;

    FGdipBitmapSetPixel SetPixel = gdi_call(GdipBitmapSetPixel);
    FGdipBitmapGetPixel GetPixel = gdi_call(GdipBitmapGetPixel);

    Gdiplus::ARGB pixel, mask;
    for (UINT y = 0; y < iconInfo.yHotspot * 2; ++y)
    {
        for (UINT x = 0; x < iconInfo.xHotspot * 2; ++x)
        {
            GetPixel(pBitmap, x, y, &pixel);
            GetPixel(pBmpMask, x, y, &mask);
            SetPixel(pBitmap, x, y, pixel | mask);
        }
    }

    gdi_call(GdipDisposeImage)(pBmpMask);

    return pBitmap;
}
开发者ID:01org,项目名称:IntelSEAPI,代码行数:32,代码来源:sea_itt_lib.cpp

示例10: KILOBYTES

    // private
    //-------------------------------------------------------------------------
    Hash HandleCache::_CalculateHash( HCURSOR hcursor )
    {
        static const ULong HASH_BUFFER_LIMIT = KILOBYTES(8);
    
        ICONINFO    iconinfo = {0};
        LONG        count;
        Byte        buffer[HASH_BUFFER_LIMIT];

        // require valid
        if( hcursor == NULL )
            return 0;

        // get icon info
        if( GetIconInfo(hcursor, &iconinfo) == FALSE )
            return 0;

        // get icon bitmap buffer
        count = GetBitmapBits( iconinfo.hbmColor ? iconinfo.hbmColor : iconinfo.hbmMask, sizeof(buffer), buffer );

        // iconinfo cleanup 
        if( iconinfo.hbmColor )
            DeleteObject(iconinfo.hbmColor);
        if( iconinfo.hbmMask )
            DeleteObject(iconinfo.hbmMask);

        // fail if no bits read
        if(count == 0)
            return 0;

        // generate hash
        return Tools::Fnv164Hash(buffer, count);
    }
开发者ID:jamesbascle,项目名称:YoloMouse,代码行数:34,代码来源:HandleCache.cpp

示例11: GetBufferedPaintBits

HRESULT IconBitmapUtils::ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hdc, HICON hicon, SIZE& sizIcon)
{
    RGBQUAD *prgbQuad;
    int cxRow;
    HRESULT hr = GetBufferedPaintBits(hPaintBuffer, &prgbQuad, &cxRow);
    if (FAILED(hr))
        return hr;

    Gdiplus::ARGB *pargb = reinterpret_cast<Gdiplus::ARGB *>(prgbQuad);
    if (HasAlpha(pargb, sizIcon, cxRow))
        return S_OK;

    ICONINFO info;
    if (!GetIconInfo(hicon, &info))
        return S_OK;
    SCOPE_EXIT
    {
        DeleteObject(info.hbmColor);
        DeleteObject(info.hbmMask);
    };
    if (info.hbmMask)
        return ConvertToPARGB32(hdc, pargb, info.hbmMask, sizIcon, cxRow);

    return S_OK;
}
开发者ID:Teivaz,项目名称:TortoiseGit,代码行数:25,代码来源:IconBitmapUtils.cpp

示例12: GetIconInfo

Gdiplus::Bitmap* GdiplusUtilities::FromHICON32(HICON hIcon)
{
	Gdiplus::Bitmap* ret = NULL;
	ICONINFO iconInfo;
	GetIconInfo(hIcon, &iconInfo);
	BITMAP bitmapData;
	GetObject(iconInfo.hbmColor, sizeof(BITMAP), &bitmapData);

	if (bitmapData.bmBitsPixel != 32)
		ret = Gdiplus::Bitmap::FromHICON(hIcon);
	else
	{
		ret = new Gdiplus::Bitmap(bitmapData.bmWidth, bitmapData.bmHeight, PixelFormat32bppARGB);
		Gdiplus::BitmapData bmpData;
		ret->LockBits(&Gdiplus::Rect(0,0,bitmapData.bmWidth, bitmapData.bmHeight), Gdiplus::ImageLockModeWrite, PixelFormat32bppARGB, &bmpData);
#ifndef GetDIBitsVERSION
		//===Version GetBitmapBits
		// THIS FUNCTION IS UNDER TESTING. WHAT IF THE bitmap stride is different? Where will the new data go?
		ASSERT(bmpData.Stride == bmpData.Width * 4);
		::GetBitmapBits(iconInfo.hbmColor, 4 * bitmapData.bmWidth * bitmapData.bmHeight, bmpData.Scan0);
		//===Version GetBitmapBits===END
#else
		//===Version GetDIBits (incomplete)
		::GetDIBits(GetDC(), iconInfo.hbmColor, 0, bitmapData.bm)
			//===Version GetDIBits
#endif
			ret->UnlockBits(&bmpData);
	} 
	DeleteObject(iconInfo.hbmColor);
	DeleteObject(iconInfo.hbmMask);
	return ret;
}
开发者ID:KurzedMetal,项目名称:Jaangle,代码行数:32,代码来源:GdiplusUtilities.cpp

示例13: PhpConvertToPArgb32IfNeeded

static VOID PhpConvertToPArgb32IfNeeded(
    _In_ HPAINTBUFFER PaintBuffer,
    _In_ HDC hdc,
    _In_ HICON Icon,
    _In_ ULONG Width,
    _In_ ULONG Height
    )
{
    RGBQUAD *quad;
    ULONG rowWidth;

    if (SUCCEEDED(GetBufferedPaintBits_I(PaintBuffer, &quad, &rowWidth)))
    {
        PULONG argb = (PULONG)quad;

        if (!PhpHasAlpha(argb, Width, Height, rowWidth))
        {
            ICONINFO iconInfo;

            if (GetIconInfo(Icon, &iconInfo))
            {
                if (iconInfo.hbmMask)
                {
                    PhpConvertToPArgb32(hdc, argb, iconInfo.hbmMask, Width, Height, rowWidth);
                }

                DeleteObject(iconInfo.hbmColor);
                DeleteObject(iconInfo.hbmMask);
            }
        }
    }
}
开发者ID:Azarien,项目名称:processhacker2,代码行数:32,代码来源:icotobmp.c

示例14: GetBufferedPaintBits

HRESULT LiferayNativityContextMenus::_ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hdc, HICON hicon, SIZE& sizIcon)
{
	RGBQUAD *prgbQuad;
	int cxRow;
	HRESULT hResult = GetBufferedPaintBits(hPaintBuffer, &prgbQuad, &cxRow);

	if (SUCCEEDED(hResult))
	{
		Gdiplus::ARGB *pargb = reinterpret_cast<Gdiplus::ARGB *>(prgbQuad);

		if (!_HasAlpha(pargb, sizIcon, cxRow))
		{
			ICONINFO info;

			if (GetIconInfo(hicon, &info))
			{

				if (info.hbmMask)
				{
					hResult = _ConvertToPARGB32(hdc, pargb, info.hbmMask, sizIcon, cxRow);
				}

				DeleteObject(info.hbmColor);
				DeleteObject(info.hbmMask);
			}
		}
	}

	return hResult;
}
开发者ID:iterate-ch,项目名称:liferay-nativity,代码行数:30,代码来源:LiferayNativityContextMenus.cpp

示例15: GetIconInfo

CSize SIconWnd::GetDesiredSize(LPRECT pRcContainer)
{
    if(!m_theIcon) return CSize();
    ICONINFO iconInfo={0};
    GetIconInfo(m_theIcon,&iconInfo);
    
    return CSize(iconInfo.xHotspot*2,iconInfo.yHotspot*2);
}
开发者ID:blueantst,项目名称:soui,代码行数:8,代码来源:SCmnCtrl.cpp


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