1. 程式人生 > >c++提取應用程式中的圖示(繪製圖標ico)

c++提取應用程式中的圖示(繪製圖標ico)

//提取應用程式中的圖示

      CSttring m_strIcoPath = L"xx.exe";

     CRect  m_rcItem; //繪製區域

    HICON hIcon = ::ExtractIcon(GetModuleHandle(NULL), m_strIcoPath, 0);

	if (hIcon != NULL)
	{	

               // HDC  hDC = GetDc(m_hWnd);

		Graphics graphics(hDC);
		Bitmap bitmap(hIcon);
		graphics.DrawImage(&bitmap, m_rcItem.left, m_rcItem.top);
		DestroyIcon(hIcon);

            //


	}