// DC.cpp : Defines the entry point for the application. // #include "stdafx.h" #include int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HBITMAP hbit;//Handle for the bitmap BITMAP bmp;//Structure for a bitmap HDC hdc = GetDC(0);//Retrieve the destkop (0 = Desktop ) HDC hdc2 = CreateCompatibleDC(NULL);//Simply lets a memory device context //be created that will work with the bitmap //Now let the handle for the bitmap load a image hbit = (HBITMAP)LoadImage(hInstance,"Jlo.bmp",IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); GetObject(hbit,sizeof(bmp),&bmp);//Retireves all the into from hbit and stores it in struct bmp SelectObject(hdc2,hbit);//Used to load the correct DC for the Bitmap Object //Take all content and bitblt it to the screen BitBlt(hdc,100,100,bmp.bmHeight,bmp.bmWidth+20,hdc2,150,0,SRCINVERT); Sleep(3000);//View the masterpiece //Give all the memory back that we used DeleteDC(hdc);//Delete the Device Context for the desktop DeleteDC(hdc2);//Delete the handle used for the Compatible DC (BitMap) DeleteObject(hbit);//Delete the HBITMAP Object we created return 0; }