标签:
一、int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int nCmdShow)
DECLARE_HANDLE(HINSTANCE);
typedef HINSTANCE HMODULE;
#define DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name
#ifndef VOID
#define VOID void
typedef char CHAR;
二、LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
typedef UINT_PTR WPARAM;
typedef LONG_PTR LPARAM;
typedef LONG_PTR LRESULT;
typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;
typedef _W64 long LONG_PTR, *PLONG_PTR;
三、窗口诞生过程总结
#ifdef UNICODE
typedef WNDCLASSW WNDCLASS;
typedef PWNDCLASSW PWNDCLASS;
typedef NPWNDCLASSW NPWNDCLASS;
typedef LPWNDCLASSW LPWNDCLASS;
#else
typedef WNDCLASSA WNDCLASS;
typedef PWNDCLASSA PWNDCLASS;
typedef NPWNDCLASSA NPWNDCLASS;
typedef LPWNDCLASSA LPWNDCLASS;
#endif // UNICODE
typedef struct tagWNDCLASSW {
UINT style; //窗口类型
WNDPROC lpfnWndProc; //窗口过程(必须是回调函数)
int cbClsExtra; //预留的额外空间,一般为0
int cbWndExtra; //预留的额外空间,一般为0
HINSTANCE hInstance; //应用程序的实例句柄
HICON hIcon; //为所有基于该窗口类的窗口设定一个图标
HCURSOR hCursor; //为所有基于该窗口类的窗口设定一个鼠标指针
HBRUSH hbrBackground; //指定窗口背景色
LPCWSTR lpszMenuName; //指定窗口菜单
LPCWSTR lpszClassName; //指定窗口类名
} WNDCLASSW, *PWNDCLASSW, NEAR *NPWNDCLASSW, FAR *LPWNDCLASSW;
HWND WINAPI CreateWindow(
_In_opt_ LPCTSTR lpClassName, // 窗口类名称
_In_opt_ LPCTSTR lpWindowName, // 窗口标题
_In_ DWORD dwStyle, // 窗口风格,或称窗口格式
_In_ int x, // 初始 x 坐标
_In_ int y, // 初始 y 坐标
_In_ int nWidth, // 初始 x 方向尺寸
_In_ int nHeight, // 初始 y 方向尺寸
_In_opt_ HWND hWndParent, // 父窗口句柄
_In_opt_ HMENU hMenu, // 窗口菜单句柄
_In_opt_ HINSTANCE hInstance, // 程序实例句柄
_In_opt_ LPVOID lpParam // 创建参数
);
BOOL WINAPI ShowWindow(
_In_ HWND hWnd,
_In_ int nCmdShow
);
BOOL UpdateWindow(
_In_ HWND hWnd
);
BOOL WINAPI GetMessage(
_Out_ LPMSG lpMsg, //指向MSG结构
_In_opt_ HWND hWnd, //需要检索消息窗口的句柄,为NULL时检索所有的当前线程的窗口消息和线程消息,为-1时只检索当前线程消息
_In_ UINT wMsgFilterMin, //指定被检索的最小消息值得整数
_In_ UINT wMsgFilterMax //指定被检索的最大消息值得整数
);
BOOL WINAPI TranslateMessage(
_In_ const MSG *lpMsg
);
LRESULT WINAPI DispatchMessage(
_In_ const MSG *lpmsg
);
标签:
原文地址:http://www.cnblogs.com/wd1001/p/4867950.html