0

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

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Areej N
0

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);

Edited by Clinton Portis: n/a

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.