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