c语言 如何在输出中显示图片?

来源:百度知道 编辑:UC知道 时间:2024/05/24 22:57:51
比如一个16X16的BMP图片01.bmp(也可以是其他格式的文件,只要能输出几好),我可以在输出的任意位置输出他,要求VC++实现。

使用C++和DirectDraw做很容易,DirectDraw是专门用来做游戏的,我给你找个例子
#include <windows.h>
int iCarX=-200,iCarY=200;
HINSTANCE hInstance;
HDC hdcSrc,hdcBack,hdcMem;
HBITMAP hBitmapSrc,hBitmapBack,hBitmapMem;

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
int Render(HDC hdc);

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("Spirit") ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;

wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMen