#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创建一个窗体的更多相关文章

  1. java游戏开发杂谈 - 创建一个窗体

    package game1; import javax.swing.JFrame; /** * java游戏开发杂谈 * ---demo1:创建一个窗体 * * @author 台哥 * @date ...

  2. 编写Java程序,使用JFrame创建一个窗体

    返回本章节 返回作业目录 需求说明: 使用JFrame创建一个窗体 实现思路: 使用JFrame创建窗体的思路 定义一个窗体对象f,窗体名称为"一个简单窗口" 设置窗体左上角与显示 ...

  3. 【Windows编程】系列第二篇:Windows SDK创建基本控件

    在Win32 SDK环境下,怎么来创建常用的那些基本控件呢?我们知道如果用MFC,简单的拖放即可完成大多数控件的创建,但是我们既然是用Windows SDK API编程,当然是从根上解决这个问题,实际 ...

  4. 用vlc SDK创建一个播放视频文件和RTSP流视频的Demo

    #include <stdio.h> #include <tchar.h> #include <time.h> #include <windows.h> ...

  5. 使用Windows service创建一个简单的定时器

    一.需求 我们有时候可能会想要做一些定时任务,例如每隔一段时间去访问某个网站,或者下载一些东西到我们服务器上等等之类的事情,这时候windows service 是一个不错的选择. 二.实现 1.打开 ...

  6. 关于windows服务器创建一个ps1脚本的周期性定时任务

    测试环境: Windows Server 2008 R2 Standard  & Windows Server 2012 R2 Standard 周期运行的ps脚本:Clean_up_Secu ...

  7. 在windows下创建一个Mongo服务

    首先需要下载mongo的安装包 cmd.exe 这个需要用管理员权限打开 进入到mongo的安装目录 首先到C盘根据下面的命令手动创建一个 Data 文件夹 在Data 里面创建一个db文件夹一个lo ...

  8. windows程序设计 创建一个新的窗口

    #include <windows.h> LRESULT CALLBACK myProc(HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain(H ...

  9. windows sdk编程隐藏窗体标题栏

    #include <windows.h> /*消息处理函数声明*/ HRESULT CALLBACK WindowProc(HWND hwnd, UINT message, WPARAM ...

随机推荐

  1. JFreeChart生成饼形图(3) (转自 JSP开发技术大全)

    JFreeChart生成饼形图(3) (转自 JSP开发技术大全) 14.3 利用JFreeChart生成饼形图 通过JFreeChart插件,即可以生成普通效果的饼形图,也可以生成3D效果的饼形图: ...

  2. myeclipse 8.6安装SVN插件

    方法二: 安装subclipse, SVN 插件   1.从官网下载site-1.6.9.zip文件,网址是:subclipse.tigris.org,    2.从中解压出features与plug ...

  3. 关于python语言使用redis时,连接是否需要关闭的问题

    python操作完redis,需要关闭连接的吧,怎么关闭呢 1人赞 回复 君惜丶: redis-server会关闭空闲超时的连接redis.conf中可以设置超时时间:timeout 300 2017 ...

  4. Linux IO多路复用之epoll网络编程(含源码)

    前言 本章节是用基本的Linux基本函数加上epoll调用编写一个完整的服务器和客户端例子,可在Linux上运行,客户端和服务端的功能如下: 客户端从标准输入读入一行,发送到服务端 服务端从网络读取一 ...

  5. hdu 3507(DP+斜率优化)

    Print Article Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)To ...

  6. bzoj 1355: [Baltic2009]Radio Transmission【kmp】

    kmp复健,答案是n-next[n] #include<iostream> #include<cstdio> using namespace std; const int N= ...

  7. 在JS/jQuery中,怎么触发input的keypress/keydown/keyup事件?

    怎么触发keypress/keydown/keyup事件? 问题: 1.在之前的写的input后面添加了搜索按钮 2.input只有keyup事件,如下: $("#desktop_folde ...

  8. nginx_uWSGI_django_virtualenv_supervisor发布web服务器

    nginx_uWSGI_django_virtualenv_supervisor发布web服务器 nginx 导论 123456789101112131415161718192021222324252 ...

  9. CodeFoces Round #443(div.2)

    http://codeforces.com/contest/879/ A. Borya's Diagnosis time limit per test 2 seconds memory limit p ...

  10. ZooKeeper通过ACL修复未授权访问漏洞

    默认情况下ZooKeeper允许匿名访问,因此在安全漏洞扫描中暴漏未授权访问漏洞. 一.参考资料 <ZooKeeper 笔记(5) ACL(Access Control List)访问控制列表& ...