windows SDK创建一个窗体
#include <windows.h> /* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */
char szClassName[ ] = "WindowsApp"; int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil) {
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_DBLCLKS; /* 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 = ; /* No extra bytes after the window class */
wincl.cbWndExtra = ; /* structure or the window instance */
/* Use Windows's default color as the background of the window */
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* 注册窗口类 wincl */
if (!RegisterClassEx (&wincl))
return ; /* The class is registered, let's create the program*/
hwnd = CreateWindowEx (
, /* Extended possibilites for variation */
szClassName, /* 类名 */
"标题", /* 标题 */
WS_OVERLAPPEDWINDOW, /* 窗体样式 */
CW_USEDEFAULT, /* 位置x */
CW_USEDEFAULT, /* 位置y */
, /* 宽度 */
, /* 高度 */
HWND_DESKTOP, /* 父窗口句柄 */
NULL, /* 无菜单 */
hThisInstance, /* 与hThisInstance关联 */
NULL /* 没有窗口创建数据*/
); /* 显示窗体 */
ShowWindow (hwnd, nFunsterStil); /* Run the message loop. It will run until GetMessage() returns 0 */
while (GetMessage (&messages, NULL, , ))
{
/* 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;
} /* 处理接收到消息,系统自动调用 */ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int result;
switch (message) /* handle the messages */
{
case WM_DESTROY://程序退出
PostQuitMessage (); /* 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 ;
}
windows SDK创建一个窗体的更多相关文章
- java游戏开发杂谈 - 创建一个窗体
package game1; import javax.swing.JFrame; /** * java游戏开发杂谈 * ---demo1:创建一个窗体 * * @author 台哥 * @date ...
- 编写Java程序,使用JFrame创建一个窗体
返回本章节 返回作业目录 需求说明: 使用JFrame创建一个窗体 实现思路: 使用JFrame创建窗体的思路 定义一个窗体对象f,窗体名称为"一个简单窗口" 设置窗体左上角与显示 ...
- 【Windows编程】系列第二篇:Windows SDK创建基本控件
在Win32 SDK环境下,怎么来创建常用的那些基本控件呢?我们知道如果用MFC,简单的拖放即可完成大多数控件的创建,但是我们既然是用Windows SDK API编程,当然是从根上解决这个问题,实际 ...
- 用vlc SDK创建一个播放视频文件和RTSP流视频的Demo
#include <stdio.h> #include <tchar.h> #include <time.h> #include <windows.h> ...
- 使用Windows service创建一个简单的定时器
一.需求 我们有时候可能会想要做一些定时任务,例如每隔一段时间去访问某个网站,或者下载一些东西到我们服务器上等等之类的事情,这时候windows service 是一个不错的选择. 二.实现 1.打开 ...
- 关于windows服务器创建一个ps1脚本的周期性定时任务
测试环境: Windows Server 2008 R2 Standard & Windows Server 2012 R2 Standard 周期运行的ps脚本:Clean_up_Secu ...
- 在windows下创建一个Mongo服务
首先需要下载mongo的安装包 cmd.exe 这个需要用管理员权限打开 进入到mongo的安装目录 首先到C盘根据下面的命令手动创建一个 Data 文件夹 在Data 里面创建一个db文件夹一个lo ...
- windows程序设计 创建一个新的窗口
#include <windows.h> LRESULT CALLBACK myProc(HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain(H ...
- windows sdk编程隐藏窗体标题栏
#include <windows.h> /*消息处理函数声明*/ HRESULT CALLBACK WindowProc(HWND hwnd, UINT message, WPARAM ...
随机推荐
- Android开发之自定义对话框
由于系统自带的对话框不好看,于是本人就自定义了一个对话框,以后有类似的就可以直接使用啦.先上效果图: 1,布局文件dialog_clear_normal.xml <?xml version=&q ...
- Android vector Path Data画图详解
SVG是一种矢量图格式,是Scalable Vector Graphics三个单词的首字母缩写.在xml文件中的标签是,画出的图形可以像一般的图片资源使用,例子如下: <vector xmlns ...
- 还在为AndroidStudio的Gradle版本配置头疼?看看老司机的解决方法吧
在AndroidStudio中新建项目成功后会自动下载对应版本的Gradle,那么下载的Gradle到什么地方呢? Mac上会默认下载到 /Users/<用户名>/.gradle/wrap ...
- 配置磁盘映射(在服务器和eclipse 中)
在eclipse中配置磁盘映射和项目名称访问省略:
- zabbix 监控ssdb
zabbix 的啥基础知识啥的,请看由本站大牛凉白开先生写的zabbix教程.这里说说如何监控ssdb.SSDB 是一个 C/C++ 语言开发的高性能 NoSQL 数据库, 支持 KV, list, ...
- hdu3652(含有13且能被13整除的数)数位DP基础
B-number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Su ...
- rm -rf 的“幸存者”
原文:http://blog.jobbole.com/70971/ 以 root 用户执行 rm –rf / 命令,然后观察下哪些文件或者指令会幸存下来.结果是什么也没少!因此你必须增加 —no-pr ...
- E20170519-ts
numeric adj. 数字的; 数值的; nibble vt. 啃,一点一点地咬(吃); rational adj. 理性的; 合理的; n. 合理的事物; [数] 有理数; numerato ...
- Linux 常用命令十三 kill
一.kill命令 kill命令用来删除执行中的程序或工作.kill可将指定的信息送至程序.预设的信息为SIGTERM(15),可将指定程序终止.若仍无法终止该程序,可使用SIGKILL(9)信息尝试强 ...
- XmlPullParser简单教程
官网: http://www.xmlpull.org 本文参考 : http://www.xmlpull.org/v1/download/unpacked/doc/quick_intro.html 1 ...
