您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CreateIconIndirect函数代码示例

51自学网 2021-06-01 20:14:42
  C++
这篇教程C++ CreateIconIndirect函数代码示例写得很实用,希望能帮到您。

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

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

示例1: windowsIcon

	bool IconImpl::Create(const Image& icon)	{		Image windowsIcon(icon); // Vive le COW		if (!windowsIcon.Convert(PixelFormatType_BGRA8))		{			NazaraError("Failed to convert icon to BGRA8");			return false;		}		HBITMAP bitmap = CreateBitmap(windowsIcon.GetWidth(), windowsIcon.GetHeight(), 1, 32, windowsIcon.GetConstPixels());		HBITMAP monoBitmap = CreateBitmap(windowsIcon.GetWidth(), windowsIcon.GetHeight(), 1, 1, nullptr);		// http://msdn.microsoft.com/en-us/library/windows/desktop/ms648052(v=vs.85).aspx		ICONINFO iconInfo;		iconInfo.fIcon = TRUE;		iconInfo.hbmMask = monoBitmap;		iconInfo.hbmColor = bitmap;		m_icon = CreateIconIndirect(&iconInfo);		DeleteObject(bitmap);		DeleteObject(monoBitmap);		if (!m_icon)		{			NazaraError("Failed to create icon: " + Error::GetLastSystemError());			return false;		}		return true;	}
开发者ID:GigAnon,项目名称:NazaraEngine,代码行数:31,


示例2: sys_cursor_create_common

static Status sys_cursor_create_common(int w, int h, void* bgra_img, void* mask_img, int hx, int hy, sys_cursor* cursor){	*cursor = 0;	// MSDN says selecting this HBITMAP into a DC is slower since we use	// CreateBitmap; bpp/format must be checked against those of the DC.	// this is the simplest way and we don't care about slight performance	// differences because this is typically only called once.	HBITMAP hbmColor = CreateBitmap(w, h, 1, 32, bgra_img);	// CreateIconIndirect doesn't access this; we just need to pass	// an empty bitmap.	HBITMAP hbmMask = CreateBitmap(w, h, 1, 1, mask_img);	// create the cursor (really an icon; they differ only in	// fIcon and the hotspot definitions).	ICONINFO ii;	ii.fIcon = FALSE;  // cursor	ii.xHotspot = (DWORD)hx;	ii.yHotspot = (DWORD)hy;	ii.hbmMask  = hbmMask;	ii.hbmColor = hbmColor;	HICON hIcon = CreateIconIndirect(&ii);	// CreateIconIndirect makes copies, so we no longer need these.	DeleteObject(hbmMask);	DeleteObject(hbmColor);	if(!wutil_IsValidHandle(hIcon))		WARN_RETURN(ERR::FAIL);	*cursor = cursor_from_HICON(hIcon);	return INFO::OK;}
开发者ID:righnatios,项目名称:0ad,代码行数:34,


示例3: GetDC

*/	HCURSOR Image_To_Cursor(REBYTE* image, REBINT width, REBINT height)/***      Converts REBOL image! to Windows CURSOR*************************************************************************/{	int xHotspot = 0;	int yHotspot = 0;	HICON result = NULL;	HBITMAP hSourceBitmap;	BITMAPINFO  BitmapInfo;	ICONINFO iconinfo;    //Get the system display DC    HDC hDC = GetDC(NULL);	//Create DIB	unsigned char* ppvBits;	int bmlen = width * height * 4;	int i;	BitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);	BitmapInfo.bmiHeader.biWidth = width;	BitmapInfo.bmiHeader.biHeight = -(signed)height;	BitmapInfo.bmiHeader.biPlanes = 1;	BitmapInfo.bmiHeader.biBitCount = 32;	BitmapInfo.bmiHeader.biCompression = BI_RGB;	BitmapInfo.bmiHeader.biSizeImage = 0;	BitmapInfo.bmiHeader.biXPelsPerMeter = 0;	BitmapInfo.bmiHeader.biYPelsPerMeter = 0;	BitmapInfo.bmiHeader.biClrUsed = 0;	BitmapInfo.bmiHeader.biClrImportant = 0;	hSourceBitmap = CreateDIBSection(hDC, &BitmapInfo, DIB_RGB_COLORS, (void**)&ppvBits, NULL, 0);	//Release the system display DC    ReleaseDC(NULL, hDC);	//Copy the image content to DIB	COPY_MEM(ppvBits, image, bmlen);	//Invert alphachannel from the REBOL format	for (i = 3;i < bmlen;i+=4){		ppvBits[i] ^= 0xff;	}	//Create the cursor using the masks and the hotspot values provided	iconinfo.fIcon		= FALSE;	iconinfo.xHotspot	= xHotspot;	iconinfo.yHotspot	= yHotspot;	iconinfo.hbmMask	= hSourceBitmap;	iconinfo.hbmColor	= hSourceBitmap;	result = CreateIconIndirect(&iconinfo);	DeleteObject(hSourceBitmap);	return result;}
开发者ID:alepharchives,项目名称:R3A110,代码行数:60,


示例4: l_ui_create_cursor

static RD_HCURSORl_ui_create_cursor(struct rdp_inst * inst, uint32 x, uint32 y,	int width, int height, uint8 * andmask, uint8 * xormask, int bpp){	wfInfo * wfi;	HCURSOR cursor;	ICONINFO iconinfo;	uint8 * cdata;	wfi = GET_WFI(inst);	if (bpp == 1)	{		cursor = CreateCursor(g_hInstance, x, y, width, height, andmask, xormask);	}	else	{		iconinfo.fIcon = FALSE;		iconinfo.xHotspot = x;		iconinfo.yHotspot = y;		cdata = wf_cursor_mask_convert(wfi, width, height, andmask);		iconinfo.hbmMask = CreateBitmap(width, height, 1, 1, cdata);		iconinfo.hbmColor = wf_create_dib(wfi, width, height, bpp, 0, xormask);		cursor = CreateIconIndirect(&iconinfo);		DeleteObject(iconinfo.hbmMask);		DeleteObject(iconinfo.hbmColor);		free(cdata);	}	return (RD_HCURSOR)cursor;}
开发者ID:alama,项目名称:freerdp,代码行数:29,


示例5: QBitmap

HCURSOR QWindowsCursor::createPixmapCursor(const QPixmap &pixmap, int hotX, int hotY){    HCURSOR cur = 0;    QBitmap mask = pixmap.mask();    if (mask.isNull()) {        mask = QBitmap(pixmap.size());        mask.fill(Qt::color1);    }    HBITMAP ic = qt_pixmapToWinHBITMAP(pixmap, /* HBitmapAlpha */ 2);    const HBITMAP im = qt_createIconMask(mask);    ICONINFO ii;    ii.fIcon     = 0;    ii.xHotspot  = hotX;    ii.yHotspot  = hotY;    ii.hbmMask   = im;    ii.hbmColor  = ic;    cur = CreateIconIndirect(&ii);    DeleteObject(ic);    DeleteObject(im);    return cur;}
开发者ID:3163504123,项目名称:phantomjs,代码行数:25,


示例6: ASSERT

HICON CTrayNotifyIcon::BitmapToIcon(CBitmap* pBitmap){  //Validate our parameters  ASSERT(pBitmap);  //Get the width and height of a small icon  int w = GetSystemMetrics(SM_CXSMICON);  int h = GetSystemMetrics(SM_CYSMICON);  //Create a 0 mask  int nMaskSize = h*(w/8);  unsigned char* pMask = new unsigned char[nMaskSize];  ZeroMemory(pMask, nMaskSize);  //Create a mask bitmap  CBitmap maskBitmap;  BOOL bSuccess = maskBitmap.CreateBitmap(w, h, 1, 1, pMask);  //Free up the heap memory now that we have created the mask bitmap  delete [] pMask;  //Handle the error  if (!bSuccess)    return NULL;  //Create an ICON base on the bitmap just created  ICONINFO iconInfo;  iconInfo.fIcon = TRUE;  iconInfo.xHotspot = 0;  iconInfo.yHotspot = 0;  iconInfo.hbmMask = maskBitmap;  iconInfo.hbmColor = *pBitmap;   return CreateIconIndirect(&iconInfo); }
开发者ID:flebel,项目名称:Dorgem,代码行数:34,


示例7: WARN

///// Creates an icon object with the given ICONINFO information.//TIcon::TIcon(const ICONINFO& iconInfo){  WARN(!iconInfo.fIcon, "TIcon constructor called with ICONINFO::fIcon == false"); // Turn this into a precondition?  ICONINFO i = iconInfo; // Make a clone, since CreateIconIndirect is not const-correct.  Handle = CreateIconIndirect(&i);  CheckValid();}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:10,


示例8: PhpSearchBitmapToIcon

HICON PhpSearchBitmapToIcon(    _In_ HBITMAP BitmapHandle,    _In_ INT Width,    _In_ INT Height    ){    HICON icon;    HDC screenDc;    HBITMAP screenBitmap;    ICONINFO iconInfo = { 0 };    screenDc = GetDC(NULL);    screenBitmap = CreateCompatibleBitmap(screenDc, Width, Height);    iconInfo.fIcon = TRUE;    iconInfo.hbmColor = BitmapHandle;    iconInfo.hbmMask = screenBitmap;    icon = CreateIconIndirect(&iconInfo);    DeleteObject(screenBitmap);    ReleaseDC(NULL, screenDc);    return icon;}
开发者ID:amitamitamitamit,项目名称:processhacker2,代码行数:25,


示例9: setcursor

static void setcursor(uint8_t * rgba, int16_t hotx, int16_t hoty) {        HDC dc;        HBITMAP bm;        ICONINFO ii;        BITMAPV5HEADER bh;        int i;        uint8_t * bits;        ZeroMemory(&bh, sizeof(bh));        bh.bV5Size = sizeof(bh);        bh.bV5Width = 32;        bh.bV5Height = -32;        bh.bV5Planes = 1;        bh.bV5BitCount = 32;        bh.bV5Compression = BI_RGB;        dc = GetDC(g_win);        bm = CreateDIBSection(dc, (BITMAPINFO*)&bh, DIB_RGB_COLORS, (void **)&bits, 0, 0);        ReleaseDC(g_win, dc);        for (i = 0; i < 32*32; i++) {                bits[4*i+0] = rgba[4*i+2];                bits[4*i+1] = rgba[4*i+1];                bits[4*i+2] = rgba[4*i+0];                bits[4*i+3] = rgba[4*i+3];        }        if (bits[3] == 0)                bits[3] = 1; // workaround for vbox        ii.fIcon = FALSE;        ii.xHotspot = hotx;        ii.yHotspot = hoty;        ii.hbmColor = bm;        ii.hbmMask = CreateBitmap(32, 32, 1, 1, 0);         g_cursor = CreateIconIndirect(&ii);        SetCursor(g_cursor);        DeleteObject(bm);        DeleteObject(ii.hbmMask);}
开发者ID:jacereda,项目名称:glcv,代码行数:35,


示例10: CreateCompatibleBitmap

Cursor::Cursor(fs::path imgPath, float hotSpotX, float hotSpotY) {	sf::Image gif;	if(!gif.loadFromFile(imgPath.string())) {		std::string error = "Error loading cursor from " + imgPath.string();		throw error;	}	// Calculate the AND and XOR masks	HBITMAP cursorAnd = CreateCompatibleBitmap(GetDC(NULL), gif.getSize().x, gif.getSize().y);	HBITMAP cursorXor = CreateCompatibleBitmap(GetDC(NULL), gif.getSize().x, gif.getSize().y);	GetMaskBitmaps(gif, cursorAnd, cursorXor);	ICONINFO iconinfo = {0};	iconinfo.fIcon = FALSE;	iconinfo.xHotspot = hotSpotX;	iconinfo.yHotspot = hotSpotY;	iconinfo.hbmMask = cursorAnd;	iconinfo.hbmColor = cursorXor;	HCURSOR hCursor = CreateIconIndirect(&iconinfo);	if(hCursor == NULL) {		std::string error = "Error creating cursor from " + imgPath.string();		error += " (error code " + std::to_string(GetLastError()) + ")";		throw error;	}	ptr = hCursor;	DeleteObject(cursorAnd);	DeleteObject(cursorXor);}
开发者ID:calref,项目名称:cboe,代码行数:28,


示例11: CreateLayoutIcon

static HICONCreateLayoutIcon(LPTSTR szInd){    HDC hdc, hdcsrc;    HBITMAP hBitmap, hBmpNew, hBmpOld;    RECT rect;    DWORD bkColor, bkText;    HFONT hFont = NULL;    ICONINFO IconInfo;    HICON hIcon = NULL;    hdcsrc = GetDC(NULL);    hdc = CreateCompatibleDC(hdcsrc);    hBitmap = CreateCompatibleBitmap(hdcsrc, 16, 16);    ReleaseDC(NULL, hdcsrc);    if (hdc && hBitmap)    {        hBmpNew = CreateBitmap(16, 16, 1, 1, NULL);        if (hBmpNew)        {            hBmpOld = SelectObject(hdc, hBitmap);            rect.right = 16;            rect.left = 0;            rect.bottom = 16;            rect.top = 0;            bkColor = SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT));            bkText  = SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));            ExtTextOut(hdc, rect.left, rect.top, ETO_OPAQUE, &rect, _T(""), 0, NULL);            hFont = CreateFont(-11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,                               OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,                               DEFAULT_QUALITY, FF_DONTCARE, _T("Tahoma"));            SelectObject(hdc, hFont);            DrawText(hdc, _tcsupr(szInd), 2, &rect, DT_SINGLELINE|DT_CENTER|DT_VCENTER);            SelectObject(hdc, hBmpNew);            PatBlt(hdc, 0, 0, 16, 16, BLACKNESS);            SelectObject(hdc, hBmpOld);            IconInfo.hbmColor = hBitmap;            IconInfo.hbmMask = hBmpNew;            IconInfo.fIcon = TRUE;            hIcon = CreateIconIndirect(&IconInfo);            DeleteObject(hBmpNew);            DeleteObject(hBmpOld);            DeleteObject(hFont);        }    }    DeleteDC(hdc);    DeleteObject(hBitmap);    return hIcon;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:59,


示例12: WARN

///// Creates a TCursor object from the specified ICONINFO structure information.//TCursor::TCursor(const ICONINFO& iconInfo){  WARN(iconInfo.fIcon, "TCursor constructor called with ICONINFO::fIcon == true"); // Turn this into a precondition?  ICONINFO i = iconInfo; // Make a clone, since CreateIconIndirect is not const-correct.  Handle = CreateIconIndirect(&i);  CheckValid();  TRACEX(OwlGDI, OWL_CDLEVEL, "TCursor constructed indirectly @" << static_cast<void*>(this));}
开发者ID:Meridian59,项目名称:Meridian59,代码行数:11,


示例13: image_make_icon_handle

HICONimage_make_icon_handle( Handle img, Point size, Point * hotSpot){   PIcon i = ( PIcon) img;   HICON    r;   ICONINFO ii;   int    bpp = i-> type & imBPP;   Bool  noSZ   = i-> w != size. x || i-> h != size. y;   Bool  noBPP  = bpp != 1 && bpp != 4 && bpp != 8 && bpp != 24;   HDC dc;   XBITMAPINFO bi;   Bool notAnIcon = !kind_of( img, CIcon);   ii. fIcon = hotSpot ? false : true;   ii. xHotspot = hotSpot ? hotSpot-> x : 0;   ii. yHotspot = hotSpot ? hotSpot-> y : 0;   if ( noSZ || noBPP) {      i = ( PIcon)( i-> self-> dup( img));      if ( noSZ)         i-> self-> set_size(( Handle) i, size);      if ( noBPP)         i-> self-> set_type(( Handle) i,             ( bpp < 4) ? 1 :             (( bpp < 8) ? 4 :             (( bpp < 24) ? 8 : 24))      );   }   if (!( dc = dc_alloc())) {      if (( Handle) i != img) Object_destroy(( Handle) i);      return NULL;   }   image_get_binfo(( Handle)i, &bi);   if ( bi. bmiHeader. biClrUsed > 0)      bi. bmiHeader. biClrUsed = bi. bmiHeader. biClrImportant = i-> palSize;   if ( !( ii. hbmColor = CreateDIBitmap( dc, &bi. bmiHeader, CBM_INIT,       i-> data, ( BITMAPINFO*) &bi, DIB_RGB_COLORS))) apiErr;   bi. bmiHeader. biBitCount = bi. bmiHeader. biPlanes = 1;   bi. bmiColors[ 0]. rgbRed = bi. bmiColors[ 0]. rgbGreen = bi. bmiColors[ 0]. rgbBlue = 0;   bi. bmiColors[ 1]. rgbRed = bi. bmiColors[ 1]. rgbGreen = bi. bmiColors[ 1]. rgbBlue = 255;   if ( !( ii. hbmMask  = CreateDIBitmap( dc, &bi. bmiHeader, CBM_INIT,      notAnIcon ? NULL : i-> mask, ( BITMAPINFO*) &bi, DIB_RGB_COLORS))) apiErr;      dc_free();   if ( !( r = CreateIconIndirect( &ii))) apiErr;   DeleteObject( ii. hbmColor);   DeleteObject( ii. hbmMask);   if (( Handle) i != img) Object_destroy(( Handle) i);   return r;}
开发者ID:Absolight,项目名称:Prima,代码行数:56,


示例14: WIN_CreateCursor

static SDL_Cursor *WIN_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y){    SDL_Cursor *cursor;    HICON hicon;    HDC hdc;    BITMAPV4HEADER bmh;    LPVOID pixels;    ICONINFO ii;    SDL_zero(bmh);    bmh.bV4Size = sizeof(bmh);    bmh.bV4Width = surface->w;    bmh.bV4Height = -surface->h; /* Invert the image */    bmh.bV4Planes = 1;    bmh.bV4BitCount = 32;    bmh.bV4V4Compression = BI_BITFIELDS;    bmh.bV4AlphaMask = 0xFF000000;    bmh.bV4RedMask   = 0x00FF0000;    bmh.bV4GreenMask = 0x0000FF00;    bmh.bV4BlueMask  = 0x000000FF;    hdc = GetDC(NULL);    SDL_zero(ii);    ii.fIcon = FALSE;    ii.xHotspot = (DWORD)hot_x;    ii.yHotspot = (DWORD)hot_y;    ii.hbmColor = CreateDIBSection(hdc, (BITMAPINFO*)&bmh, DIB_RGB_COLORS, &pixels, NULL, 0);    ii.hbmMask = CreateBitmap(surface->w, surface->h, 1, 1, NULL);    ReleaseDC(NULL, hdc);    SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);    SDL_assert(surface->pitch == surface->w * 4);    SDL_memcpy(pixels, surface->pixels, surface->h * surface->pitch);    hicon = CreateIconIndirect(&ii);    DeleteObject(ii.hbmColor);    DeleteObject(ii.hbmMask);    if (!hicon) {        WIN_SetError("CreateIconIndirect()");        return NULL;    }    cursor = SDL_calloc(1, sizeof(*cursor));    if (cursor) {        cursor->driverdata = hicon;    } else {        DestroyIcon(hicon);        SDL_OutOfMemory();    }    return cursor;}
开发者ID:ktj007,项目名称:mmo,代码行数:55,


示例15: memset

void Icon::fromBitmap(Bitmap *bitmap, Bitmap *mask){  ICONINFO ii;  memset(&ii, 0, sizeof(ICONINFO));  ii.hbmColor = (bitmap != 0) ? bitmap->m_bitmap : 0;  ii.hbmMask = (mask != 0) ? mask->m_bitmap : 0;  m_icon = CreateIconIndirect(&ii);}
开发者ID:gwupe,项目名称:GwupeSupportScreen,代码行数:11,


示例16: DeleteObject

UINT ExtractIcons::_ExtractFromBMP( LPCTSTR pFileName, int iconIndex,                                    int cxIcon, int cyIcon,                                    HICON* phicon, UINT flags ){    if( iconIndex >= 1 )        return 0;    flags |= LR_LOADFROMFILE;    HBITMAP hbm = (HBITMAP)LoadImage( NULL, pFileName, IMAGE_BITMAP,                                      cxIcon, cyIcon, flags );    if( hbm == NULL )        return 0;    if( phicon == NULL )    {        DeleteObject(hbm);        return 1;    }    HBITMAP hbmMask = CreateBitmap( cxIcon, cyIcon, 1, 1, NULL );    HDC hdc = CreateCompatibleDC(NULL);    SelectObject( hdc, hbm );    HDC hdcMask = CreateCompatibleDC(NULL);    SelectObject(hdcMask, hbmMask);    SetBkColor( hdc, GetPixel(hdc, 0, 0) );// this ROP Code will leave bits in the destination bitmap the same color if the// corresponding source bitmap's bit are black.// all other bits in the destination (where source bits are not black)// are turned to black.#define DSTERASE 0x00220326 // dest = dest & (~src) :    BitBlt( hdcMask, 0, 0, cxIcon, cyIcon, hdc, 0, 0, SRCCOPY );    BitBlt( hdc, 0, 0, cxIcon, cyIcon, hdcMask, 0, 0, DSTERASE );    ICONINFO ii;    ii.fIcon    = TRUE;    ii.xHotspot = 0;    ii.yHotspot = 0;    ii.hbmColor = hbm;    ii.hbmMask  = hbmMask;    HICON hicon = CreateIconIndirect( &ii );    DeleteObject(hdc);    DeleteObject(hbm);    DeleteObject(hdcMask);    DeleteObject(hbmMask);    *phicon = hicon;    return 1;}
开发者ID:valiyuneski,项目名称:wxquickrun,代码行数:52,


示例17: trayicon_draw

static HICON trayicon_draw(Trayicon *t, char *text, int len){	ICONINFO iconInfo;	HBITMAP hOldBitmap;	HFONT hOldFont;	hOldBitmap = (HBITMAP) SelectObject(t->mdc, t->hBitmap);	hOldFont = (HFONT) SelectObject(t->mdc, t->hFont);	TextOut(t->mdc, t->bitmapWidth / 4, 0, text, len);	SelectObject(t->mdc, hOldBitmap);	SelectObject(t->mdc, hOldFont);	iconInfo = (ICONINFO){TRUE, 0, 0, t->hBitmap, t->hBitmap};	return CreateIconIndirect(&iconInfo);}
开发者ID:Ouimoi,项目名称:virgo,代码行数:13,


示例18: 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,


示例19: trayicon_draw

static HICON trayicon_draw(Trayicon *t, char *text, unsigned len){	ICONINFO iconInfo;	HBITMAP hOldBitmap;	HFONT hOldFont;	hOldBitmap = (HBITMAP) SelectObject(t->mdc, t->hBitmap);	hOldFont = (HFONT) SelectObject(t->mdc, t->hFont);	TextOut(t->mdc, t->bitmapWidth / 4, 0, text, len);	SelectObject(t->mdc, hOldBitmap);	SelectObject(t->mdc, hOldFont);	iconInfo.fIcon = TRUE;	iconInfo.xHotspot = iconInfo.yHotspot = 0;	iconInfo.hbmMask = iconInfo.hbmColor = t->hBitmap;	return CreateIconIndirect(&iconInfo);}
开发者ID:xiaokaixuan,项目名称:virgo,代码行数:15,


示例20: CreateCompatibleBitmap

	/*static*/	HICON Win32UIBinding::BitmapToIcon(HBITMAP bitmap, int sizeX, int sizeY)	{		if (!bitmap)			return 0;		HBITMAP bitmapMask = CreateCompatibleBitmap(GetDC(NULL), sizeX, sizeY);		ICONINFO iconInfo = {0};		iconInfo.fIcon = TRUE;		iconInfo.hbmMask = bitmapMask;		iconInfo.hbmColor = bitmap;		HICON icon = CreateIconIndirect(&iconInfo);		DeleteObject(bitmapMask);				return icon;	}
开发者ID:JamesHayton,项目名称:titanium_desktop,代码行数:16,


示例21: MakeGrayscaleIcon

HICON MakeGrayscaleIcon(HICON SourceIcon){	ICONINFO TargetIconInfo;	BITMAP TargetBitmapInfo;	HICON TargetIcon, TempIcon;	TempIcon = CopyIcon(SourceIcon);	if (! GetIconInfo(TempIcon, &TargetIconInfo) || GetObject(TargetIconInfo.hbmColor, sizeof(BITMAP), &TargetBitmapInfo)==0) return NULL;	MakeGrayscale(&TargetIconInfo.hbmColor);	TargetIcon = CreateIconIndirect(&TargetIconInfo);	DestroyIcon(TempIcon);	return TargetIcon;}
开发者ID:aventado,项目名称:secureimplugin,代码行数:16,


示例22: ResizeIconCentered

// return value needs to be released using DestroyIcon()// only operates on color icons, which isn't a problem herestatic HICON __fastcall ResizeIconCentered(HICON hIcon, int cx, int cy){	HICON hResIcon = nullptr;	HDC hdc = CreateCompatibleDC(nullptr);	if (hdc != nullptr) {		ICONINFO icoi;		if (GetIconInfo(hIcon, &icoi)) {			BITMAP bm;			if (GetObject(icoi.hbmColor, sizeof(bm), &bm) && bm.bmWidth <= cx && bm.bmHeight <= cy) {				POINT pt;				pt.x = (cx - bm.bmWidth) / 2;				pt.y = (cy - bm.bmHeight) / 2;				HBITMAP hbmPrev = (HBITMAP)SelectObject(hdc, icoi.hbmColor);				if (hbmPrev != nullptr) { /* error on select? */					HBITMAP hbm = icoi.hbmColor;					icoi.hbmColor = CreateCompatibleBitmap(hdc, cx, cy);					if (icoi.hbmColor != nullptr)						if (SelectObject(hdc, icoi.hbmColor) != nullptr) { /* error on select? */							DeleteObject(hbm); /* delete prev color (XOR) */							if (BitBlt(hdc, 0, 0, cx, cy, nullptr, 0, 0, BLACKNESS)) /* transparency: AND=0, XOR=1 */								if (DrawIconEx(hdc, pt.x, pt.y, hIcon, bm.bmWidth, bm.bmHeight, 0, nullptr, DI_IMAGE | DI_NOMIRROR)) {									if (SelectObject(hdc, icoi.hbmMask) != nullptr) { /* error on select? */										hbm = icoi.hbmMask;										icoi.hbmMask = CreateBitmap(cx, cy, 1, 1, nullptr); /* mono */										if (icoi.hbmMask != nullptr)											if (SelectObject(hdc, icoi.hbmMask) != nullptr) { /* error on select? */												DeleteObject(hbm); /* delete prev mask (AND) */												if (BitBlt(hdc, 0, 0, cx, cy, nullptr, 0, 0, WHITENESS)) /* transparency: AND=0, XOR=1 */													if (DrawIconEx(hdc, pt.x, pt.y, hIcon, 0, 0, 0, nullptr, DI_MASK | DI_NOMIRROR)) {														SelectObject(hdc, hbmPrev);														hResIcon = CreateIconIndirect(&icoi); /* bitmaps must not be selected */													}											}									}								}						}					SelectObject(hdc, hbmPrev);				}			}			DeleteObject(icoi.hbmColor);			DeleteObject(icoi.hbmMask);		}		DeleteDC(hdc);	}	return hResIcon;}
开发者ID:tweimer,项目名称:miranda-ng,代码行数:48,


示例23: CreateTimeIcon

HICON CreateTimeIcon(SYSTEMTIME* time) {	WORD matrix[][2] = { {10, 10}, {10, 5}, {10, 0}, {5, 10}, {5, 5}, {5, 0}, {0, 10}, {0, 5}, {0, 0} };	HDC hdc0, hdc1;	HGDIOBJ undo;	HBITMAP bmp, mask;	HICON ret;	ICONINFO ii = {TRUE};	HBRUSH brush0, brush1;	RECT rect;	WORD x;	brush0 = CreateSolidBrush(RGB(0, 0, 0));	brush1 = CreateSolidBrush(RGB(255, 255, 255));	hdc0 = GetDC(NULL);	bmp = CreateCompatibleBitmap(hdc0, 16, 16);	mask = CreateCompatibleBitmap(hdc0, 16, 16);	hdc1 = CreateCompatibleDC(hdc0);	rect.left = 0; rect.top = 0; rect.right = 16; rect.bottom = 16;	undo = SelectObject(hdc1, mask); FillRect(hdc1, &rect, brush1);	x = time->wMinute + (time->wHour % 6 << 6);	for (int i = 0; i < 9; i++, x /= 2) {		if (x % 2) {			rect.left = matrix[i][0]; rect.top = matrix[i][1]; rect.right = rect.left + 6; rect.bottom = rect.top + 6;			SelectObject(hdc1, mask); FillRect(hdc1, &rect, brush0);			rect.left++; rect.top++; rect.right--; rect.bottom--;			SelectObject(hdc1, bmp); FillRect(hdc1, &rect, brush1);		}	}	ReleaseDC(NULL, hdc0);	SelectObject(hdc1, undo); DeleteDC(hdc1);	DeleteObject(brush0);	DeleteObject(brush1);	ii.hbmColor = bmp;	ii.hbmMask = mask;	ret = CreateIconIndirect(&ii);	DeleteObject(bmp);	DeleteObject(mask);	return ret;}
开发者ID:alexmarsev,项目名称:traybin,代码行数:45,


示例24: DuplicateIcon

/************************************************************************* * DuplicateIcon            [[email
C++ CreateImage函数代码示例
C++ CreateHookableEvent函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。