Results 1 to 16 of 16

Thread: SetPixelV LOG HDC!!!!!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    115
    OK its me again guess what the thing WORKS it loads fast!!! OK but the code is to load a pic right its a special format (OMF sprite format) and so it loads it and plots it. The problem is it plots really really slowly (and its not cuz of the autoredraw property.) Ok so a friend suggested I tell it to remember the HDC so i'm not calling it again every time, so its not having to find the HDC by UserControl.hDC every time. But the problem is ok I define a variable, but no matter what I do it doesn't work. I say Msgbox UserControl.hDC, then Dim theDC as {itdoesntmatter}, then say theDC = UserControl.hDC, then say msgbox theDC and it gives me the same thing as the first message box. Works right? Wrong. When you call the SetPixelV with theDC instead of UserControl.hDC, it goes by without any error message at all but it just doesn't plot the darn point. Well if you know of how to do this, or if this is not at all the reason why it plots slow, tell me please!!!
    Vuen

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    115
    Well nuts. Well here is the line that plots it:

    Code:
    For arcnt = 0 To PicEnd
        If PicX(arcnt) > -1 And PicY(arcnt) > -1 Then
            SetPixelV UserControl.hdc, PicX(arcnt), PicY(arcnt), Pal(PicClr(arcnt))
        End If
    Next
    Hey maybe if I make it check if its offscreen as it loads it instead...
    Vuen

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    115
    Cool, it highlights keywords in blue...

    Nah, no difference. I made it check if it was offscreen as it loads it and if it was it just skips the whole putting-in-array and finding-color thing. I'm surprised it didn't make a difference. Oh well.
    Vuen

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    115
    How come no one knows this?
    Vuen

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    115

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    115
    Is this some joke everyone is playing against me? 27 people viewed this at least 1 of you can say "I don't know" right???
    Vuen

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I don't know!

    Vuen, How do I make those blue things? And that's not the important one, cuz I need those indentions.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    115
    K thanks phew

    just stick (code) and (/code) between your code but the () being the square ones. It will preserve your formatting, so you can paste VB code directly. It does the highlighting by itself.
    Vuen

  9. #9
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    That helped me alot. Thanks!

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    115
    n/p
    Vuen

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    115
    Doesn't anyone know this?
    Vuen

  12. #12
    Junior Member
    Join Date
    Sep 1999
    Location
    Kempton Park, Guateng, South Africa
    Posts
    24
    Vuen, if I am not mistaken (though it is the case with hwnd so I suppose it's the same with hdc), hwnd is never constant, it changes the whole time thus you can never remember the hwnd as you will never be 100% sure that you will get the same hwnd every time. This might be the same for the hdc.

    I hope this helped.

    P.S. graphic routines (espetially big images) can be very slow. Because of this, game company's prefer to code theyre graphic routines in assembler which is inherently faster. I don't know much of it but you could try using direct-x or direct draw.

    Good luck!
    "He who laughs at a question is not worth being asked"

    RavenCrow

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    115
    Yeah, I've been d/ling DirectX documentation on and off, but it IS 120 megs you know. If you can just pull me the part about setting individual pixels to a window using directdraw that would be great. And also I believe the hDC is set when the ctl is loaded and stays constant until unloaded.
    Vuen

  14. #14
    Junior Member
    Join Date
    Sep 1999
    Location
    Kempton Park, Guateng, South Africa
    Posts
    24
    I would if I could but seeing as I most probably know less of direct-x then you, you would be a better judge of what you need then me. That and the fact that my bandwidth is but poor and e-mailing a 120 meg file won't be considered smart as it would take the same time for your e-mail (maybe less) to downlad as downloading it from the site.

    Sorry I couldn't help you with that.

    "He who laughs at a question is not worth being asked"

    RavenCrow

  15. #15
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    This is what I found in the MSDN library. Maybe it is usefull:

    If the HasDC property is set to False, a new device context will be created by the system and the value of the hDC property will change each time it is called.

  16. #16

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    115
    Yeah but I need to log the hDC so when SetPixelV runs it does not have to recall the hDC from windows every time it runs, I think that's what is slowing it down.
    Vuen

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