Results 1 to 11 of 11

Thread: How can i add graphics to my C program

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2000
    Location
    Birmingham UK
    Posts
    50

    How can i add graphics to my C program

    Hi i am new to this how can i add graphics to my C program lets say i wanted to add a image file how would i do this
    Waheed Rafiq (ICT Technician):
    Network +

  2. #2
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    Are you just doing it in console? because you can't then.

    If not, look in to open GL and direct X

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2000
    Location
    Birmingham UK
    Posts
    50
    ehhhhhhhhhhh help plz i am using Borland C++ on Windows 98 so what header would i need and what code would i use


    i don't understand by open gL i am talking about basic *.bmp file being loaded up in lets say dos program or win32bit program how would i do this
    Waheed Rafiq (ICT Technician):
    Network +

  4. #4
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Wrong. You DON'T need OpenGL OR DirectX in order to add a simple 2D picture to your WIN32 program. All you need to do is call the LoadBitmap function to create a new bitmap. Next, use the SelectObject API in conjunction with the GetDC API to select the Bitmap into the DC and call the UpdateWindow function to reflect your changes!

    In MFC, there's the CBitmap::LoadBitmap and the CDC::SelectObject functions.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  5. #5

    Thread Starter
    Member
    Join Date
    Apr 2000
    Location
    Birmingham UK
    Posts
    50
    Micobasic


    Thank you for putting me on the right path this makes more sense .


    if only i had the knowledge



    Inforwarrior



    " May Man Kind deserve better "
    Waheed Rafiq (ICT Technician):
    Network +

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    If you want to load the image up into a window, it's best that you understand the basics of creating the window first as well, without using MFC, because otherwise you'll confused yourself.

    Also, Borland C++ doesn't come with MFC (I don't think, even though it may support it).
    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

  7. #7
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    I think John has a good tutorial on the top of the C++ forum that teaches the basics of VC++ - the API way.

    By the way, Parksie, do you know the answer to my other question (how do you change focus in a dialog)?


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Borland doesn't support MFC because of name mangling.

    Microbasic: have you tried this? Here's a quote from the docs:
    (Bitmaps can be selected for memory device contexts only, and for only one device context at a time.)
    You have to select the bitmap into a memory dc (created with CreateCompatibleDC) and the BitBlt it to the destination.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  9. #9
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Hey, look what I found that I made earlier...
    Attached Files Attached Files
    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

  10. #10
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    while(GetMessage(&msg, NULL, 0, 0))

    your early days, parksie?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  11. #11
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Must have been.

    Note to all, replace that with:
    Code:
    while(GetMessage(&msg, NULL, 0, 0) > 0)
    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

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