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. ATL / WTL / STL
  4. How to print an ATL 3.0 based Active X

How to print an ATL 3.0 based Active X

Scheduled Pinned Locked Moved ATL / WTL / STL
helpc++comhostingalgorithms
5 Posts 2 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.
  • P Offline
    P Offline
    Peter Mares
    wrote on last edited by
    #1

    Hi, I've written a simple ActiveX control using ATL 3.0 ... and everything works fine... until I want to print the document that is hosting my control. In this case, its Excel. Everything on the excel sheet prints EXCEPT my activeX control. What am I missing here? Any ideas? I've tried searching online, in MSDN, etc etc... nothing. Any help would be greatly appreciated... :) Thanx ------------------------------------------- 99 little bugs in the code, 99 little bugs, Fix 1 bug, recompile.... 101 little bugs in the code...

    B 1 Reply Last reply
    0
    • P Peter Mares

      Hi, I've written a simple ActiveX control using ATL 3.0 ... and everything works fine... until I want to print the document that is hosting my control. In this case, its Excel. Everything on the excel sheet prints EXCEPT my activeX control. What am I missing here? Any ideas? I've tried searching online, in MSDN, etc etc... nothing. Any help would be greatly appreciated... :) Thanx ------------------------------------------- 99 little bugs in the code, 99 little bugs, Fix 1 bug, recompile.... 101 little bugs in the code...

      B Offline
      B Offline
      bojinyu
      wrote on last edited by
      #2

      I have meet the same problem, and I am working on it. Here, I want to introduce my idea. In the OnDraw(ATL_DRAWINFO& di) proceed, the default di give the HDC of the CRT. So, we should change it to the print device HDC. I still have no answer on it yet. ;P

      P 1 Reply Last reply
      0
      • B bojinyu

        I have meet the same problem, and I am working on it. Here, I want to introduce my idea. In the OnDraw(ATL_DRAWINFO& di) proceed, the default di give the HDC of the CRT. So, we should change it to the print device HDC. I still have no answer on it yet. ;P

        P Offline
        P Offline
        Peter Mares
        wrote on last edited by
        #3

        Ok... heres to solution to getting your ATL components to print from within Office Applications. It seems as if Office Applications still use the old 16bit Metafile format when printing. This is a problem because it limits you to using only the GDI functions that are supported by the old Metafile DC. For a list of functions that you CAN use, see this Microsoft document. I've rewritten all my drawing code to support these functions and my control is printing fine ;) Should work for yours aswell. Thanx to Microsoft for documenting this little issue so nicely *sarcasm* :P Cheers, Peter ------------------------------------------- 99 little bugs in the code, 99 little bugs, Fix 1 bug, recompile.... 101 little bugs in the code...

        B 1 Reply Last reply
        0
        • P Peter Mares

          Ok... heres to solution to getting your ATL components to print from within Office Applications. It seems as if Office Applications still use the old 16bit Metafile format when printing. This is a problem because it limits you to using only the GDI functions that are supported by the old Metafile DC. For a list of functions that you CAN use, see this Microsoft document. I've rewritten all my drawing code to support these functions and my control is printing fine ;) Should work for yours aswell. Thanx to Microsoft for documenting this little issue so nicely *sarcasm* :P Cheers, Peter ------------------------------------------- 99 little bugs in the code, 99 little bugs, Fix 1 bug, recompile.... 101 little bugs in the code...

          B Offline
          B Offline
          bojinyu
          wrote on last edited by
          #4

          Help! I have use the function SetGraphicsMode(hDC,GM_ADVANCED) and I must use it! What could I do? I make a defalut ATL peoject, and the draw item just is a Textout(), and I print it in document of word. But, failed, the text "ATL 3.0:xxx" is much larger than it on the display CRT.Will you please sent me your Ondraw() code, I want to have an experiment. Thank you

          P 1 Reply Last reply
          0
          • B bojinyu

            Help! I have use the function SetGraphicsMode(hDC,GM_ADVANCED) and I must use it! What could I do? I make a defalut ATL peoject, and the draw item just is a Textout(), and I print it in document of word. But, failed, the text "ATL 3.0:xxx" is much larger than it on the display CRT.Will you please sent me your Ondraw() code, I want to have an experiment. Thank you

            P Offline
            P Offline
            Peter Mares
            wrote on last edited by
            #5

            What I can suggest is this. The GM_ADVANCED flag is not supported in anything below Windows 2000, so first, get your OnDraw() function to check if you're drawing to an old style metaDC. You can do this like this : bool bMetaDC = false; if ( GetObjectType(hdc) == OBJ_METADC ) bMetaDC = true; Now that you know that you're rendering to an old metaDC, create another DC, do all your drawing to that and then BitBlt() to your metaDC. I don't know if it will work, but its worth a try... ------------------------------------------- 99 little bugs in the code, 99 little bugs, Fix 1 bug, recompile.... 101 little bugs in the code...

            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