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 ...
随机推荐
- regular expression 在线检测的网站
http://regexone.com/ 学习网站 http://regexone.com/lesson/optional_characters? http://regexone.com/less ...
- YTU 2579: 填空题----删除指定字符
2579: 填空题----删除指定字符 时间限制: 1 Sec 内存限制: 128 MB 提交: 164 解决: 61 题目描述 小明想要做个小程序,能够删除字符串中特定的字符. 例如:想要在下面 ...
- Git 仓库结构 (二)***
一.GIT工作流程 了解git,首先要弄清楚对象在被git管理过程中所处的4个阶段,分别是: 工作目录 index(又称为暂存区) 本地仓库 远程仓库. 从时间先后来讲,工作目录的内容是你当前看到的, ...
- 关于CentOS 7安装solr+tomcat
1.Solr7.1.0 安装部署(centos7) Solr7.1.0为目前的最新版,安装环境需要jdk1.8 或者更高,容器我用的tomcat,也建议tomcat8.0或者更高 1.1.下载solr ...
- Linux系统调用之open(), close() (转载)
转自:http://joe.is-programmer.com/posts/17463.html open函数可以打开或创建一个文件. #include <sys/types.h> #in ...
- 浅谈扩展欧几里得[exgcd] By cellur925
关于扩展欧几里得从寒假时就很迷,抄题解过了同余方程,但是原理并不理解. 今天终于把坑填上了qwq. 由于本人太菜,不会用markdown,所以这篇总结是手写的(什么).(字丑不要嫌弃嘛) ****** ...
- Linux 入门学习教材
我大约从两年前开始接触Linux,在那之前工作中用的都是MCU,arm-cortex M系列的. 从单片机转向Linux学习,经历了很多的困难,刚开始都不知道怎么去编译, 网上也没有找到基础的教程,后 ...
- 【原创】《从0开始学Elasticsearch》—初识Elasticsearch
目录 1. Elasticsearch 是什么2. Elasticsearch 中基本概念3. Elasticsearch 安装4. 访问 Elasticsearch 1. Elasticsearch ...
- Person p = new Person("zhangsan",20);该句话都做了什么事情?
1,因为new用到了Person.class.所以会先找到Person.class文件并加载到内存中.2,执行该类中的static代码块,如果有的话,给Person.class类进行初始化.3,在堆内 ...
- Linux环境下MySQL5.7安装记录
参考文档 <Installing MySQL on Unix/Linux Using Generic Binaries> https://dev.mysql.com/doc/refman/ ...
