#include"windows.h"
#include<stdio.h>
#include<stdlib.h>
#include"resource.h"
#define size 100
HDC hMemDc;
HBITMAP hBmp;
BITMAP bmp;
HDC hDc;
LRESULT CALLBACK WindowProc
(
HWND , //handle to window
UINT , //message identifier
WPARAM ,//first message parameter
LPARAM //second message parameter
);
int WINAPI WinMain
(
HINSTANCE hInstance, //handle to current instance
HINSTANCE hPrevInstance, //handle to previous instance
LPSTR lpCmdLine, //pointer to command line
int nCmdShow //show state of window
)
{
HWND hwnd;
MSG msg;
WNDCLASS wndcls;
wndcls.cbClsExtra = 0;
wndcls.cbWndExtra = 0;
wndcls.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndcls.hCursor = LoadCursor(NULL,IDC_ARROW);
wndcls.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wndcls.hInstance = hInstance;
wndcls.lpfnWndProc = WindowProc;
wndcls.lpszClassName = "test";
wndcls.lpszMenuName = NULL;
wndcls.style = 0;
if (NULL==RegisterClass(&wndcls))MessageBox(NULL,"hellow",TEXT("test"),0);;
hwnd = CreateWindow("test",TEXT("test bitmap"),
WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
int i;
hBmp = LoadBitmap(hInstance,MAKEINTRESOURCE(mybmp));
GetObject(hBmp,sizeof(BITMAP),(LPVOID)&bmp);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while (GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WindowProc
(
HWND hWnd, //handle to window
UINT uMsg, //message identifier
WPARAM wParam,//first message parameter
LPARAM lParam //second message parameter
)
{
PAINTSTRUCT ps;
switch (uMsg)
{
case WM_CREATE:
hDc = GetDC(hWnd);
hMemDc = CreateCompatibleDC(hDc);
ReleaseDC(hWnd,hDc);
case WM_PAINT:
hDc = BeginPaint(hWnd,&ps);
SelectObject(hMemDc,hBmp);
BitBlt(hDc,250,100,bmp.bmWidth,bmp.bmHeight,hMemDc,0,0,SRCCOPY);
EndPaint(hWnd,&ps);
break;
case WM_DESTROY:
DeleteObject(hBmp);
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd,uMsg,wParam,lParam);
};
return 0;
}
简单实用的bmp文件显示程序
需积分: 3 195 浏览量
2008-06-18
18:01:40
上传
评论
收藏 2.22MB RAR 举报
friendKnight
- 粉丝: 5
- 资源: 12
最新资源
- 夜间灯光数据“合成DMSP(1992-2020)”(年度数据)
- 基于springboot的网上花店系统,包含后端springboot项目、前台(用户角色)和后台管理(管理员/卖家角色)两个前端
- 2022年版本异质机构投资者(压力敏感型和压力抵制型机构投资者)数据2000-2022年
- 【重磅、详细、2022更新!】1990-2022上市公司环境保护税(排污费)数据大合集!
- TVP-SV-VAR方法的MATLAB操作步骤及关键代码解释
- 7607p电信固件V2.0.0P1N6
- 0到180度移相电路Multisim仿真
- 全国水体矢量分省市县合集2023年OSM数据-一二三四五级水系与水系流域shp矢量数据
- 7607p移动固件CMCC-V2.0.6P1N2
- Python3数据分析与挖掘实战:源代码code
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