WINCE6.0中的“hello world”,7月15日
来源:互联网 发布:ubuntu安装步骤 编辑:程序博客网 时间:2024/06/18 01:44
WINCE6.0中的“hello world”
#include <Windows.h>LRESULT CALLBACK myWNDPROC(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);int WinMain( HINSTANCE hInstance, //句柄HINSTANCE hPrevInstance, LPSTR lpCmdLine, //应用程序的启动参数 int nShowCmd) //显示方式{//创建一个窗体类对象WNDCLASS ws;HWND hwnd;MSG msgs;int nCmdShow;ws.cbClsExtra = 0;ws.cbWndExtra = 0;ws.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);ws.hCursor = NULL;ws.hIcon = NULL;ws.hInstance = hInstance;ws.lpfnWndProc = myWNDPROC; ws.lpszClassName = TEXT("hello");ws.lpszMenuName = NULL;ws.style = CS_VREDRAW | CS_HREDRAW;//注册窗体类if(!RegisterClass(&ws)) return -1;//创建窗体hwnd = CreateWindow(TEXT("hello"),TEXT("my first windows"),WS_VISIBLE|WS_BORDER,10,10,400,300,NULL,NULL,hInstance,NULL);//更新窗体内容UpdateWindow(hwnd);ShowWindow(hwnd,nCmdShow);//获取windows消息并进行发送while(GetMessage(&msgs,NULL,0,0)){TranslateMessage(&msgs);DispatchMessage(&msgs);}return 1;}CALLBACK myWNDPROC(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){if(msg == WM_DESTROY){PostQuitMessage(1);}return DefWindowProc(hwnd,msg,wParam,lParam);}
在以上代码基础上在进行修改,实现文字显示。
#include <Windows.h>LRESULT CALLBACK myWNDPROC(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);int WinMain( HINSTANCE hInstance, //句柄HINSTANCE hPrevInstance, LPSTR lpCmdLine, //应用程序的启动参数 int nShowCmd) //显示方式{//创建一个窗体类对象WNDCLASS ws;HWND hwnd;MSG msgs;int nCmdShow;ws.cbClsExtra = 0;ws.cbWndExtra = 0;ws.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);ws.hCursor = NULL;ws.hIcon = NULL;ws.hInstance = hInstance;ws.lpfnWndProc = myWNDPROC; ws.lpszClassName = TEXT("hello");ws.lpszMenuName = NULL;ws.style = CS_VREDRAW | CS_HREDRAW;//注册窗体类if(!RegisterClass(&ws)) return -1;//创建窗体hwnd = CreateWindow(TEXT("hello"),TEXT("my first windows"),WS_VISIBLE|WS_BORDER|WS_SYSMENU|WS_MAXIMIZEBOX|WS_MINIMIZEBOX|WS_CAPTION,10,10,400,300,NULL,NULL,hInstance,NULL);//更新窗体内容UpdateWindow(hwnd);ShowWindow(hwnd,nCmdShow);//获取windows消息并进行发送while(GetMessage(&msgs,NULL,0,0)){TranslateMessage(&msgs);DispatchMessage(&msgs);}return 1;}CALLBACK myWNDPROC(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){PAINTSTRUCT ps;HDC hdc;//设备环境RECT rect;GetClientRect(hwnd,&rect);if(msg == WM_DESTROY){PostQuitMessage(1);}if(msg==WM_PAINT){hdc=BeginPaint(hwnd,&ps);DrawText(hdc,TEXT("hello world"),-1,&rect,DT_VCENTER|DT_CENTER);EndPaint(hwnd,&ps);}return DefWindowProc(hwnd,msg,wParam,lParam);}
- WINCE6.0中的“hello world”,7月15日
- python中的hello world
- JavaMail中的"Hello World"
- 传说中的Hello World
- C#中的hello world
- OpenCL中的“Hello,world”
- Struts中的hello world
- JVM中的Hello World
- OSG中的Hello,world!
- 博客中的“hello world“
- maven中的Hello World!
- Flask中的Hello World
- 2014年10月22日开始我的编程学习,第一个c程序 Hello World !
- 精通J2ME中的Hello World
- HELLO WORLD中的设计模式
- Django中的Hello World体验
- 机器学习中的Hello World
- [0] Hello World
- cocos2d-x与ios内存管理分析
- 枚举(3)
- MySQL优化查询的方法
- ASN.1探索 - 2 基础知识(3)
- linux下安装mysql以及php的mysql扩展
- WINCE6.0中的“hello world”,7月15日
- 优化问题
- 11
- 后缀数组的例题应用
- 分数短语作主语,谓语的形式
- 数组左边减去右边数值的最大差值
- Maven参考2:Maven创建OSGI项目
- SAP message 探究
- 操作系统-从Linux装windows 挂载点错误的解决办法