改这个程序好久,没有头绪,请圈子里的老大给个示范。要保持是Unicode版本,没有黑黑的控制台。
C++代码如下,在Visual Studio 2005下编译通过:
#include <windows.h><windows.h></windows.h>
#include <tchar.h><tchar.h></tchar.h>
/* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nCmdShow)
{
/* Make the class name into a global variable */
TCHAR szClassName[ ] = TEXT("HelloWorld");
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are saved */
WNDCLASSEX wincl; /* Data structure for the windowclass */
/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
wincl.style = CS_HREDRAW | CS_VREDRAW; /* Catch double-clicks */
wincl.cbSize = sizeof (WNDCLASSEX);
/* Use default icon and mouse-pointer */
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after the window class */
wincl.cbWndExtra = 0; /* structure or the window instance */
/* Use Windows's default colour as the background of the window */
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
/* Register the window class, and if it fails quit the program */
if (!RegisterClassEx (&wincl))
return 0;
/* The class is registered, let's create the program*/
hwnd = CreateWindowEx (
0, /* Extended possibilites for variation */
szClassName, /* Classname */
TEXT("SDK Verision"), /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */
CW_USEDEFAULT, /* The programs width */
CW_USEDEFAULT, /* and height in pixels */
NULL, /* The window is a child-window to desktop */
NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
/* Make the window visible on the screen */
ShowWindow (hwnd, nCmdShow);
/* Run the message loop. It will run until GetMessage() returns 0 */
while (GetMessage (&messages, NULL, 0, 0))
{
/* Translate virtual-key messages into character messages */
TranslateMessage(&messages);
/* Send message to WindowProcedure */
DispatchMessage(&messages);
}
/* The program return-value is 0 - The value that PostQuitMessage() gave */
return messages.wParam;
}
/* This function is called by the Windows function DispatchMessage() */
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
TCHAR szHello[] = TEXT("Hello world!");
switch (message) /* handle the messages */
{
case WM_PAINT:
hdc = BeginPaint(hwnd,&ps); //begin painting
GetClientRect(hwnd,&rect); //get the size of client area
DrawText(hdc,szHello,_tcslen(szHello),&rect,DT_CENTER); //show "hello world"
EndPaint(hwnd,&ps); //end painting
break;
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message queue */
break;
default: /* for messages that we don't deal with */
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
分享到:
相关推荐
【Asp.Net MVC 入门Hello World】一步一步改写简单的登录注册(一) 参考:http://www.0379zd.com/news/show/24102.htm
这是片假名的旧大须的改写版本! bancho仿真器,在使用时可提供更快,更稳定和可扩展的体验。安装诗织! 需要运行 v8 +。 安装依赖项并启动服务器。 $ cd shiori$ npm install$ node shiori外挂程式诗织! 目前已...
b) 将内存中字符串“world”改写成“WORLD”,并显示修改后的结果; c) 如果去掉字符串定义语句(黄色加亮)部分,程序运行结果如何? MESS DB ‘Hello, World! ’, 0DH,0AH, 24H d) 如果去掉下述语句,...
我们这里的工程名为helloworld。 6.这时软件自动添加基本的头文件,因为这个程序我们不需要其他的功能,所以 直接点击Next。 7.我们将base class 选为QDialog 对话框类。然后点击Next。 8.点击Finish,完成工程的...
湖心亭看雪扩写、改写各种版本.doc
《Oracle查询优化改写技巧与案例》PDF版本下载
我将它改写为一个VC版本。但是该版本比2.0.6B有点删减,比如说gonchuki支持的按钮快捷键我改写的不支持。 另外,我新加了一种Graphic按钮类型,该类型按钮显示4个图片:通常状态图片、按下图片、鼠标移动在按钮上时...
教主Oracle SQL高级查询优化改写完美培训视频 2.0版,这个我参与培训的,包含视频、SQL文件、教学文档内容完整,分享给大家学习,共同努力进阶转型开发DBA,人称教主,做sql改写十多年了,sql改写功底很强!
这个是我根据别人写的matlab版本改写而来,我看了下貌似没有用什么算法,不想其他论坛上说的用什么蚂蚁算法,那个据说搞不出来??我也不清楚,反正这个不讲押韵,据说要求越多,算法越好写,总之不管了,我觉得这个...
《Oracle查询优化改写技巧与案例》不讲具体语法,只是以案例的形式介绍各种查询语句的用法。第1~4章是基础部分,讲述了常用的各种基础语句,以及常见的错误和正确语句的写法。这部分的内容应熟练掌握,因为日常查询...
《Oracle查询优化改写技巧与案例》不讲具体语法,只是以案例的形式介绍各种查询语句的用法。第1~4章是基础部分,讲述了常用的各种基础语句,以及常见的错误和正确语句的写法。这部分的内容应熟练掌握,因为日常查询...
《Oracle查询优化改写技巧与案例》不讲具体语法,只是以案例的形式介绍各种查询语句的用法。第1~4章是基础部分,讲述了常用的各种基础语句,以及常见的错误和正确语句的写法。这部分的内容应熟练掌握,因为日常查询...
工程中用到GuiLib发现其原来的程序是vc6的 直接移植到2005上来有很多地方编不过,而且不支持unicode,于是改了改,并去掉了其静态库工程改写了一下Guilib.h文件,方便使用习惯。 传上来分享。
C语言,将一个递归程序用栈改写为非递归,其中用到栈的基本操作
Oracle查询优化改写技巧与案例2.0.pdf
java-业务需求需要根据经纬度计算面积,整理了一下根据经纬度计算面积,根据openlayers借鉴改写,亲测可用!
改写了proxool,让他支持spring注入 当用spring注入时间的时候,跑起来spring会报错。 是因为里面类似不一致的问题。改写之后,跑起来不会有问题
Oracle查询优化改写 技巧与案例.pdf