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 ...
随机推荐
- winform 无法修改控件的location
dock and location 是因为设置了控件的Dock,导致无法修改
- YTU 2556: 空洞
2556: 空洞 时间限制: 1 Sec 内存限制: 128 MB 提交: 24 解决: 17 题目描述 春天来了,单身的霞姐越发地空虚寂寞,于是她想到一个办法,她认 为只要把英文字母上的洞都涂满 ...
- mac系统下配置域名映射关系
1.cd /private/etc/ 先修改权限:sudo chmod 777 hosts vi hosts localhost:etc mhx$ cat hosts ## # Host Databa ...
- Servlet单例非安全解析
Servlet容器默认是采用单实例多线程的方式处理多个请求 Servlet容器<Web容器<应用服务器?apache<tomcat<websphere Servlet不是线程安 ...
- uCos-III移植到STM32F10x
最近在百度上看了uCOS-III 的介绍后,诸多功能有很大的提升和改进,感觉有必要升级一下开发环境.百度介绍:http://baike.baidu.com/view/8531313.htm 环境: S ...
- poj3046 Ant Counting——多重集组合数
题目:http://poj.org/problem?id=3046 就是多重集组合数(分组背包优化): 从式子角度考虑:(干脆看这篇博客) https://blog.csdn.net/viphong/ ...
- String模块ascii_letters和digits
Python3中String模块ascii_letters和digits方法,其中ascii_letters是生成所有字母,从a-z和A-Z,digits是生成所有数字0-9. 示例如下: Pytho ...
- ubuntu12.04中极品五笔简体繁体切换
不小心切换成了繁体,按Ctrl+:,可以切换回来.
- bzoj 1103: [POI2007]大都市meg【dfs序+树状数组】
很明显的暗示,就是在树的dfs序上维护树状数组,加减的时候差分即可 #include<iostream> #include<cstdio> #include<cstrin ...
- jQuery笔记之Easing Plugin
jQuery easing 使用方法首先,项目中如果需要使用特殊的动画效果,则需要在引入jQuery之后引入jquery.easing.1.3.js<script type="text ...
