i have a program and i need to add a photo after a result .so can i add a photo to my c++ program??

Recommended Answers

All 2 Replies

You will probably want to take some time one day and study the http://www.winprog.org/tutorial/bitmaps.html.

Also, since you are operating in a DOS console environment, be sure to check out adrianwx's windows programming for DOS tutorial.

Although I am not sure if one can load a bitmap to a dos console (i'm somewhat intruiged by this and am currently thinking of possibilities) here is a basic standard code for loading a bitmap in a win32 application:

//Just to give you an idea of what you are about to get into
#include<windows.h>

   HBITMAP g_hbmBal = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BALL));
        
   if(g_hbmBall == NULL)
        MessageBox(hwnd, "Could not load IDB_BALL!", "Error", MB_OK | MB_ICONEXCLAMATION);




   BITMAP bm;
   PAINTSTRUCT ps;

   HDC hdc = BeginPaint(hwnd, &ps);

   HDC hdcMem = CreateCompatibleDC(hdc);
   HBITMAP hbmOld = SelectObject(hdcMem, g_hbmBall);

   GetObject(g_hbmBall, sizeof(bm), &bm);

   //Here is where the bitmap is drawn to the window
   BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);

   SelectObject(hdcMem, hbmOld);
   DeleteDC(hdcMem);

   EndPaint(hwnd, &ps);

THANKS Clinton Portis FOR YOUR HELP, I WILL TRY TO DO IT ASAP .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.