Results 1 to 13 of 13

Thread: How to increase my GDI resource ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Malaysia
    Posts
    69
    I have a program that has many forms with heavy graphics and controls. I wanted to preload all the forms in the memory but I found that the GDI resource is not enough and hang my PC. Is there actually a way to allocate more resource for this without adding new hardware ?

    What hardware that affect this ? RAM, Video RAM, Processor ..

    Thanks

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    One of the main problems is running out of GDI handles. There's really no way round it other than rethinking how you put your form together. However, if you use dynamic allocation of things like that, you can often extend the limit.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Try to avoid using too many controls and objects, if you spend much on the interface you could just draw directly on the form instead.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4
    Guest
    When possible, try to use Image's instead of PictureBox's.

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    In other words, if you just need the image for interace you use image control. If you need to access the DC and drawing Vb methods use picturebox.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6
    Guest
    If you're going to draw it on the DC, you'll need a PictureBox anyway so I don't think it will do much, unless you have to draw the same picture multiple times.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Malaysia
    Posts
    69
    Thank you.. but the problem is that I wanted to load all my forms during startup ( about 30 of them).. so, I guess there is no fix for this unless reduce the preload form.

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Why do you need 30 forms?
    Do you need them to be displayed all at the same time?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  9. #9
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516
    And why do people add apostrophes where they do not belong:

    Picturebox's
    Image's
    ?

    One of those high-ranking questions alongside why dogs smell after having a shower.
    Courgettes.

  10. #10
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    It's probably only my apostrophes out there, i can't help them
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Malaysia
    Posts
    69
    no lah.. is just that I want the form to instant popup when call.. since my form use heavy graphics, the form loading take about 1-2 seconds.. which is not nice..

  12. #12
    Guest
    You can use the GdiFlush API to improve performace slightly.

  13. #13
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    If you need 30 forms, what are they for? If most of them are closely related, I suggest making a Subroutine for loading the form with different functions. For example, if it was a dialog, you could try this:
    Code:
    ---form1---
    
    Sub myMessage(Choice1 as String, Choice2 as String, C1Funct as String, C2Funct As String, Message as String)
    
       frmDialog.Text1.Text = Message
       frmDialog.Cmd1.Caption = Choice1
       frmDialog.Cmd2.Caption = Choice2
    
       'declare C1F and C2F as strings in a module
       
       C1F = C1Funct
       C2F = C2Funct
    
    End Sub
    
    ---mod1.bas---
    
    Option Explicit
    Public C1F As String
    Public C2F As String
    
    ---frmdialog---
    
    Private Sub Cmd1_Click()
    
       CallByName C1F
    
    End Sub
    
    Private Sub Cmd2_Click()
    
       CallByName C2F
    
    End Sub
    I haven't checked the code but it'll probably work.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

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