|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Printing problem with 2.0 Framework?We have some test apps that print images to file using various printers. The test app runs as expected under the (default) 1.1 Framework. When we try to run with the 2.0 framework, we get "The handle is invalid" errors. at System.Drawing.Printing.StandardPrintController.OnStartPrint(PrintDocument document, PrintEventArgs e) at System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPrint(PrintDocument document, PrintEventArgs e) at System.Drawing.Printing.PrintController.Print(PrintDocument document) at System.Drawing.Printing.PrintDocument.Print() at MegaCorp.Printing.IcePrinting.PrintInBackground() at MegaCorp.Printing.IcePrinting.Print() at MegaCorpTest.Printing.IcePrintingMain.IcePrintingTests(TestCaseData TestDataBase) Adding a testapp.exe.config file with the section <configuration> <startup> <supportedRuntime version="v2.0.50727" /> </startup> </configuration> is the only change we make. We are trying to print from a class derived from PrintDocument; our PrintPage handler is never called when the test fails. Is this a driver problem, or is there maybe something we can do to make this work for our customers using the 2.0 framework? Thanks for any advice... Hi Schemer,
I have performed some research over the call stack you provided, the "The handle is invalid" error message should be caused by failure of Win32 API StartDoc(), which is called in StandardPrintController.OnStartPrint() method. I have also performed some search regarding this error with OnStartPrint in both public and private databases, but I can not find a similar record. It seems that this issue is not reported before. Based on our GDI team leader "Feng Yuan"'s reply in the link below, it seems that StartDoc reporting "the handle is invalid" does not always mean the passed handle is invalid, it may be caused by some other issues. The only reliable way to check this is using GetObjectType to check the HDC: http://groups.google.com/group/microsoft.public.win32.programmer.gdi/browse_ frm/thread/d474ce9493c425ff/0b3436ab042ab7a4?lnk=st&q=%22The+handle+is+inval id%22+StartDoc&rnum=2&hl=zh-CN#0b3436ab042ab7a4 Since you are not using Win32 code, it is not easy to obtain the HDC and pass it to GetObjectType. Also, without reproducing this problem, it is hard for me to identify the root cause. Have you tried this project on another machine? Can this be reproduced? This will help to isolate if the problem is machine-specific. Is it possible for you to create a little sample project to help us reproduce the problem? If so, please feel free to provide it to me, this will be the most efficient way for us to troubleshoot. Thanks Best regards, Jeffrey Tan Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. |
|||||||||||||||||||||||