Insert A Picture into C++

This is a discussion on Insert A Picture into C++ within the C++ Programming forums, part of the General Programming Boards category; hello~~~i m doing a program which is bout delivery system... so i need to insert a picture for the example:world ...

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    15

    Talking Insert A Picture into C++

    hello~~~i m doing a program which is bout delivery system...
    so i need to insert a picture for the example:world map, into the program...
    i am using
    compiler: MinGW
    OS: WinXP
    Language: C++

    this program should be run in the window console mode.

    So, i dunno which type of picture support this....and how am i going to insert the picture into the program??
    is there any function or library needed!!
    can anyone out there pls help!!!
    URGENT!!!
    thanks all!!!

  2. #2
    chococoder
    Join Date
    Nov 2004
    Posts
    515
    in console applications you have no graphical capabilities whatsoever (except character graphics like smileys.

    and no, it's not urgent whatsoever.

  3. #3
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    Look into win32 programming & win32 bitmaps. Otherwise, no photos :P.
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    MFC code to get it done. Again you cannot do this in console.
    Code:
    ...
    HGDIOBJ image=::LoadImage(AfxGetInstanceHandle(),
                                filename,
                                IMAGE_BITMAP,
                                0,
                                0,
                                LR_LOADFROMFILE | LR_VGACOLOR | LR_DEFAULTSIZE);
    
      if (image==NULL)
      {
        ::MessageBox(0,filename,"FILE ERROR",0);
    
        BITMAP info;
        info.bmBits=0;
        return info;
      }
    
      
      //BMP image on disk
      CDC ImageBitmapDC;
      CBitmap ImageBitmap;
    
      //Create compatible DC for image
      ImageBitmapDC.CreateCompatibleDC(NULL);
    
      //Create bitmap
      ImageBitmap.Attach(image);
    
      BITMAP BitmapInfo;
      ImageBitmap.GetObject(sizeof(BITMAP),&BitmapInfo);
    
      //Image Bitmap to DC
      ImageBitmapDC.SelectObject(ImageBitmap);
    
      //Bitlblt here
    
    ....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [C] change picture width and height in Static control (no MFC)
    By pc2-brazil in forum Windows Programming
    Replies: 1
    Last Post: 05-05-2008, 01:17 AM
  2. How to insert an item to a ListView
    By ysabelle in forum C++ Programming
    Replies: 2
    Last Post: 05-07-2007, 07:03 AM
  3. Insert unique record into database
    By groorj in forum C Programming
    Replies: 4
    Last Post: 12-29-2004, 10:06 AM
  4. How do I insert a picture in dos mode
    By Stan100 in forum Game Programming
    Replies: 3
    Last Post: 10-06-2002, 01:36 AM
  5. Insert picture for printing
    By ooosawaddee3 in forum C Programming
    Replies: 0
    Last Post: 04-05-2002, 08:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21