HBITMAP hBmp; //要显示的位图
hBmp = LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAPgtlogo));
HDC hScreenDC = CreateDC("DISPLAY", NULL, NULL, NULL); //屏幕DC
HDC hMemDC = CreateCompatibleDC(hScreenDC); //内存DC
int iScreenWidth = ::GetDeviceCaps(hScreenDC, HORZRES); //屏幕的宽
int iScreenHeight = ::GetDeviceCaps(hScreenDC, VERTRES); //屏幕的高
BITMAP bmpInfo;
GetObject(hBmp, sizeof(BITMAP), &bmpInfo);
int iBmpWidth = bmpInfo.bmWidth; //位图宽
int iBmpHeight = bmpInfo.bmHeight; //位图高
int x = (iScreenWidth - iBmpWidth) / 2; //显示的x位置
int y = (iScreenHeight - iBmpHeight) / 2; //显示的y位置
SelectObject(hMemDC, hBmp);
::BitBlt(hScreenDC, x, y, iScreenWidth, iScreenHeight, hMemDC, 0, 0, SRCCOPY);
Sleep(2000); //查看效果
//释放资源
DeleteDC(hMemDC);
DeleteDC(hScreenDC);
DeleteObject(hBmp);