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. Hardware & Devices
  4. Printers and Vista, program hangs or chrashs.

Printers and Vista, program hangs or chrashs.

Scheduled Pinned Locked Moved Hardware & Devices
helpcsharpcomsysadminperformance
7 Posts 3 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.
  • S Offline
    S Offline
    st14
    wrote on last edited by
    #1

    Is anyone else having problems with Vista printer drivers and there .Net application? My program hangs when the print preview control is initialised. If I try to catch the problem in a catch{} try block it often fails with a memory error at the next line of code. I am assuming the users buy a new PC, Vista installed, and then hook up to there trusty network or locally attached 5 year old printers. I can't reproduce these problems at home so I am a bit lost. I found this link which explains where some of the problems may start: [^] Thanks Stuart

    D realJSOPR 2 Replies Last reply
    0
    • S st14

      Is anyone else having problems with Vista printer drivers and there .Net application? My program hangs when the print preview control is initialised. If I try to catch the problem in a catch{} try block it often fails with a memory error at the next line of code. I am assuming the users buy a new PC, Vista installed, and then hook up to there trusty network or locally attached 5 year old printers. I can't reproduce these problems at home so I am a bit lost. I found this link which explains where some of the problems may start: [^] Thanks Stuart

      D Offline
      D Offline
      dadashri
      wrote on last edited by
      #2

      new PC, Vista installed, and then hook up to there trusty network or locally attached 5 year old printers. you 2gb ram use

      S 1 Reply Last reply
      0
      • D dadashri

        new PC, Vista installed, and then hook up to there trusty network or locally attached 5 year old printers. you 2gb ram use

        S Offline
        S Offline
        st14
        wrote on last edited by
        #3

        Yes the PC has3.5 gb of ram. The printer causing problems is an HP and the drivers are uptodate. OS Version: 6.0.6001.65536 Service Pack 1 Workstation x86 .NET Framework version: 2.0.50727.3074 x86 Processor: 2x "AMD Athlon(tm) 64 X2 Dual Core Processor 3800+" @ ~2004MHz (DEP, SSE, SSE2, SSE3) Physical memory: 3453 MB I've asked the user to try Paint.Net Stuart

        1 Reply Last reply
        0
        • S st14

          Is anyone else having problems with Vista printer drivers and there .Net application? My program hangs when the print preview control is initialised. If I try to catch the problem in a catch{} try block it often fails with a memory error at the next line of code. I am assuming the users buy a new PC, Vista installed, and then hook up to there trusty network or locally attached 5 year old printers. I can't reproduce these problems at home so I am a bit lost. I found this link which explains where some of the problems may start: [^] Thanks Stuart

          realJSOPR Offline
          realJSOPR Offline
          realJSOP
          wrote on last edited by
          #4

          Write a simple program that doesn't do anything but display the print preview form, and send it to the user. If THAT program crashes, it's on the user's end. If it doesn't, you've got faulty code that is probably somehow connected to what you're printing. I assume you know that the same code that prints is also the code used to provide the previewed printout.

          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
          -----
          "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

          S 1 Reply Last reply
          0
          • realJSOPR realJSOP

            Write a simple program that doesn't do anything but display the print preview form, and send it to the user. If THAT program crashes, it's on the user's end. If it doesn't, you've got faulty code that is probably somehow connected to what you're printing. I assume you know that the same code that prints is also the code used to provide the previewed printout.

            "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
            -----
            "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

            S Offline
            S Offline
            st14
            wrote on last edited by
            #5

            Thanks John. Thats a good idea. One user has installed pdfcreator and now can print to pdf and then on to their printer but still can't print directly from my app. I have a smaller app that use an RTF control that supports printing so I'll send them a copy for testing. The error messages I get when my program crashes point to memory corruption by the driver. Here is one example: Exception details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at System.Drawing.SafeNativeMethods.PrintDlg(PRINTDLGX86 lppd) at System.Drawing.Printing.PrinterSettings.GetOutputPort() at System.Drawing.Printing.PrinterSettings.FastDeviceCapabilities(Int16 capability, IntPtr pointerToBuffer, Int32 defaultValue, String printerName) at System.Drawing.Printing.PrinterSettings.Get_PaperSizes() at System.Drawing.Printing.PageSettings.PaperSizeFromMode(DEVMODE mode) at System.Drawing.Printing.PageSettings.GetPaperSize(IntPtr modeHandle) at System.Drawing.Printing.PageSettings.GetBounds(IntPtr modeHandle) at System.Drawing.Printing.PrintController.CreatePrintPageEvent(PageSettings pageSettings) at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document) at System.Drawing.Printing.PrintController.Print(PrintDocument document) at System.Drawing.Printing.PrintDocument.Print() at System.Windows.Forms.PrintPreviewControl.ComputePreview() Here is what happened when I tried to cath the error in a Try Catch block. In the Catch I am trying to display the exception contents in a MessageBox ) Exception details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at System.RuntimeTypeHandle.ConstructName(Boolean nameSpace, Boolean fullInst, Boolean assembly) at System.RuntimeType.RuntimeTypeCache.ConstructName(String& name, Boolean nameSpace, Boolean fullinst, Boolean assembly) at System.RuntimeType.get_Name() at System.Diagnostics.StackTrace.ToString(TraceFormat traceFormat) at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo) at System.Exception.get_StackTrace() at System.Exception.ToString() at DrawTools.Startup.Main(String[] args) Thanks Stuart

            realJSOPR 1 Reply Last reply
            0
            • S st14

              Thanks John. Thats a good idea. One user has installed pdfcreator and now can print to pdf and then on to their printer but still can't print directly from my app. I have a smaller app that use an RTF control that supports printing so I'll send them a copy for testing. The error messages I get when my program crashes point to memory corruption by the driver. Here is one example: Exception details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at System.Drawing.SafeNativeMethods.PrintDlg(PRINTDLGX86 lppd) at System.Drawing.Printing.PrinterSettings.GetOutputPort() at System.Drawing.Printing.PrinterSettings.FastDeviceCapabilities(Int16 capability, IntPtr pointerToBuffer, Int32 defaultValue, String printerName) at System.Drawing.Printing.PrinterSettings.Get_PaperSizes() at System.Drawing.Printing.PageSettings.PaperSizeFromMode(DEVMODE mode) at System.Drawing.Printing.PageSettings.GetPaperSize(IntPtr modeHandle) at System.Drawing.Printing.PageSettings.GetBounds(IntPtr modeHandle) at System.Drawing.Printing.PrintController.CreatePrintPageEvent(PageSettings pageSettings) at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document) at System.Drawing.Printing.PrintController.Print(PrintDocument document) at System.Drawing.Printing.PrintDocument.Print() at System.Windows.Forms.PrintPreviewControl.ComputePreview() Here is what happened when I tried to cath the error in a Try Catch block. In the Catch I am trying to display the exception contents in a MessageBox ) Exception details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at System.RuntimeTypeHandle.ConstructName(Boolean nameSpace, Boolean fullInst, Boolean assembly) at System.RuntimeType.RuntimeTypeCache.ConstructName(String& name, Boolean nameSpace, Boolean fullinst, Boolean assembly) at System.RuntimeType.get_Name() at System.Diagnostics.StackTrace.ToString(TraceFormat traceFormat) at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo) at System.Exception.get_StackTrace() at System.Exception.ToString() at DrawTools.Startup.Main(String[] args) Thanks Stuart

              realJSOPR Offline
              realJSOPR Offline
              realJSOP
              wrote on last edited by
              #6

              Make sure their OS and their .Net framework is fully patched up. Oh yeah, and make sure they're using the latest OS-compatible video drivers.

              "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
              -----
              "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

              S 1 Reply Last reply
              0
              • realJSOPR realJSOP

                Make sure their OS and their .Net framework is fully patched up. Oh yeah, and make sure they're using the latest OS-compatible video drivers.

                "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                -----
                "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                S Offline
                S Offline
                st14
                wrote on last edited by
                #7

                From: Member 4312265 I'm am having the exact same problem with printing. Same two errors and everything. Did you find a solution? Christian Christian, I have not made any progress. I can't reproduce the problem here and so I'm relying on my users. PDFCREATOR gets them out of trouble. (use it as the default printer, it creates a pdf an then you can print the pdf fine.) Do you have the problem on a development PC ? If so I could send you a test program and we could work on this together. Things I have tried: Make sure .net and OS are fully patched. Remove all code optimisation from my release build. Place all print functions in TRY blocks to prevent the program from chrashing. regards Stuart PS You can download my application at http://www.mapsoft.com.au (miniCAD V5)

                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