Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Combine two icons

Combine two icons

Scheduled Pinned Locked Moved C / C++ / MFC
question
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mjvalan
    wrote on last edited by
    #1

    Hai, I am ving two icon handles, and want to combine them. So that one will be the overlay over the another. I tried with the following code, but it is not displaying properly. Any other solutions? HICON CAutoDocuFileDlg::CombineIcons(HICON topIcon,HICON bottomIcon) {// begin CombineIcons ICONINFO newIcon; newIcon.fIcon = true; HDC screenDC = ::GetDC(NULL); HDC iconDC = CreateCompatibleDC(screenDC); HDC maskDC = CreateCompatibleDC(screenDC); newIcon.hbmColor = CreateCompatibleBitmap(screenDC,16,16); newIcon.hbmMask = CreateCompatibleBitmap(maskDC,16,16); HGDIOBJ oldIconDC = ::SelectObject(iconDC,newIcon.hbmColor); HGDIOBJ oldMaskDC = ::SelectObject(maskDC,newIcon.hbmMask); BitBlt(iconDC,0,0,16,16,NULL,0,0,BLACKNESS); BitBlt(maskDC,0,0,16,16,NULL,0,0,WHITENESS); DrawIconEx(iconDC,0,0,topIcon,16,16,NULL,NULL,DI_ IMAGE); BitBlt(iconDC,0,0,16,16,NULL,0,0,DSTINVERT); // DrawIconEx(maskDC,0,0,topIcon,16,16,NULL,NULL,DI_ MASK); DrawIconEx(iconDC,0,0,bottomIcon,16,16,NULL,NULL, DI_NORMAL); BitBlt(iconDC,0,0,16,16,NULL,0,0,DSTINVERT); DrawIconEx(maskDC,0,0,bottomIcon,16,16,NULL,NULL, DI_MASK); BitBlt(maskDC,0,0,16,16,NULL,0,0,DSTINVERT); ::SelectObject(iconDC,oldIconDC); ::SelectObject(maskDC,oldMaskDC); HICON newFileIcon = CreateIconIndirect(&newIcon); ::ReleaseDC(NULL,screenDC); DeleteDC(maskDC); DeleteDC(iconDC); DeleteObject(newIcon.hbmColor); DeleteObject(newIcon.hbmMask); DeleteObject(oldIconDC); DeleteObject(oldMaskDC); return newFileIcon; }// end CombineIcons

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups