Results 1 to 11 of 11

Thread: GetSurfaceFromDC Problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Posts
    15

    Unhappy GetSurfaceFromDC Problem

    Hello i need help

    I am using a picturebox to rotate an image and need to place it into a directdrawsurface7 object

    I am trying to use the DDraw.GetSurfaceFromDC command with the HDC of the Picturebox and it just wont have it, it comes back with a Automation error

    Please what am i doing wrong if it isnt possible to use this then how can i do it??????



    Set DSpriteSurfaces(i, LoadC) = DDraw.GetSurfaceFromDC(frmBattle.pbBattle.hDC)
    Wahoo i know something or not as the case may be

  2. #2
    Hyperactive Member tailz's Avatar
    Join Date
    Jul 2002
    Posts
    306
    I know it has been like a year since you posted this

    but did you get any result? I can get the function to work :\

  3. #3
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176
    I never got it working but i did find an alternative. I rotated the image in memory or loaded it from a file (The later being the better)
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  4. #4
    Hyperactive Member tailz's Avatar
    Join Date
    Jul 2002
    Posts
    306
    damn, ok

    I'll keep playing

  5. #5
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Instead of doing the rotating in the picture box (by no doubt i'm asuming your either using PSet pixel or BitBlt??) do it in the surface once its loaded, or in a OffScreenDC If your using BitBlt to do the editing then it shouldn't be hard to edit you current code. However if you are using the PSet you should be aware that its a slow process to use. If you insist on using the picture box you can create a surface normally then use BitBlt to blt you image from PictureBox.hDC to Surface.GetDC. If you were using the PSet statement look into Locking a surface and editing it pixel by pixel at great speed(compared to PSet Anyway).
    Hope all that helps you.
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  6. #6
    Hyperactive Member tailz's Avatar
    Join Date
    Jul 2002
    Posts
    306
    im not trying to rotate an object, I've got a pointer to a bitmap and I've been using SetDIBitsToDevice to get the bitmap on a picturebox, works ok but I want it to go on a DirectDrawSurface7 object...

  7. #7
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Damm I must type really slow the two of you have manged to post in the time it took me to write my post. Soz, my thorts are along the lines of BodwadUK, apart from the bit of saving the file and loading it back.
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  8. #8
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    How about if you do the method I mentioned of setting up the surface seprate by using the height and width then just BitBlt it over??
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  9. #9
    Hyperactive Member tailz's Avatar
    Join Date
    Jul 2002
    Posts
    306
    im trying but picbuffer.GetDC keeps giving me automation errors

  10. #10
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Have you set this flag??
    SurDesc.ddsCaps.lCaps = ... Or DDSCAPS_OWNDC
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  11. #11
    Hyperactive Member tailz's Avatar
    Join Date
    Jul 2002
    Posts
    306
    reading my code, I havent even created the surface :P

    gonna be a long day

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