Results 1 to 6 of 6

Thread: Dynamic creation of bitmaps

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    Toronto, Ontario
    Posts
    280

    Dynamic creation of bitmaps

    I'm creating a chess game (mostily in OpenGL) and am currently designing the backgrounds. Currently, I just can open any Bitmap, which is fairly cool. I was wondering, though, if it is possible to take a snap shot of the desktop (using WinAPI) and then convert it to a *.bmp file, all within the program (i.e. the program has to do it). Note: I know how to the get the bitmap into, say a picture box. The question has, how do I get that into a standard bitmap file.

  2. #2
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    Toronto, Ontario
    Posts
    280

    Exclamation Thanks.....

    .......but that doesn't entirely answer my question (however, it did answer many other questions!).

    I know how to get bitmaps (e.g. the desktop) using API. My problem is that I have to turn that into an external file (i.e.

    Code:
    sub exportBMP ()
      dim fileNum as integer
    
      fileNum = freeFile
    
      open *.bmp for binary as fileNum 'Open a file for ouput as binary
      .  
      . 'This is the part I need to know (header, file format...)
      .
      close fileNum
    end sub
    But again, thanks for the link, it is quite useful.

  4. #4
    Fanatic Member riis's Avatar
    Join Date
    Nov 2001
    Posts
    551
    For the file format of a bmp file you can look at wotsit.org.

    If you want to do it the easy way, you should get your bitmap into a picture box (you seem to know how you should do that) and then save the contents of the picture box with SavePicture.

  5. #5
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    if you just want to save a bitmap without any special things you can use the savepicture method of the picturebox.
    Sanity is a full time job

    Puh das war harter Stoff!

  6. #6
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Yes, but remember anything you transfer onto the Picturebox must be saved from the .Image, not the .Picture of the PictureBox.
    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