// GT_HelloWorldWin32.cpp
// compile with: /D_UNICODE /DUNICODE /DWIN32 /D_WINDOWS /c
#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>
// Global variables
// The main window class name.
static TCHAR szWindowClass[] = _T("win32app");
// The string that appears in the application's title bar.
static TCHAR szTitle[] = _T("Win32 Guided Tour Application");
HINSTANCE hInst;
// Forward declarations of functions included in this code module:
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
if (!RegisterClassEx(&wcex))
{
MessageBox(NULL, _T("Call to RegisterClassEx failed!"), _T("Win32 Guided Tour"), NULL);
return 1;
}
hInst = hInstance;
// Store instance handle in our global variable
// The parameters to CreateWindow explained:
// szWindowClass: the name of the application
// szTitle: the text that appears in the title bar
// WS_OVERLAPPEDWINDOW: the type of window to create
// CW_USEDEFAULT, CW_USEDEFAULT: initial position (x, y)
// 500, 100: initial size (width, length)
// NULL: the parent of this window
// NULL: this application dows not have a menu bar
// hInstance: the first parameter from WinMain
// NULL: not used in this application
HWND hWnd = CreateWindow( szWindowClass, szTitle,
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
CW_USEDEFAULT, 500, 100, NULL, NULL,
hInstance, NULL );
if (!hWnd)
{
MessageBox(NULL,
_T("Call to CreateWindow failed!"),
_T("Win32 Guided Tour"), NULL);
return 1;
}
// The parameters to ShowWindow explained:
// hWnd: the value returned from CreateWindow
// nCmdShow: the fourth parameter from WinMain
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
// Main message loop:
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) msg.wParam;
}
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
// // PURPOSE: Processes messages for the main window.
// // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
TCHAR greeting[] = _T("love you ,媳粉!");
switch (message)
{
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps); // Here your application is laid out.
// For this introduction, we just print out "Hello, World!" // in the top left corner.
TextOut(hdc, 15, 15, greeting, _tcslen(greeting)); // End application-specific layout section.
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0); break;
default: return
DefWindowProc(hWnd, message, wParam, lParam);
break;
}
return 0;
}
没有合适的资源?快使用搜索试试~ 我知道了~
win32应用程序中建立对话框
共13个文件
pdb:2个
dsw:1个
exe:1个
4星 · 超过85%的资源 需积分: 34 64 下载量 95 浏览量
2012-02-03
12:45:40
上传
评论
收藏 1.11MB RAR 举报
温馨提示
win32应用程序中建立对话框,在win32中调用mfc的类库,利用create和callback,产生对话框窗体。
资源推荐
资源详情
资源评论
收起资源包目录
ee.rar (13个子文件)
ee
e.cpp 3KB
ee.dsw 512B
ee.ncb 41KB
ee.plg 1KB
Debug
vc60.pdb 76KB
vc60.idb 137KB
ee.pdb 345KB
ee.pch 3.4MB
e.obj 15KB
ee.exe 168KB
ee.ilk 187KB
ee.dsp 4KB
ee.opt 48KB
共 13 条
- 1
资源评论
- Yao-Blog2012-07-05没有对话框的设计,只是有字符串的显示
- luowenzhu2013-11-04这个例子不错,谢谢
- liangyun9292012-07-01还好,不过我是第一次接触这类东西,没有相关概念,看得吃力
- asdf___a2013-12-12例子很不错 可是还是有些差别
nma_123456
- 粉丝: 43
- 资源: 100
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功