Esempio n. 1
0
HICON CBionicWindow::RefreshIcon()
  {
          //If window is closed, return the default icon.
      if(!IsWindow(m_hWinHwnd))
          return AfxGetApp()->LoadIcon(IDR_MAINFRAME);

      if(m_hIcon)
          return m_hIcon;

      if((m_hIcon = CopyIcon((HICON)::SendMessage(m_hWinHwnd,WM_GETICON,ICON_BIG,0))))
          return m_hIcon;

      if((m_hIcon = CopyIcon((HICON)::SendMessage(m_hWinHwnd,WM_GETICON,ICON_SMALL,0))))
          return m_hIcon;

      if((m_hIcon = CopyIcon((HICON)::GetClassLong(m_hWinHwnd,GCL_HICON))))
          return m_hIcon;

      if((m_hIcon = CopyIcon((HICON)::GetClassLong(m_hWinHwnd,GCL_HICONSM))))
          return m_hIcon;

//    if((m_hIcon = CopyIcon((HICON)::SendMessage(m_hWinHwnd,WM_GETICON,ICON_BIG,0)))   ||
//       (m_hIcon = CopyIcon((HICON)::SendMessage(m_hWinHwnd,WM_GETICON,ICON_SMALL,0))) ||
//       (m_hIcon = CopyIcon((HICON)::GetClassLong(m_hWinHwnd,GCL_HICON)))              ||
//       (m_hIcon = CopyIcon((HICON)::GetClassLong(m_hWinHwnd,GCL_HICONSM))))
//        return m_hIcon;

      m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); //If all else fails, use the default icon.
      m_bIconDefault = TRUE;
      return m_hIcon;
  }
