Results 1 to 5 of 5

Thread: [2005] A Generic Error Occured in GDI.EXE

  1. #1

    Thread Starter
    Hyperactive Member Jonny1409's Avatar
    Join Date
    Mar 2005
    Posts
    308

    [2005] A Generic Error Occured in GDI.EXE

    Hello,

    When trying to print a page in one of our applications, we are getting the above error message.

    The code the line is breaking on is :

    Code:
    Friend WithEvents zg1 As ZedGraph.ZedGraphControl
    Dim g As Graphics = zg1.CreateGraphics
    Dim ibitMap As New Bitmap(zg1.ClientSize.Width, zg1.ClientSize.Height, g)
    ibitMap.Save(DocServerPath & EmployeeNumber & "\d" & CStr(SummaryID) & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp)
    I didn't write this app so I don't really know much about it, other than to say that the code appears to be saving a graph as a bitmap, using this zedgraph control.

    I know it's a longshot, but can anyone shed any light on how I can get to the bottom of this ?

    Thanks.

  2. #2
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] A Generic Error Occured in GDI.EXE

    Does this occur when printing a single page?, or are you printing many pages and it fails after a few have come out ok?

    Just a long shot but the reason I ask is that I have seen this generic GDI error occurring when there are too many graphics handles or objects. This typically means that the app is not disposing of graphics objects correctly.

    As a quick check, run up the task manager, on the processes tab, select User Objects, GDI Objects and Handles (using View -> Select Columns). When the app is running see if any of these three are constantly increasing with the apps activity. All have an upper limit, I cant remember what they are but when exceeded, you get that message.

  3. #3

    Thread Starter
    Hyperactive Member Jonny1409's Avatar
    Join Date
    Mar 2005
    Posts
    308

    Re: [2005] A Generic Error Occured in GDI.EXE

    Hi Bulldog,

    Cheers for getting back to me on this one.

    No I can't even print a single page, it's literally when I press the print button, it falls on the line mentioned above:

    Code:
    ibitMap.Save(DocServerPath & EmployeeNumber & "\d" & CStr(SummaryID) & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp)
    The DocServerPath is populated fine as is the EmployeeNumber, but for some reason it just won't save the graph as a bitmap.

    I believe you are right in as much as the form does seem to have quite a bit on it, so this could be causing the problem - however everything on there is required.

    I've done as you suggest regarding task manager and the app had the following when started :

    Handles - 490
    User Objects - 212
    GDI - 237

    All were fluctuating but only around these marks whenever I did anything in the app.

  4. #4
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] A Generic Error Occured in GDI.EXE

    Do you get this problem with all formats?, so if you change the output format to Jpeg or Gif, does that work? or the same result?

    e.g.
    Code:
    ibitMap.Save(DocServerPath & EmployeeNumber & "\d" & CStr(SummaryID) & ".gif", System.Drawing.Imaging.ImageFormat.Gif)

  5. #5

    Thread Starter
    Hyperactive Member Jonny1409's Avatar
    Join Date
    Mar 2005
    Posts
    308

    Re: [2005] A Generic Error Occured in GDI.EXE

    Hi Bulldog,

    No I'm afriad the same thing happens if I choose any other format (jpg, gif etc)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width