Skip to content

Commit 5546fa9

Browse files
committed
+ Windows API函数参考手册
1 parent 9ad7850 commit 5546fa9

File tree

6,349 files changed

+333059
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

6,349 files changed

+333059
-0
lines changed
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
�������а����˱����е�ʾ�������漰���󲿷�Դ���롣
2+
Դ�����ǰ��½�˳������ŵģ��������ڶ��߲��ġ�
3+
4+
�������е�������ҪΪ:
5+
6+
�ڶ��� ���ڴ���
7+
������ �豸�����ġ�DC
8+
������ ��ͼ����
9+
������ λͼ��ͼ��
10+
������ �˵�����
11+
������ �ļ�����
12+
�ڰ��� ͬ��
13+
�ھ��� �����ı�������
14+
��ʮ�� Ӳ����ϵͳ
15+
��ʮһ�� Windows ��Ϣ
16+
��ʮ���� ���̺��߳�
17+
18+
��������ʾ���Ƚ϶࣬���Ա�������Ҫ���ṩԴ���룬
19+
��VC��������ʹ��VC6.0)����IJ���ֻ�����˿�ִ�г���
20+
�����������ڹ��̿ռ����޶�ȥ���ˣ������Ҫ�ò��֣�
21+
�û�������VC�����£�����ӦĿ¼�µ�.DSW�ļ���Ȼ���Լ����뼴�ɡ�
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
// 2_2_1_1.cpp : Defines the entry point for the application.
2+
//
3+
4+
#include "stdafx.h"
5+
#include "resource.h"
6+
7+
#define MAX_LOADSTRING 100
8+
9+
// Global Variables:
10+
HINSTANCE hInst; // current instance
11+
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
12+
TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text
13+
14+
// Foward declarations of functions included in this code module:
15+
ATOM MyRegisterClass(HINSTANCE hInstance);
16+
BOOL InitInstance(HINSTANCE, int);
17+
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
18+
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
19+
20+
int APIENTRY WinMain(HINSTANCE hInstance,
21+
HINSTANCE hPrevInstance,
22+
LPSTR lpCmdLine,
23+
int nCmdShow)
24+
{
25+
// TODO: Place code here.
26+
MSG msg;
27+
HACCEL hAccelTable;
28+
29+
// Initialize global strings
30+
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
31+
LoadString(hInstance, IDC_MY2_2_1_1, szWindowClass, MAX_LOADSTRING);
32+
MyRegisterClass(hInstance);
33+
34+
// Perform application initialization:
35+
if (!InitInstance (hInstance, nCmdShow))
36+
{
37+
return FALSE;
38+
}
39+
40+
hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_MY2_2_1_1);
41+
42+
// Main message loop:
43+
while (GetMessage(&msg, NULL, 0, 0))
44+
{
45+
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
46+
{
47+
TranslateMessage(&msg);
48+
DispatchMessage(&msg);
49+
}
50+
}
51+
52+
return msg.wParam;
53+
}
54+
55+
56+
57+
//
58+
// FUNCTION: MyRegisterClass()
59+
//
60+
// PURPOSE: Registers the window class.
61+
//
62+
// COMMENTS:
63+
//
64+
// This function and its usage is only necessary if you want this code
65+
// to be compatible with Win32 systems prior to the 'RegisterClassEx'
66+
// function that was added to Windows 95. It is important to call this function
67+
// so that the application will get 'well formed' small icons associated
68+
// with it.
69+
//
70+
ATOM MyRegisterClass(HINSTANCE hInstance)
71+
{
72+
WNDCLASSEX wcex;
73+
74+
wcex.cbSize = sizeof(WNDCLASSEX);
75+
76+
wcex.style = CS_HREDRAW | CS_VREDRAW;
77+
wcex.lpfnWndProc = (WNDPROC)WndProc;
78+
wcex.cbClsExtra = 0;
79+
wcex.cbWndExtra = 0;
80+
wcex.hInstance = hInstance;
81+
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_MY2_2_1_1);
82+
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
83+
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
84+
wcex.lpszMenuName = (LPCSTR)IDC_MY2_2_1_1;
85+
wcex.lpszClassName = szWindowClass;
86+
wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
87+
88+
return RegisterClassEx(&wcex);
89+
}
90+
91+
//
92+
// FUNCTION: InitInstance(HANDLE, int)
93+
//
94+
// PURPOSE: Saves instance handle and creates main window
95+
//
96+
// COMMENTS:
97+
//
98+
// In this function, we save the instance handle in a global variable and
99+
// create and display the main program window.
100+
//
101+
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
102+
{
103+
HWND hWnd;
104+
105+
hInst = hInstance; // Store instance handle in our global variable
106+
107+
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
108+
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
109+
110+
if (!hWnd)
111+
{
112+
return FALSE;
113+
}
114+
115+
ShowWindow(hWnd, nCmdShow);
116+
UpdateWindow(hWnd);
117+
118+
return TRUE;
119+
}
120+
121+
//
122+
// FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
123+
//
124+
// PURPOSE: Processes messages for the main window.
125+
//
126+
// WM_COMMAND - process the application menu
127+
// WM_PAINT - Paint the main window
128+
// WM_DESTROY - post a quit message and return
129+
//
130+
//
131+
#define IDC_BUTTON1 106
132+
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
133+
{
134+
int wmId, wmEvent;
135+
PAINTSTRUCT ps;
136+
HDC hdc;
137+
TCHAR szHello[MAX_LOADSTRING];
138+
LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);
139+
140+
switch (message)
141+
{
142+
case WM_COMMAND:
143+
wmId = LOWORD(wParam);
144+
wmEvent = HIWORD(wParam);
145+
// 分析消息的各种来源并进行相应处理:
146+
switch (wmId)
147+
{
148+
//响应BUTTON1的点击事件
149+
case IDC_BUTTON1:
150+
DialogBox ( hInst , (LPCTSTR)IDD_ABOUTBOX ,
151+
hWnd ,(DLGPROC)About);
152+
break;
153+
default:
154+
return DefWindowProc(hWnd, message, wParam, lParam);
155+
}
156+
157+
break;
158+
case WM_RBUTTONDOWN:
159+
//创建Button控件
160+
CreateWindow ( "BUTTON","TEST",WS_VISIBLE|WS_CHILD,10,10,
161+
100,20,hWnd,(HMENU)IDC_BUTTON1,hInst,NULL);
162+
break;
163+
164+
case WM_DESTROY:
165+
PostQuitMessage(0);
166+
break;
167+
default:
168+
return DefWindowProc(hWnd, message, wParam, lParam);
169+
}
170+
return 0;
171+
}
172+
173+
// Mesage handler for about box.
174+
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
175+
{
176+
switch (message)
177+
{
178+
case WM_INITDIALOG:
179+
return TRUE;
180+
181+
case WM_COMMAND:
182+
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
183+
{
184+
EndDialog(hDlg, LOWORD(wParam));
185+
return TRUE;
186+
}
187+
break;
188+
}
189+
return FALSE;
190+
}