Esempio n. 2
0
void CSametimeProto::RegisterPopups()
{
	TCHAR szDescr[256];
	char szName[256];

	debugLog(_T("CSametimeProto::RegisterPopups()"));

	POPUPCLASS puc = { sizeof(puc) };
	puc.PluginWindowProc = PopupWindowProc;
	puc.flags = PCF_TCHAR;
	puc.ptszDescription = szDescr;
	puc.pszName = szName;

	mir_snprintf(szName, _countof(szName), "%s_%s", m_szModuleName, "Notify");
	mir_sntprintf(szDescr, _countof(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Notification"));
	puc.hIcon = CopyIcon(LoadIconEx("notify", FALSE));
	ReleaseIconEx("notify", FALSE);
	puc.iSeconds = 8;
	puc.colorBack = GetSysColor(COLOR_BTNFACE);
	puc.colorText = GetSysColor(COLOR_WINDOWTEXT);
	hPopupNotify = Popup_RegisterClass(&puc);

	mir_snprintf(szName, _countof(szName), "%s_%s", m_szModuleName, "Error");
	mir_sntprintf(szDescr, _countof(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Error"));
	puc.hIcon = CopyIcon(LoadIconEx("error", FALSE));
	ReleaseIconEx("error", FALSE);
	puc.iSeconds = 10;
	puc.colorBack = GetSysColor(COLOR_BTNFACE);
	puc.colorText = GetSysColor(COLOR_WINDOWTEXT);
	hPopupError = Popup_RegisterClass(&puc);
}
Esempio n. 3
0
void GGPROTO::initpopups()
{
    TCHAR szDescr[256];
    char  szName[256];

    POPUPCLASS puc = {0};
    puc.cbSize = sizeof(puc);
    puc.PluginWindowProc = PopupWindowProc;
    puc.flags = PCF_TCHAR;
    puc.ptszDescription = szDescr;
    puc.pszName = szName;

    puc.colorBack = RGB(173, 206, 247);
    puc.colorText =  GetSysColor(COLOR_WINDOWTEXT);
    puc.hIcon = CopyIcon(LoadIconEx("main", FALSE));
    ReleaseIconEx("main", FALSE);
    puc.iSeconds = 4;
    mir_sntprintf(szDescr, _countof(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Notify"));
    mir_snprintf(szName, _countof(szName), "%s_%s", m_szModuleName, "Notify");
    hPopupNotify = Popup_RegisterClass(&puc);

    puc.colorBack = RGB(191, 0, 0); // Red
    puc.colorText = RGB(255, 245, 225); // Yellow
    puc.iSeconds = 60;
    puc.hIcon = (HICON)LoadImage(NULL, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
    mir_sntprintf(szDescr, _countof(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Error"));
    mir_snprintf(szName, _countof(szName), "%s_%s", m_szModuleName, "Error");
    hPopupError = Popup_RegisterClass(&puc);
}
Esempio n. 4
0
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);
}
Esempio n. 5
0
VOID PROGRAM_CopyMoveProgram(HLOCAL hProgram, BOOL bMove)
{
  PROGRAM *program = LocalLock(hProgram);
  PROGGROUP   *fromgroup = LocalLock(program->hGroup);
  HLOCAL hGroup = DIALOG_CopyMove(LocalLock(program->hName),
				  LocalLock(fromgroup->hName), bMove);
  if (!hGroup) return;

  /* FIXME shouldn't be necessary */
  OpenIcon(((PROGGROUP*)LocalLock(hGroup))->hWnd);

  if (!PROGRAM_AddProgram(hGroup,
#if 0
			  CopyIcon(program->hIcon),
#else
			  program->hIcon,
#endif
			  LocalLock(program->hName),
			  program->x, program->y,
			  LocalLock(program->hCmdLine),
			  LocalLock(program->hIconFile),
			  program->nIconIndex,
			  LocalLock(program->hWorkDir),
			  program->nHotKey, program->nCmdShow)) return;
  GRPFILE_WriteGroupFile(hGroup);

  if (bMove) PROGRAM_DeleteProgram(hProgram, TRUE);
}
Esempio n. 6
0
void gg_initpopups(GGPROTO* gg)
{
    char szDescr[256], szName[256];
    POPUPCLASS puc = {0};

    puc.cbSize = sizeof(puc);
    puc.PluginWindowProc = PopupWindowProc;

    puc.ptszDescription = szDescr;
    puc.pszName = szName;
    puc.colorBack = RGB(173, 206, 247);
    puc.colorText =  GetSysColor(COLOR_WINDOWTEXT);
    puc.hIcon = CopyIcon(LoadIconEx("main", FALSE));
    ReleaseIconEx("main", FALSE);
    puc.iSeconds = 4;
    mir_snprintf(szDescr, SIZEOF(szDescr), "%s/%s", GG_PROTONAME, Translate("Notify"));
    mir_snprintf(szName, SIZEOF(szName), "%s_%s", GG_PROTO, "Notify");
    CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&puc);

    puc.ptszDescription = szDescr;
    puc.pszName = szName;
    puc.colorBack = RGB(191, 0, 0); // Red
    puc.colorText = RGB(255, 245, 225); // Yellow
    puc.iSeconds = 60;
    puc.hIcon = (HICON)LoadImage(NULL, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
    mir_snprintf(szDescr, SIZEOF(szDescr), "%s/%s", GG_PROTONAME, Translate("Error"));
    mir_snprintf(szName, SIZEOF(szName), "%s_%s", GG_PROTO, "Error");
    CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&puc);
}
Esempio n. 7
0
INT_PTR CSkypeProto::EventGetIcon(WPARAM wParam, LPARAM lParam)
{
	DBEVENTINFO* dbei = (DBEVENTINFO*)lParam;
	HICON icon = NULL;

	switch (dbei->eventType)
	{
	case SKYPE_DB_EVENT_TYPE_CALL_INFO:
	case SKYPE_DB_EVENT_TYPE_INCOMING_CALL:
		{
			icon = IcoLib_GetIconByHandle(GetIconHandle("inc_call"));
			break;
		}
	case SKYPE_DB_EVENT_TYPE_ACTION:
		{
			icon = IcoLib_GetIconByHandle(GetIconHandle("me_action"));
			break;
		}
	default:
		{
			icon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
			break;
		}
	}

	return (INT_PTR)((wParam & LR_SHARED) ? icon : CopyIcon(icon));
}
Esempio n. 8
0
static INT_PTR Service_LoadIcon(WPARAM wParam,LPARAM lParam)
{
	if ( LOWORD( wParam ) == PLI_PROTOCOL )
		return (INT_PTR)CopyIcon(hYamnIcons[0]); // noone cares about other than PLI_PROTOCOL

	return (INT_PTR)(HICON)NULL;

}
Esempio n. 9
0
static BOOL NTAPI
GuiChangeIcon(IN OUT PFRONTEND This,
              HICON IconHandle)
{
    PGUI_CONSOLE_DATA GuiData = This->Context;
    HICON hIcon, hIconSm;

    if (IconHandle == NULL)
    {
        hIcon   = ghDefaultIcon;
        hIconSm = ghDefaultIconSm;
    }
    else
    {
        hIcon   = CopyIcon(IconHandle);
        hIconSm = CopyIcon(IconHandle);
    }

    if (hIcon == NULL)
    {
        return FALSE;
    }

    if (hIcon != GuiData->hIcon)
    {
        if (GuiData->hIcon != NULL && GuiData->hIcon != ghDefaultIcon)
        {
            DestroyIcon(GuiData->hIcon);
        }
        if (GuiData->hIconSm != NULL && GuiData->hIconSm != ghDefaultIconSm)
        {
            DestroyIcon(GuiData->hIconSm);
        }

        GuiData->hIcon   = hIcon;
        GuiData->hIconSm = hIconSm;

        DPRINT("Set icons in GuiChangeIcon\n");
        PostMessageW(GuiData->hWindow, WM_SETICON, ICON_BIG  , (LPARAM)GuiData->hIcon  );
        PostMessageW(GuiData->hWindow, WM_SETICON, ICON_SMALL, (LPARAM)GuiData->hIconSm);
    }

    return TRUE;
}
Esempio n. 10
0
HICON __fastcall CreateIconFromIndexes(short base, short overlay, short overlay2, short overlay3, short overlay4)
{
	HICON hIcon = NULL;	// returned HICON
	HICON hTmp = NULL;
	HICON icMain = NULL;
	HICON icOverlay = NULL;
	HICON icOverlay2 = NULL;
	HICON icOverlay3 = NULL;
	HICON icOverlay4 = NULL;

	KN_FP_MASK* mainMask = &(def_kn_fp_mask[base]);
	icMain = IcoLib_GetIconByHandle(mainMask->hIcolibItem);

	if (icMain) {
		KN_FP_MASK* overlayMask = (overlay != -1) ? &(def_kn_fp_overlays_mask[overlay]) : NULL;
		KN_FP_MASK* overlay2Mask = (overlay2 != -1) ? &(def_kn_fp_overlays2_mask[overlay2]) : NULL;
		KN_FP_MASK* overlay3Mask = (overlay3 != -1) ? &(def_kn_fp_overlays3_mask[overlay3]) : NULL;
		KN_FP_MASK* overlay4Mask = (overlay4 != -1) ? &(def_kn_fp_overlays4_mask[overlay4]) : NULL;
		icOverlay = (overlayMask == NULL) ? NULL : IcoLib_GetIconByHandle(overlayMask->hIcolibItem);
		icOverlay2 = (overlay2Mask == NULL) ? NULL : IcoLib_GetIconByHandle(overlay2Mask->hIcolibItem);
		icOverlay3 = (overlay3Mask == NULL) ? NULL : IcoLib_GetIconByHandle(overlay3Mask->hIcolibItem);
		icOverlay4 = (overlay4Mask == NULL) ? NULL : IcoLib_GetIconByHandle(overlay4Mask->hIcolibItem);

		hIcon = icMain;

		if (overlayMask)
			hTmp = hIcon = CreateJoinedIcon(hIcon, icOverlay);

		if (overlay2Mask) {
			hIcon = CreateJoinedIcon(hIcon, icOverlay2);
			if (hTmp) DestroyIcon(hTmp);
			hTmp = hIcon;
		}

		if (overlay3Mask) {
			hIcon = CreateJoinedIcon(hIcon, icOverlay3);
			if (hTmp) DestroyIcon(hTmp);
			hTmp = hIcon;
		}

		if (overlay4Mask) {
			hIcon = CreateJoinedIcon(hIcon, icOverlay4);
			if (hTmp) DestroyIcon(hTmp);
		}
	}

	if (hIcon == icMain)
		hIcon = CopyIcon(icMain);

	IcoLib_ReleaseIcon(icMain);
	IcoLib_ReleaseIcon(icOverlay);
	IcoLib_ReleaseIcon(icOverlay2);
	IcoLib_ReleaseIcon(icOverlay3);
	IcoLib_ReleaseIcon(icOverlay4);
	return hIcon;
}
Esempio n. 11
0
HICON FacebookProto::GetIcon(int index)
{
	if(LOWORD(index) == PLI_PROTOCOL)
	{
		HICON ico = (HICON)CallService(MS_SKIN2_GETICON,0,(LPARAM)"Facebook_facebook");
		return CopyIcon(ico);
	} else {
		return 0;
	}
}
Esempio n. 12
0
HICON OmegleProto::GetIcon(int index)
{
	if(LOWORD(index) == PLI_PROTOCOL)
	{
		HICON ico = (HICON)CallService(MS_SKIN2_GETICON,0,(LPARAM)"Omegle_omegle");
		return CopyIcon(ico);
	} else {
		return 0;
	}
}
void CTaskSwitcher32Dlg::FilterList()
{
	m_windowList2.DeleteAllItems();

	window_list *list = window_item::get_window_list();
	CImageList *pImageList = new CImageList(); pImageList->Create( 16, 16, ILC_COLOR32 | ILC_MASK | ILC_PERITEMMIRROR, 0, 10);

	m_windowList2.SetImageList( pImageList, LVSIL_SMALL);
	int default_idx = pImageList->Add( m_hIcon );
		
	for ( unsigned int i = 0; i < list->size(); i++ )
	{
		window_item *item = (*list)[i];
		bool ok = true;
		if ( this->search.length() > 0 )
		{
			int pos = item->get_lower_title().find( this->search ) ; 
			int pos2 = item->get_process_name().find( this->search );
			if ( pos == std::string::npos && pos2 == std::string::npos ) 
				ok = false;
		}
		if ( ok )
		{
			HWND hwnd = item->get_handle();
			HICON hIcon = NULL;
 
			SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
			if (!hIcon) SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
 			if (!hIcon) SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
            if (!hIcon) hIcon = (HICON)GetClassLong(hwnd, GCL_HICON);
            if (!hIcon) hIcon = (HICON)GetClassLong(hwnd, GCL_HICONSM);
        
		
			int imageidx = -1;
			if ( hIcon != NULL )
			{
				HICON iconCopy = CopyIcon( hIcon );				
				imageidx = pImageList->Add( iconCopy );
				DestroyIcon( iconCopy );
			}
			else
			{
				imageidx = 1;
			}
			int idx = m_windowList2.InsertItem( 0, item->get_title().c_str(), imageidx );
			m_windowList2.SetItem(  idx, 1, LVIF_TEXT | LVIF_IMAGE, item->get_process_name().c_str(), imageidx, 0, 0, 0 );
			m_windowList2.SetItemData( idx, (DWORD_PTR) item );
			
		}
	}
	m_windowList2.SetItemState( 0, LVIS_SELECTED, LVIS_SELECTED );
	m_windowList2.SetSelectionMark( 0 );

}
Esempio n. 14
0
HICON CSteamProto::GetXStatusIcon(int status, UINT flags)
{
	if (status < 1)
		return 0;

	char iconName[100];
	mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, "gaming");

	HICON icon = IcoLib_GetIcon(iconName, (flags & LR_BIGICON) != 0);
	return (flags & LR_SHARED) ? icon : CopyIcon(icon);
}
Esempio n. 15
0
void nIcon::setHicon(HICON phicon)
{
   if(hicon)
    DestroyIcon(hicon);

   if(! (hicon = CopyIcon(phicon)))
   {
       deb("failed to CopyIcon: %s", fmterr());
   }
   // hicon = phicon;
}
Esempio n. 16
0
HICON CSteamProto::GetXStatusIcon(int status, UINT flags)
{
	if (status < 1)
		return 0;

	char iconName[100];
	mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, "gaming");

	HICON icon = Skin_GetIcon(iconName, (flags & LR_BIGICON) ? 32 : 16);
	return (flags & LR_SHARED) ? icon : CopyIcon(icon);
}
Esempio n. 17
0
nIcon::nIcon(RECT prect, char * ptip, HICON phicon, UINT pid)
{
   rect = prect;
   strncpy(tip, ptip, sizeof(tip));
   hicon = CopyIcon(phicon);
   id = pid;
   modify_calls = 0;
   deb("new nIcon: %d", id);
   balloon_icon = 0;
   calls=0;
}
Esempio n. 18
0
HICON IconItem_GetIcon_Preview(IcolibItem* item)
{
	HICON hIcon = NULL;

	if (!item->temp_reset) {
		HICON hRefIcon = IconItem_GetIcon(item, false);
		hIcon = CopyIcon(hRefIcon);
		if (item->source_small && item->source_small->icon == hRefIcon)
			IconSourceItem_ReleaseIcon(item->source_small);
	}
	else {
		if (item->default_icon) {
			HICON hRefIcon = IconSourceItem_GetIcon(item->default_icon);
			if (hRefIcon) {
				hIcon = CopyIcon(hRefIcon);
				if (item->default_icon->icon == hRefIcon)
					IconSourceItem_ReleaseIcon(item->default_icon);
			}
		}

		if (!hIcon && item->default_file) {
			IconSourceItem_Release(&item->default_icon);
			item->default_icon = GetIconSourceItem(item->default_file, item->default_indx, item->cx, item->cy);
			if (item->default_icon) {
				HICON hRefIcon = IconSourceItem_GetIcon(item->default_icon);
				if (hRefIcon) {
					hIcon = CopyIcon(hRefIcon);
					if (item->default_icon->icon == hRefIcon)
						IconSourceItem_ReleaseIcon(item->default_icon);
				}
			}
		}

		if (!hIcon)
			return CopyIcon(hIconBlank);
	}
	return hIcon;
}
Esempio n. 19
0
static void MailPopupPreview(DWORD colorBack, DWORD colorText, TCHAR *title, TCHAR *emailInfo, int delay)
{
	POPUPDATAT ppd = { 0 };
	HICON hIcon = GetIcolibIcon(IDI_MAIL);
	ppd.lchIcon = CopyIcon(hIcon);
	ReleaseIcolibIcon(hIcon);
	_tcscpy(ppd.lptzContactName, title);
	_tcscpy(ppd.lptzText, emailInfo);
	ppd.colorBack = colorBack;
	ppd.colorText = colorText;
	ppd.iSeconds = delay;
	if ( ServiceExists(MS_POPUP_ADDPOPUPT))
		PUAddPopupT(&ppd);
}
Esempio n. 20
0
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;
}
bool gstIconManager::AddIcon(const std::string& path) {
  if (!Validate(path))
    return false;

  std::string base = khReplaceExtension(khBasename(path), ".png");
  std::string outfile = khComposePath(icon_path_[IconReference::External], base);

  if (CopyIcon(path, outfile) == true) {
    collection_[IconReference::External].push_back(gstIcon(
        base, IconReference::External));
    return true;
  }

  return false;
}
Esempio n. 22
0
HICON IcoLib_LoadIcon(const char *iconName, BOOL copy)
{
	if (!ServiceExists(MS_SKIN2_GETICON))
		return NULL;

	if (iconName == NULL || iconName[0] == 0)
		return NULL;
	
	HICON hIcon = (HICON) CallService(MS_SKIN2_GETICON, 0, (LPARAM) iconName);
	if (copy && hIcon != NULL)
	{
		hIcon = CopyIcon(hIcon);
		CallService(MS_SKIN2_RELEASEICON, (WPARAM) hIcon, 0);
	}
	return hIcon;
}
Esempio n. 23
0
STDMETHODIMP CWiaUIExtension::GetDeviceIcon( BSTR bstrDeviceId, HICON *phIcon, ULONG nSize )
{
    UNREFERENCED_PARAMETER(bstrDeviceId);

    //
    // Load an icon, and copy it, using CopyIcon, so it will still be valid if our interface is freed
    //
    HICON hIcon = reinterpret_cast<HICON>(LoadImage( _Module.m_hInst, MAKEINTRESOURCE(IDI_TESTDEVICE), IMAGE_ICON, nSize, nSize, LR_DEFAULTCOLOR ));
    if (hIcon)
    {
        *phIcon = CopyIcon(hIcon);
        DestroyIcon(hIcon);
        return S_OK;
    }
    return E_NOTIMPL;
}
Esempio n. 24
0
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;
}
Esempio n. 25
0
BOOL CALLBACK EnumerateCallback(HWND window, LPARAM lParam)
{
   HICON hIcon;
   HWND hwndIcon, hwndOwner;

   UNREFERENCED_PARAMETER(lParam);

   hwndOwner = GetWindow(window, GW_OWNER);
   hwndIcon = (hwndOwner ? hwndOwner : window);

   // First try to get the big icon assigned to the window
   hIcon = (HICON)SendMessageW(hwndIcon, WM_GETICON, ICON_BIG, 0);
   if (!hIcon)
   {
      // If no icon is assigned, try to get the icon assigned to the windows' class
      hIcon = (HICON)GetClassLongPtrW(hwndIcon, GCL_HICON);
      if (!hIcon)
      {
         // If we still don't have an icon, see if we can do with the small icon,
         // or a default application icon
         hIcon = (HICON)SendMessageW(hwndIcon, WM_GETICON, ICON_SMALL2, 0);
         if (!hIcon)
         {
            // using windows logo icon as default
            hIcon = gpsi->hIconWindows;
            if (!hIcon)
            {
               //if all attempts to get icon fails go to the next window
               return TRUE;
            }
         }
      }
   }

   windowList[windowCount] = window;
   iconList[windowCount] = CopyIcon(hIcon);

   windowCount++;

   // If we got to the max number of windows,
   // we won't be able to add any more
   if(windowCount >= MAX_WINDOWS)
      return FALSE;

   return TRUE;
}
Esempio n. 26
0
void CSmileyString::_CopySmileyList(SortedList *plInput)
{
	if (!plInput || plInput->realCount == 0)
		return;
	
	plText = List_Create(0, 1);
	for (int i = 0; i < plInput->realCount; i++) {
		ClcContactTextPiece *pieceFrom = (ClcContactTextPiece *)plInput->items[i];
		if (pieceFrom != nullptr) {
			ClcContactTextPiece *piece = (ClcContactTextPiece *)mir_alloc(sizeof(ClcContactTextPiece));
			*piece = *pieceFrom;
			if (pieceFrom->type == TEXT_PIECE_TYPE_SMILEY)
				piece->smiley = CopyIcon(pieceFrom->smiley);
			List_Insert(plText, piece, plText->realCount);
		}
	}
}
Esempio n. 27
0
//=======================================================
//BPLoadIcon
//=======================================================
INT_PTR LoadLCIcon(WPARAM wParam,LPARAM lParam)
{
	if (LOWORD(wParam) == PLI_PROTOCOL) {
		if (wParam & PLIF_ICOLIBHANDLE)
			return (INT_PTR)icoList[0].hIcolib;

		HICON hIcon = Skin_GetIconByHandle(icoList[0].hIcolib, (wParam & PLIF_SMALL) == 0);
		if (wParam & PLIF_ICOLIB)
			return (INT_PTR)hIcon;

		HICON hIcon2 = CopyIcon(hIcon);
		Skin_ReleaseIcon(hIcon);
		return (INT_PTR)hIcon2;
	}

	return NULL;	
}
Esempio n. 28
0
BOOL ShowTrayIcon(BOOL fShow) {

	BOOL fRet = DeleteTrayIcon(g_hwndMain, IDI_TASKSWITCHXP);
	g_dwFlags &= ~TSF_SHOWTRAYICON;

	if (g_hIconTray) {
		DestroyIcon(g_hIconTray);
		g_hIconTray = NULL;
	}

	if (fShow) {

		HICON hIconSm = NULL;
		if (g_dwFlags & TSF_USECUSTOMICON) {
			HKEY hkey = NULL;
			if (!RegOpenKeyEx(HKEY_CURRENT_USER, g_szRegKeyTs, 0, KEY_READ, &hkey)) {
				WCHAR szBuff[MAX_DATALEN] = L"";
				DWORD cbData = MAX_DATALEN * sizeof(WCHAR);
				if (!RegQueryValueEx(hkey, RS_CUSTOMICON, 0, NULL, (PBYTE)szBuff, &cbData)) {
					int nIconIndex;
					if (_GetIconPathIndex(szBuff, &nIconIndex)) {
						if (!ExtractIconEx(szBuff, nIconIndex, NULL, &hIconSm, 1))
							hIconSm = NULL;
					}
				}
				RegCloseKey(hkey);
			}
		}

		if (!hIconSm) {
			g_hIconTray = (HICON)LoadImage(g_hinstExe, MAKEINTRESOURCE(IDI_TASKSWITCHXP), 
				IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
		} else {
			g_hIconTray = CopyIcon(hIconSm);
			DestroyIcon(hIconSm);
		}

		if (!g_hIconTray)
			g_hIconTray = LoadIcon(NULL, IDI_WARNING);

		fRet = AddTrayIcon(g_hwndMain, IDI_TASKSWITCHXP, g_hIconTray, g_szWindowName);
		g_dwFlags |= TSF_SHOWTRAYICON;
	}
	return(fRet);
}
Esempio n. 29
0
BOOL CALLBACK EnumerateCallback(HWND window, LPARAM lParam)
{
   HICON hIcon;

   UNREFERENCED_PARAMETER(lParam);

   if (!IsWindowVisible(window))
            return TRUE;

   GetClassNameW(window,windowText,4095);
   if ((wcscmp(L"Shell_TrayWnd",windowText)==0) ||
       (wcscmp(L"Progman",windowText)==0) )
            return TRUE;
      
   // First try to get the big icon assigned to the window
   hIcon = (HICON)SendMessageW(window, WM_GETICON, ICON_BIG, 0);
   if (!hIcon)
   {
      // If no icon is assigned, try to get the icon assigned to the windows' class
      hIcon = (HICON)GetClassLongPtrW(window, GCL_HICON);
      if (!hIcon)
      {
         // If we still don't have an icon, see if we can do with the small icon,
         // or a default application icon
         hIcon = (HICON)SendMessageW(window, WM_GETICON, ICON_SMALL2, 0);
         if (!hIcon)
         {
            // If all fails, give up and continue with the next window
            return TRUE;
         }
      }
   }

   windowList[windowCount] = window;
   iconList[windowCount] = CopyIcon(hIcon);

   windowCount++;

   // If we got to the max number of windows,
   // we won't be able to add any more
   if(windowCount == MAX_WINDOWS)
      return FALSE;

   return TRUE;
}
Esempio n. 30
0
HICON GetConnectingIconForProto(char *szProto,int b)
{
		if (ServiceExists(MS_SKIN2_GETICON)&&DBGetContactSettingByte(NULL,"CList","UseProtoIconFromIcoLib",1))
		{
			HICON hIcon=0;
			char buf[256];
			sprintf(buf,"%s #%d",szProto,b);
			
			 hIcon=LoadIconFromExternalFile(NULL,b,TRUE,FALSE,buf,"Contact List/Connection Icons",buf,0,NULL);
			 if (hIcon==NULL) return (GetConnectingIconForProto_DLL(szProto,b));
			 return (CopyIcon(hIcon));
		
		}else
		{
			return(GetConnectingIconForProto_DLL(szProto,b));
		}
		return (NULL);
}