本文整理汇总了C++中DestroyIcon函数的典型用法代码示例。如果您正苦于以下问题:C++ DestroyIcon函数的具体用法?C++ DestroyIcon怎么用?C++ DestroyIcon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DestroyIcon函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: new
//.........这里部分代码省略.........
//------------------------------------------------------------------------------
IFACEMETHODIMP CDevicePropertyPage::AddPages(
__in LPFNADDPROPSHEETPAGE pfnAddPage,
__in LPARAM lParam
)
{
HPROPSHEETPAGE hPage;
HRESULT hr = S_OK;
PROPSHEETPAGE psp = {0};
PROPSINPUT* pPropsInput = NULL;
if( NULL == pfnAddPage )
{
return E_INVALIDARG;
}
//
// Allocate the PROPSINPUT struct
//
pPropsInput = new (std::nothrow) PROPSINPUT;
if( NULL == pPropsInput )
{
hr = E_OUTOFMEMORY;
}
if( S_OK == hr )
{
//
// Fill out the PROPSHEETPAGE structure
//
psp.dwSize = sizeof(PROPSHEETPAGE);
psp.dwFlags = PSP_USECALLBACK;
psp.hInstance = g_hInstance;
psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_DEVICE);
psp.pfnDlgProc = PropPageDlgProc;
psp.lParam = reinterpret_cast<LPARAM>( pPropsInput );
psp.pfnCallback = PropPageDlgCleanup;
//
// Give a reference to the shell item to the callback data
//
hr = m_pShellItem->QueryInterface( &pPropsInput->pShellItem );
}
//
// Grab the icon from the shell item
//
if( S_OK == hr )
{
hr = GetIconFromItem( m_pShellItem, SHIL_LARGE, &pPropsInput->hIcon );
}
//
// Create the page
//
hPage = CreatePropertySheetPage( &psp );
if( NULL == hPage )
{
hr = E_OUTOFMEMORY;
}
//
// Give the shell the page
//
if( S_OK == hr &&
!pfnAddPage( hPage, lParam ) )
{
hr = E_FAIL;
}
//
// As the documentation for AddPages describes, you can "request" that your
// page is the one visibile when the property sheet is loaded. You can do
// this by giving the index of the page you added (1 based). In this sample
// we just added one page, so we can return 1 instead of the HR (assuming
// we didn't fail) to request our page to be the one visible on launch.
// Keep in mind it is a "request" and is not guaranteed.
//
if( S_OK == hr )
{
hr = static_cast<HRESULT>(1);
}
else
{
if( NULL != hPage )
{
DestroyPropertySheetPage( hPage );
}
if( NULL != pPropsInput->pShellItem )
{
pPropsInput->pShellItem->Release();
}
if( NULL != pPropsInput->hIcon )
{
DestroyIcon( pPropsInput->hIcon );
}
}
return hr;
}// CDevicePropertyPage::AddPages
示例2: ExtractIndifySizeIcon
bool ExtractIndifySizeIcon(LPCTSTR strExeFile,LPCTSTR strNameNoExt,UINT iSizeBig,UINT iSizeSmall,int iIndexICon = 0)
{
HICON hIconArry[2];
UINT uSize = (iSizeSmall<<16) + iSizeBig;
BOOL bok1 = false;
BOOL bok2 = false;
CString strNamePart;
strNamePart.Format("_%d.png",iSizeBig);
string strPngFileBig = string(strNameNoExt) + (LPCTSTR)strNamePart;
strNamePart.Format("_%d.png",iSizeSmall);
string strPngFileSmall = string(strNameNoExt) + (LPCTSTR)strNamePart;
HRESULT hr = SHDefExtractIcon(strExeFile,iIndexICon,0,hIconArry,NULL,uSize); //提取大图标
if (S_OK == hr)
{
bok1 = SavePngFile(hIconArry[0],strPngFileBig.c_str());
if (!bok1)
ZTools::WriteZToolsFormatLog("保存png文件【%s】失败!",strPngFileBig.c_str());
}
else if (hr == S_FALSE)
{
ZTools::WriteZToolsFormatLog("从文件【%s】中获取索引为【%d】,尺寸为【%d】的图标失败:The requested icon is not present.",
strExeFile,iIndexICon,iSizeBig);
}
else if (hr == E_FAIL)
{
ZTools::WriteZToolsFormatLog("从文件【%s】中获取索引为【%d】,尺寸为【%d】的图标失败:The file cannot be accessed, or is being accessed through a slow link.",
strExeFile,iIndexICon,iSizeBig);
}
hr = SHDefExtractIcon(strExeFile,iIndexICon,0,NULL,&hIconArry[1],uSize);
if (S_OK == hr)
{
bok2 = SavePngFile(hIconArry[1],strPngFileSmall.c_str());
if (!bok2)
ZTools::WriteZToolsFormatLog("保存png文件【%s】失败!",strPngFileSmall.c_str());
}
else if (hr == S_FALSE)
{
ZTools::WriteZToolsFormatLog("从文件【%s】中获取索引为【%d】,尺寸为【%d】的图标失败:The requested icon is not present.",
strExeFile,iIndexICon,iSizeSmall);
}
else if (hr == E_FAIL)
{
ZTools::WriteZToolsFormatLog("从文件【%s】中获取索引为【%d】,尺寸为【%d】的图标失败:The file cannot be accessed, or is being accessed through a slow link.",
strExeFile,iIndexICon,iSizeSmall);
}
if (bok1 && !bok2) //保存小图标,用大图标拉伸
{
bok2 = SavePngFile(hIconArry[0],strPngFileSmall.c_str(),iSizeSmall,iSizeSmall);
DestroyIcon(hIconArry[0]);
}
else if (!bok1 && bok2) //保存大图标,用小图标拉伸
{
bok1 = SavePngFile(hIconArry[1],strPngFileBig.c_str(),iSizeBig,iSizeBig);
DestroyIcon(hIconArry[1]);
}
if (bok1 && bok2) // 大小图标都提取保存失败
{
DestroyIcon(hIconArry[0]);
DestroyIcon(hIconArry[1]);
return true;
}
if (!bok1 && !bok2) // 大小图标都提取保存失败
return false;
return false;
}
示例3: StatusMenuCheckService
//.........这里部分代码省略.........
char buf[255];
mir_snprintf(buf, SIZEOF(buf), "*XStatus%d", XStatus);
bool check = wildcmp(smep->svc, buf) != 0;
bool reset = wildcmp(smep->svc, "*XStatus0") != 0;
if (check)
timi->mi.flags |= CMIF_CHECKED;
else
timi->mi.flags &= ~CMIF_CHECKED;
if (reset || check) {
PMO_IntMenuItem timiParent = MO_GetIntMenuItem(timi->mi.root);
if (timiParent) {
CLISTMENUITEM mi2 = { sizeof(mi2) };
mi2.flags = CMIM_NAME | CMIF_TCHAR;
mi2.ptszName = TranslateTH(timi->mi.hLangpack, timi->mi.hIcon ? timi->mi.ptszName : LPGENT("Custom status"));
timiParent = MO_GetIntMenuItem(timi->mi.root);
MenuItemData it = { 0 };
if (FindMenuHandleByGlobalID(hStatusMenu, timiParent, &it)) {
MENUITEMINFO mi = { 0 };
TCHAR d[100];
GetMenuString(it.OwnerMenu, it.position, d, SIZEOF(d), MF_BYPOSITION);
mi.cbSize = sizeof(mi);
mi.fMask = MIIM_STRING | MIIM_STATE;
if (timi->iconId != -1) {
mi.fMask |= MIIM_BITMAP;
if (IsWinVerVistaPlus() && IsThemeActive()) {
if (timi->hBmp == NULL)
timi->hBmp = ConvertIconToBitmap(NULL, timi->parent->m_hMenuIcons, timi->iconId);
mi.hbmpItem = timi->hBmp;
}
else mi.hbmpItem = HBMMENU_CALLBACK;
}
mi.fState |= (check && !reset ? MFS_CHECKED : MFS_UNCHECKED);
mi.dwTypeData = mi2.ptszName;
SetMenuItemInfo(it.OwnerMenu, it.position, TRUE, &mi);
}
Menu_ModifyItem(timi->mi.root, &mi2);
timiParent->iconId = timi->iconId;
if (timiParent->hBmp) DeleteObject(timiParent->hBmp);
timiParent->hBmp = NULL;
}
}
}
}
else if (smep && smep->status && !smep->custom) {
int curProtoStatus = (smep->proto) ? CallProtoServiceInt(NULL, smep->proto, PS_GETSTATUS, 0, 0) : cli.pfnGetAverageMode(NULL);
if (smep->status == curProtoStatus)
timi->mi.flags |= CMIF_CHECKED;
else
timi->mi.flags &= ~CMIF_CHECKED;
}
else if ((!smep || smep->proto) && timi->mi.pszName) {
int curProtoStatus = 0;
BOOL IconNeedDestroy = FALSE;
char* prot;
if (smep)
prot = smep->proto;
else {
char *prn = mir_u2a(timi->mi.ptszName);
prot = NEWSTR_ALLOCA(prn);
if (prn) mir_free(prn);
}
if (Proto_GetAccount(prot) == NULL)
return TRUE;
if ((curProtoStatus = CallProtoServiceInt(NULL, prot, PS_GETSTATUS, 0, 0)) == CALLSERVICE_NOTFOUND)
curProtoStatus = 0;
if (curProtoStatus >= ID_STATUS_OFFLINE && curProtoStatus < ID_STATUS_IDLE)
timi->mi.hIcon = LoadSkinProtoIcon(prot, curProtoStatus);
else {
timi->mi.hIcon = (HICON)CallProtoServiceInt(NULL, prot, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
if (timi->mi.hIcon == (HICON)CALLSERVICE_NOTFOUND)
timi->mi.hIcon = NULL;
else
IconNeedDestroy = TRUE;
}
if (timi->mi.hIcon) {
timi->mi.flags |= CMIM_ICON;
MO_ModifyMenuItem(timi, &timi->mi);
if (IconNeedDestroy) {
DestroyIcon(timi->mi.hIcon);
timi->mi.hIcon = NULL;
}
else IcoLib_ReleaseIcon(timi->mi.hIcon, 0);
}
}
return TRUE;
}
示例4: rcCloseBtn
void CTrashSkipCtrl::_DrawSoftItem(CDC& dc, CRect& rcDraw, int nItemIndex)
{
TRASH_SKIP_ITEM item = m_vecItems[nItemIndex];
HICON hIcon = NULL;
CRect rcCloseBtn(rcDraw);
int xSrc;
_DrawItemBackgnd(dc, rcDraw, nItemIndex);
Gdiplus::Graphics graphics(dc);
rcCloseBtn.left = rcDraw.right - 25;
rcCloseBtn.bottom = rcDraw.top + 25;
if (m_nHoverIndex == nItemIndex && m_nSelectIndex == -1)
{
xSrc = 25;
}
else if (m_nSelectIndex == nItemIndex)
{
xSrc = 50;
}
else
{
xSrc = 0;
}
graphics.DrawImage(m_imgSoftOff, rcCloseBtn.left, rcCloseBtn.top, xSrc, 0, 25, 25, Gdiplus::UnitPixel);
::CopyRect(m_vecItems[nItemIndex].rcItem, rcCloseBtn);
_GetItemIcon(item.strIconPath, hIcon);
CRect rcIcon(rcDraw);
rcIcon.left += (DEF_ITEM_WIDTH - 6 - 32) / 2;
rcIcon.top += 24;
if (!hIcon)
{
KAppRes& res = KAppRes::Instance();
if (item.nItemID == BROWER_IE)
{
hIcon = m_iconIE;
}
else
{
hIcon = m_iconUnknow;
}
dc.DrawIcon(rcIcon.left, rcIcon.top, hIcon);
}
else
{
dc.DrawIconEx(rcIcon.left, rcIcon.top, hIcon, 32, 32);
}
_DrawItemText(dc, rcDraw, item.strName);
if (hIcon && (hIcon != m_iconIE && hIcon != m_iconUnknow))
{
DestroyIcon(hIcon);
}
}
示例5: ToolbarGetImage
//.........这里部分代码省略.........
if (ToolStatusConfig.ModernIcons)
{
toolbarBitmap = LoadImageFromResources(cx, cy, MAKEINTRESOURCE(IDB_APPLICATION_MODERN));
}
else
{
toolbarBitmap = ToolbarLoadImageFromIcon(cx, cy, MAKEINTRESOURCE(IDI_TBAPPLICATION));
}
return toolbarBitmap;
}
break;
case TIDC_FINDWINDOWTHREAD:
{
HBITMAP toolbarBitmap = NULL;
if (ToolStatusConfig.ModernIcons)
{
toolbarBitmap = LoadImageFromResources(cx, cy, MAKEINTRESOURCE(IDB_APPLICATION_GO_MODERN));
}
else
{
toolbarBitmap = ToolbarLoadImageFromIcon(cx, cy, MAKEINTRESOURCE(IDI_APPLICATION_GO));
}
return toolbarBitmap;
}
break;
case TIDC_FINDWINDOWKILL:
{
HBITMAP toolbarBitmap = NULL;
if (ToolStatusConfig.ModernIcons)
{
toolbarBitmap = LoadImageFromResources(cx, cy, MAKEINTRESOURCE(IDB_CROSS_MODERN));
}
else
{
toolbarBitmap = ToolbarLoadImageFromIcon(cx, cy, MAKEINTRESOURCE(IDI_CROSS));
}
return toolbarBitmap;
}
break;
case PHAPP_ID_VIEW_ALWAYSONTOP:
{
HBITMAP toolbarBitmap = NULL;
if (ToolStatusConfig.ModernIcons)
{
toolbarBitmap = LoadImageFromResources(cx, cy, MAKEINTRESOURCE(IDB_APPLICATION_GET_MODERN));
}
else
{
toolbarBitmap = ToolbarLoadImageFromIcon(cx, cy, MAKEINTRESOURCE(IDI_APPLICATION_GET));
}
return toolbarBitmap;
}
break;
case TIDC_POWERMENUDROPDOWN:
{
HBITMAP toolbarBitmap = NULL;
if (ToolStatusConfig.ModernIcons)
{
toolbarBitmap = LoadImageFromResources(cx, cy, MAKEINTRESOURCE(IDB_POWER_MODERN));
}
else
{
toolbarBitmap = ToolbarLoadImageFromIcon(cx, cy, MAKEINTRESOURCE(IDI_LIGHTBULB_OFF));
}
return toolbarBitmap;
}
break;
case PHAPP_ID_HACKER_SHOWDETAILSFORALLPROCESSES:
{
HBITMAP toolbarBitmap = NULL;
HICON shieldIcon = NULL;
if (shieldIcon = PhLoadIcon(NULL, IDI_SHIELD, PH_LOAD_ICON_SIZE_SMALL | PH_LOAD_ICON_STRICT, 0, 0))
{
toolbarBitmap = PhIconToBitmap(
shieldIcon,
cx,
cy
);
DestroyIcon(shieldIcon);
}
return toolbarBitmap;
}
break;
}
return NULL;
}
示例6: WinObjExMain
//.........这里部分代码省略.........
// set tree imagelist
TreeViewImages = supLoadImageList(g_hInstance, IDI_ICON_VIEW_DEFAULT, IDI_ICON_VIEW_SELECTED);
if (TreeViewImages) {
TreeView_SetImageList(ObjectTree, TreeViewImages, TVSIL_NORMAL);
}
//not enough user rights, insert run as admin menu entry and hide admin only stuff
if (IsFullAdmin == FALSE) {
hMenu = GetSubMenu(GetMenu(MainWindow), 0);
InsertMenu(hMenu, 0, MF_BYPOSITION, ID_FILE_RUNASADMIN, T_RUNASADMIN);
InsertMenu(hMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
//set menu shield icon
RtlSecureZeroMemory(&sii, sizeof(sii));
sii.cbSize = sizeof(sii);
if (SHGetStockIconInfo(SIID_SHIELD, SHGSI_ICON | SHGFI_SMALLICON, &sii) == S_OK) {
supSetMenuIcon(hMenu, ID_FILE_RUNASADMIN, (ULONG_PTR)sii.hIcon);
}
//require driver usage, remove
DeleteMenu(GetSubMenu(GetMenu(MainWindow), 4), ID_EXTRAS_SSDT, MF_BYCOMMAND);
DeleteMenu(GetSubMenu(GetMenu(MainWindow), 4), ID_EXTRAS_PRIVATENAMESPACES, MF_BYCOMMAND);
}
//unsupported
if (g_kdctx.osver.dwBuildNumber > 10240) {
DeleteMenu(GetSubMenu(GetMenu(MainWindow), 4), ID_EXTRAS_PRIVATENAMESPACES, MF_BYCOMMAND);
}
//load listview images
ListViewImages = supLoadImageList(g_hInstance, IDI_ICON_DEVICE, IDI_ICON_UNKNOWN);
if (ListViewImages) {
tmpb = LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ICON_SORTUP), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
if (tmpb) {
ImageList_ReplaceIcon(ListViewImages, -1, tmpb);
DestroyIcon(tmpb);
}
tmpb = LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ICON_SORTDOWN), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
if (tmpb) {
ImageList_ReplaceIcon(ListViewImages, -1, tmpb);
DestroyIcon(tmpb);
}
ListView_SetImageList(ObjectList, ListViewImages, LVSIL_SMALL);
}
//load toolbar images
ToolBarMenuImages = ImageList_LoadImage(g_hInstance, MAKEINTRESOURCE(IDB_BITMAP1),
16, 7, CLR_DEFAULT, IMAGE_BITMAP, LR_CREATEDIBSECTION);
if (ToolBarMenuImages) {
supCreateToolbarButtons(ToolBar1);
//set menu icons
hMenu = GetSubMenu(GetMenu(MainWindow), 1);
if (hMenu) {
supSetMenuIcon(hMenu, ID_VIEW_REFRESH,
(ULONG_PTR)ImageList_ExtractIcon(g_hInstance, ToolBarMenuImages, 1));
}
hMenu = GetSubMenu(GetMenu(MainWindow), 2);
if (hMenu && ListViewImages) {
supSetMenuIcon(hMenu, ID_OBJECT_PROPERTIES,
(ULONG_PTR)ImageList_ExtractIcon(g_hInstance, ToolBarMenuImages, 0));
supSetMenuIcon(hMenu, ID_OBJECT_GOTOLINKTARGET,
(ULONG_PTR)ImageList_ExtractIcon(g_hInstance, ListViewImages,
ID_FROM_VALUE(IDI_ICON_SYMLINK)));
}
示例7: LoadLSImage
//.........这里部分代码省略.........
rc.left = 0;
rc.right = wdtResult;
rc.bottom = hgtResult;
// paint the background in transparent color...
hbrTransparent = CreateSolidBrush(RGB(255, 0, 255));
FillRect(hdcResult, &rc, hbrTransparent);
DeleteObject(hbrTransparent);
// first "standard blit" the second image into the new one:
BitBlt(hdcResult, (wdtResult - wdtSecond) / 2,
(hgtResult - hgtSecond) / 2, wdtSecond, hgtSecond,
hdcSecond, 0, 0, SRCCOPY);
// Secondly "tranparent blit" the first image over the
// second one Since TransparentBltLS double buffers the
// painting to reduce flicker and we are using only memory
// DC's in this function, we will just call
// TransparentBltLSWorker and shave off a few BitBlt calls
TransparentBltLSWorker(hdcResult, wdtFirst, hgtFirst,
hdcFirst, 0, 0, RGB(255, 0, 255));
// deselect the bitmap from the dc and delete the dc to get
// the image
SelectObject(hdcResult, hbmResultOld);
DeleteDC(hdcResult);
// delete all used objects
SelectObject(hdcFirst, hbmFirstOld);
DeleteObject(hbmFirst);
DeleteDC(hdcFirst);
SelectObject(hdcSecond, hbmSecondOld);
DeleteObject(hbmSecond);
DeleteDC(hdcSecond);
hbmReturn = hbmResult;
}
else
{
hbmReturn = hbmFirst;
}
}
else
{
if (!_strnicmp(szImage, ".extract", 8 /*strlen(".extract")*/))
{
HICON hIcon = NULL;
hIcon = LoadLSIcon(szImage, pszFile);
if (hIcon)
{
hbmReturn = BitmapFromIcon(hIcon);
DestroyIcon(hIcon);
}
}
else
{
// Append the image name to the LiteStep image path and
// attempt to load the image.
char szExpandedImage[MAX_PATH];
VarExpansionEx(szExpandedImage, szImage, MAX_PATH);
LSGetImagePath(szImage, MAX_PATH);
PathAppend(szImage, szExpandedImage);
if (PathMatchSpec(szImage, "*.png"))
{
hbmReturn = LoadFromPNG(szImage);
}
else
{
hbmReturn = (HBITMAP)LoadImage(
NULL, szImage, IMAGE_BITMAP, 0, 0,
LR_DEFAULTCOLOR | LR_LOADFROMFILE);
}
// If that fails, treat the image as a fully qualified path
// and try loading it
if (hbmReturn == NULL)
{
if (PathMatchSpec(szExpandedImage, "*.png"))
{
hbmReturn = LoadFromPNG(szExpandedImage);
}
else
{
hbmReturn = (HBITMAP)LoadImage(
NULL, szExpandedImage, IMAGE_BITMAP, 0, 0,
LR_DEFAULTCOLOR | LR_LOADFROMFILE);
}
}
}
}
}
}
return hbmReturn;
}
示例8: BeginPaint
//.........这里部分代码省略.........
{
manager.getLine(address,displaySymbols,line);
int rowY1 = rowHeight*i;
int rowY2 = rowHeight*(i+1);
addressPositions[address] = rowY1;
// draw background
COLORREF backgroundColor = whiteBackground ? 0xFFFFFF : debugger->getColor(address);
COLORREF textColor = 0x000000;
if (isInInterval(address,line.totalSize,debugger->getPC()))
{
backgroundColor = scaleColor(backgroundColor,1.05f);
}
if (address >= selectRangeStart && address < selectRangeEnd && searching == false)
{
if (hasFocus)
{
backgroundColor = address == curAddress ? 0xFF8822 : 0xFF9933;
textColor = 0xFFFFFF;
} else {
backgroundColor = 0xC0C0C0;
}
}
HBRUSH backgroundBrush = CreateSolidBrush(backgroundColor);
HPEN backgroundPen = CreatePen(0,0,backgroundColor);
SelectObject(hdc,backgroundBrush);
SelectObject(hdc,backgroundPen);
Rectangle(hdc,0,rowY1,rect.right,rowY1+rowHeight);
SelectObject(hdc,currentBrush);
SelectObject(hdc,nullPen);
DeleteObject(backgroundBrush);
DeleteObject(backgroundPen);
// display address/symbol
bool enabled;
if (CBreakPoints::IsAddressBreakPoint(address,&enabled))
{
if (enabled) textColor = 0x0000FF;
int yOffset = max(-1,(rowHeight-14+1)/2);
if (!enabled) yOffset++;
DrawIconEx(hdc,2,rowY1+1+yOffset,enabled ? breakPoint : breakPointDisable,32,32,0,0,DI_NORMAL);
}
SetTextColor(hdc,textColor);
char addressText[64];
getDisasmAddressText(address,addressText,true,line.type == DISTYPE_OPCODE);
TextOutA(hdc,pixelPositions.addressStart,rowY1+2,addressText,(int)strlen(addressText));
if (isInInterval(address,line.totalSize,debugger->getPC()))
{
TextOut(hdc,pixelPositions.opcodeStart-8,rowY1,L"■",1);
}
// display whether the condition of a branch is met
if (line.info.isConditional && address == debugger->getPC())
{
line.params += line.info.conditionMet ? " ; true" : " ; false";
}
drawArguments(hdc, line, pixelPositions.argumentsStart, rowY1 + 2, textColor, currentArguments);
SelectObject(hdc,boldfont);
TextOutA(hdc,pixelPositions.opcodeStart,rowY1+2,line.name.c_str(),(int)line.name.size());
SelectObject(hdc,font);
address += line.totalSize;
}
std::vector<BranchLine> branchLines = manager.getBranchLines(windowStart,address-windowStart);
for (size_t i = 0; i < branchLines.size(); i++)
{
drawBranchLine(hdc,addressPositions,branchLines[i]);
}
SelectObject(hdc,oldFont);
SelectObject(hdc,oldPen);
SelectObject(hdc,oldBrush);
// copy bitmap to the actual hdc
BitBlt(actualHdc, 0, 0, rect.right, rect.bottom, hdc, 0, 0, SRCCOPY);
DeleteObject(hBM);
DeleteDC(hdc);
DeleteObject(nullPen);
DeleteObject(nullBrush);
DeleteObject(currentBrush);
DestroyIcon(breakPoint);
DestroyIcon(breakPointDisable);
EndPaint(wnd, &ps);
}
示例9: test_CreateBitmapFromHICON
static void test_CreateBitmapFromHICON(void)
{
static const char bits[4096];
HICON icon;
ICONINFO info;
HRESULT hr;
IWICBitmap *bitmap;
UINT width, height;
WICPixelFormatGUID format;
/* 1 bpp mask */
info.fIcon = 1;
info.xHotspot = 0;
info.yHotspot = 0;
info.hbmColor = 0;
info.hbmMask = CreateBitmap(16, 32, 1, 1, bits);
ok(info.hbmMask != 0, "CreateBitmap failed\n");
icon = CreateIconIndirect(&info);
ok(icon != 0, "CreateIconIndirect failed\n");
DeleteObject(info.hbmMask);
hr = IWICImagingFactory_CreateBitmapFromHICON(factory, 0, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
hr = IWICImagingFactory_CreateBitmapFromHICON(factory, 0, &bitmap);
ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_CURSOR_HANDLE), "expected ERROR_INVALID_CURSOR_HANDLE, got %#x\n", hr);
hr = IWICImagingFactory_CreateBitmapFromHICON(factory, icon, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
hr = IWICImagingFactory_CreateBitmapFromHICON(factory, icon, &bitmap);
ok(hr == S_OK, "CreateBitmapFromHICON error %#x\n", hr);
DestroyIcon(icon);
if (hr != S_OK) return;
IWICBitmap_GetPixelFormat(bitmap, &format);
ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppBGRA),
"unexpected pixel format %s\n", wine_dbgstr_guid(&format));
hr = IWICBitmap_GetSize(bitmap, &width, &height);
ok(hr == S_OK, "IWICBitmap_GetSize error %#x\n", hr);
ok(width == 16, "expected 16, got %u\n", width);
ok(height == 16, "expected 16, got %u\n", height);
IWICBitmap_Release(bitmap);
/* 24 bpp color, 1 bpp mask */
info.fIcon = 1;
info.xHotspot = 0;
info.yHotspot = 0;
info.hbmColor = CreateBitmap(16, 16, 1, 24, bits);
ok(info.hbmColor != 0, "CreateBitmap failed\n");
info.hbmMask = CreateBitmap(16, 16, 1, 1, bits);
ok(info.hbmMask != 0, "CreateBitmap failed\n");
icon = CreateIconIndirect(&info);
ok(icon != 0, "CreateIconIndirect failed\n");
DeleteObject(info.hbmColor);
DeleteObject(info.hbmMask);
hr = IWICImagingFactory_CreateBitmapFromHICON(factory, icon, &bitmap);
ok(hr == S_OK, "CreateBitmapFromHICON error %#x\n", hr);
DestroyIcon(icon);
IWICBitmap_GetPixelFormat(bitmap, &format);
ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppBGRA),
"unexpected pixel format %s\n", wine_dbgstr_guid(&format));
hr = IWICBitmap_GetSize(bitmap, &width, &height);
ok(hr == S_OK, "IWICBitmap_GetSize error %#x\n", hr);
ok(width == 16, "expected 16, got %u\n", width);
ok(height == 16, "expected 16, got %u\n", height);
IWICBitmap_Release(bitmap);
}
示例10: PhpProcessRecordDlgProc
//.........这里部分代码省略.........
SetDlgItemText(hwndDlg, IDC_PARENT, PhaFormatString(L"Non-existent process (%u)",
(ULONG)context->Record->ParentProcessId)->Buffer);
}
PhDereferenceObject(processItem);
}
else
{
SetDlgItemText(hwndDlg, IDC_PARENT, PhaFormatString(L"Unknown process (%u)",
(ULONG)context->Record->ParentProcessId)->Buffer);
EnableWindow(GetDlgItem(hwndDlg, IDC_PROPERTIES), FALSE);
}
memset(&versionInfo, 0, sizeof(PH_IMAGE_VERSION_INFO));
versionInfoInitialized = FALSE;
if (context->Record->FileName)
{
if (PhInitializeImageVersionInfo(&versionInfo, context->Record->FileName->Buffer))
versionInfoInitialized = TRUE;
}
context->FileIcon = PhGetFileShellIcon(PhGetString(context->Record->FileName), L".exe", TRUE);
SendMessage(GetDlgItem(hwndDlg, IDC_OPENFILENAME), BM_SETIMAGE, IMAGE_BITMAP,
(LPARAM)PH_LOAD_SHARED_IMAGE(MAKEINTRESOURCE(IDB_FOLDER), IMAGE_BITMAP));
SendMessage(GetDlgItem(hwndDlg, IDC_FILEICON), STM_SETICON,
(WPARAM)context->FileIcon, 0);
SetDlgItemText(hwndDlg, IDC_NAME, PhpGetStringOrNa(versionInfo.FileDescription));
SetDlgItemText(hwndDlg, IDC_COMPANYNAME, PhpGetStringOrNa(versionInfo.CompanyName));
SetDlgItemText(hwndDlg, IDC_VERSION, PhpGetStringOrNa(versionInfo.FileVersion));
SetDlgItemText(hwndDlg, IDC_FILENAME, PhpGetStringOrNa(context->Record->FileName));
if (versionInfoInitialized)
PhDeleteImageVersionInfo(&versionInfo);
if (!context->Record->FileName)
EnableWindow(GetDlgItem(hwndDlg, IDC_OPENFILENAME), FALSE);
SetDlgItemText(hwndDlg, IDC_CMDLINE, PhpGetStringOrNa(context->Record->CommandLine));
if (context->Record->CreateTime.QuadPart != 0)
SetDlgItemText(hwndDlg, IDC_STARTED, PhapGetRelativeTimeString(&context->Record->CreateTime)->Buffer);
else
SetDlgItemText(hwndDlg, IDC_STARTED, L"N/A");
if (context->Record->ExitTime.QuadPart != 0)
SetDlgItemText(hwndDlg, IDC_TERMINATED, PhapGetRelativeTimeString(&context->Record->ExitTime)->Buffer);
else
SetDlgItemText(hwndDlg, IDC_TERMINATED, L"N/A");
SetDlgItemInt(hwndDlg, IDC_SESSIONID, context->Record->SessionId, FALSE);
}
break;
case WM_DESTROY:
{
if (context->FileIcon)
DestroyIcon(context->FileIcon);
}
break;
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDCANCEL:
case IDOK:
{
EndDialog(hwndDlg, IDOK);
}
break;
case IDC_OPENFILENAME:
{
if (context->Record->FileName)
PhShellExploreFile(hwndDlg, context->Record->FileName->Buffer);
}
break;
case IDC_PROPERTIES:
{
PPH_PROCESS_ITEM processItem;
if (processItem = PhReferenceProcessItemForRecord(context->Record))
{
ProcessHacker_ShowProcessProperties(PhMainWndHandle, processItem);
PhDereferenceObject(processItem);
}
else
{
PhShowError(hwndDlg, L"The process has already terminated; only the process record is available.");
}
}
break;
}
}
break;
}
return FALSE;
}
示例11: VERIFY
// adds buttons to the toolbar
void
TableTabInterfaceTabMgmt::AddToolButtons()
{
INT i=0,j, size;
LONG ret;
HICON hicon;
TBBUTTON tbb[30];
wyInt32 command[] = { IDI_ADDROW,
IDI_DELETEROW,
IDM_SEPARATOR,
IDI_MOVEUP,
IDI_MOVEDOWN
};
wyUInt32 states[][2] = {
{TBSTATE_ENABLED, TBSTYLE_BUTTON},
{TBSTATE_ENABLED, TBSTYLE_BUTTON},
{TBSTATE_ENABLED, TBSTYLE_SEP},
{TBSTATE_ENABLED, TBSTYLE_BUTTON},
{TBSTATE_ENABLED, TBSTYLE_BUTTON}
};
wyInt32 imgres[] = {
IDI_ADDROW,
IDI_DELETEROW,
IDI_USERS,
IDI_MOVEUP,
IDI_MOVEDOWN
};
VERIFY(m_himglist = ImageList_Create(ICON_SIZE, ICON_SIZE, ILC_COLOR32 | ILC_MASK, 1, 0));
SendMessage(m_hwndtool, TB_SETIMAGELIST, 0, (LPARAM)m_himglist);
SendMessage(m_hwndtool, TB_SETEXTENDEDSTYLE, 0 , (LPARAM)TBSTYLE_EX_DRAWDDARROWS);
SendMessage(m_hwndtool, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
size = sizeof(command)/sizeof(command[0]);
// set some required values
SendMessage(m_hwndtool, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
// now create everything for the toolbar.
for(j=0; j < size; j++)
{
hicon = (HICON)LoadImage(pGlobals->m_hinstance, MAKEINTRESOURCE ( imgres[j] ), IMAGE_ICON, ICON_SIZE, ICON_SIZE, LR_DEFAULTCOLOR);
VERIFY((i = ImageList_AddIcon(m_himglist, hicon))!= -1);
VERIFY(DestroyIcon(hicon));
memset(&tbb[j], 0, sizeof(TBBUTTON));
tbb[j].iBitmap = MAKELONG(i, 0);
tbb[j].idCommand = command[j];
tbb[j].fsState = (UCHAR)states[j][0];
tbb[j].fsStyle = (UCHAR)states[j][1];
}
VERIFY((ret = SendMessage(m_hwndtool, TB_ADDBUTTONS, (WPARAM)size,(LPARAM) &tbb)!= FALSE));
/* Now set and show the toolbar */
SendMessage(m_hwndtool, TB_AUTOSIZE, 0, 0);
ShowWindow(m_hwndtool, SW_SHOW);
}
示例12: DestroyIcon
Icon::~Icon()
{
DestroyIcon(m_hIcon);
}
示例13: Layout
//.........这里部分代码省略.........
bool bOver = nHotItem == i && IS_ENABLED(tbbutton);
bool bPressed = false;
if ( IS_INDETERMINATE(tbbutton) )
{
CPenDC pen (cDC, ::GetSysColor (COLOR_3DDKSHADOW));
cDC.MoveTo (rcButton.left, rcButton.bottom);
cDC.LineTo (rcButton.left, rcButton.top);
cDC.LineTo (rcButton.right-1, rcButton.top);
cDC.LineTo (rcButton.right-1, rcButton.bottom-1);
cDC.LineTo (rcButton.left, rcButton.bottom-1);
bOver = true;
}
else if ( bOver || IS_CHECKED(tbbutton) )
{
bPressed = KEYDOWN(VK_LBUTTON) && rcButton.PtInRect (ptCursor);
if ( IS_DROPDOWN(tbbutton) && bPressed )
{
bPressed = ptCursor.x < rcButton.right-13;
if ( bPressed )
{
rcButton.right -= 13;
}
}
COLORREF crHighLight = ::GetSysColor (COLOR_HIGHLIGHT);
CPenDC pen (cDC, crHighLight);
CBrushDC brush (cDC, bPressed||(bOver&&IS_CHECKED(tbbutton)) ? HLS_TRANSFORM (crHighLight, +50, -50) : (bOver ? HLS_TRANSFORM (crHighLight, +70, -57) : HLS_TRANSFORM (crHighLight, +80, -66)));
cDC.Rectangle (&rcButton);
if ( IS_DROPDOWN(tbbutton) )
{
if ( bPressed )
{
int nLeft = rcButton.left;
rcButton.left = rcButton.right-1;
rcButton.right += 13;
brush.Color (HLS_TRANSFORM (crHighLight, +70, -66));
cDC.Rectangle (&rcButton);
rcButton.left = nLeft;
}
else
{
cDC.MoveTo (rcButton.right-14, rcButton.top);
cDC.LineTo (rcButton.right-14, rcButton.bottom);
}
}
}
if ( IS_SEPARATOR(tbbutton) )
{
CPenDC pen (cDC, HLS_TRANSFORM (::GetSysColor (COLOR_3DFACE), -15, 0));
if ( IS_WRAP(tbbutton) )
{
cDC.MoveTo (rcClient.left+2, rcButton.bottom-4);
cDC.LineTo (rcClient.right-2, rcButton.bottom-4);
}
else
{
cDC.MoveTo ((rcButton.right+rcButton.left)/2-1, rcButton.top+2);
cDC.LineTo ((rcButton.right+rcButton.left)/2-1, rcButton.bottom-2);
}
}
else if ( !IS_CONTROL(tbbutton) )
{
if ( IS_DROPDOWN(tbbutton) )
{
CPenDC pen (cDC, ( bOver && !IS_INDETERMINATE(tbbutton) ) ? RGB(0,0,0) : ::GetSysColor (IS_ENABLED(tbbutton) ? COLOR_BTNTEXT : COLOR_GRAYTEXT));
cDC.MoveTo (rcButton.right-9, (rcButton.top+rcButton.bottom)/2-1);
cDC.LineTo (rcButton.right-4, (rcButton.top+rcButton.bottom)/2-1);
cDC.MoveTo (rcButton.right-8, (rcButton.top+rcButton.bottom)/2);
cDC.LineTo (rcButton.right-5, (rcButton.top+rcButton.bottom)/2);
cDC.SetPixel (rcButton.right-7, (rcButton.top+rcButton.bottom)/2+1, pen.Color());
rcButton.right -= 14;
}
if ( tbbutton.iBitmap >= 0 )
{
if ( !IS_ENABLED(tbbutton) || (bOver && !bPressed) )
{
HICON hIcon = ImageList_ExtractIcon (NULL, m_hImageList, tbbutton.iBitmap);
cDC.DrawState (CPoint (rcButton.left + ( bOver ? 4 : 3 ), rcButton.top + ( bOver ? 4 : 3 )), m_sizeImage, hIcon, DSS_MONO, CBrush (bOver ? (IS_INDETERMINATE(tbbutton) ? HLS_TRANSFORM (::GetSysColor (COLOR_3DFACE), -20, 0) : HLS_TRANSFORM (::GetSysColor (COLOR_HIGHLIGHT), +50, -66)) : HLS_TRANSFORM (::GetSysColor (COLOR_3DFACE), -27, 0)));
DestroyIcon (hIcon);
}
if ( IS_ENABLED(tbbutton) )
{
::ImageList_Draw (m_hImageList, tbbutton.iBitmap, cDC.m_hDC,
rcButton.left + ( (bOver && !bPressed) ? 2 : 3 ), rcButton.top + ( (bOver && !bPressed) ? 2 : 3 ), ILD_TRANSPARENT);
}
}
}
}
}
示例14: DestroyIcon
CPPageFileInfoRes::~CPPageFileInfoRes()
{
if (m_hIcon) {
DestroyIcon(m_hIcon);
}
}
示例15:
CMediaVisDlg::~CMediaVisDlg()
{
if ( m_hIcon ) DestroyIcon( m_hIcon );
}