Windows API函数参考手册/第02章窗口处理/2.2窗口的创建和撤销/2_2_1_1/2_2_1_1.dsp

+138
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Microsoft Developer Studio Workspace File, Format Version 6.00
2+
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
3+
4+
###############################################################################
5+
6+
Project: "2_2_1_1"=".\2_2_1_1.dsp" - Package Owner=<4>
7+
8+
Package=<5>
9+
{{{
10+
}}}
11+
12+
Package=<4>
13+
{{{
14+
}}}
15+
16+
###############################################################################
17+
18+
Global:
19+
20+
Package=<5>
21+
{{{
22+
}}}
23+
24+
Package=<3>
25+
{{{
26+
}}}
27+
28+
###############################################################################
29+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
#if !defined(AFX_2_2_1_1_H__6A72E6C6_B447_11D6_993A_00E04CE474BB__INCLUDED_)
3+
#define AFX_2_2_1_1_H__6A72E6C6_B447_11D6_993A_00E04CE474BB__INCLUDED_
4+
5+
#if _MSC_VER > 1000
6+
#pragma once
7+
#endif // _MSC_VER > 1000
8+
9+
#include "resource.h"
10+
11+
12+
#endif // !defined(AFX_2_2_1_1_H__6A72E6C6_B447_11D6_993A_00E04CE474BB__INCLUDED_)

0 commit comments

Comments
 (0)