Browsing the archives for the vc tag

vc中GetMessage Function函数简介

in 程序开发

The GetMessage function retrieves a message from the calling thread's message queue. The function dispatches incoming sent messages until a posted message is available for retrieval.

Unlike GetMessage, the PeekMessage function does not wait for a message to be posted before returning.

Syntax

BOOL GetMessage(

LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax
);
Parameters

lpMsg
[out] Pointer to an MSG structure that receives message information from the thread's message queue.
hWnd
[in] Handle to the window whose messages are to be retrieved. The window must belong to the current thread.
If hWnd is NULL, GetMessage retrieves messages for any window that belongs to the current thread, and any messages on the current thread's message queue whose hwnd value is NULL (see the MSG structure). Therefore if hWnd is NULL, both window messages and thread messages are processed.

If hWnd is -1, GetMessage retrieves only messages on the current thread's message queue whose hwnd value is NULL, that is, thread messages as posted by PostMessage (when the hWnd parameter is NULL) or PostThreadMessage.

wMsgFilterMin
[in] Specifies the integer value of the lowest message value to be retrieved. Use WM_KEYFIRST to specify the first keyboard message or WM_MOUSEFIRST to specify the first mouse message.
Windows XP: Use WM_INPUT here and in wMsgFilterMax to specify only the WM_INPUT messages.

If wMsgFilterMin and wMsgFilterMax are both zero, GetMessage returns all available messages (that is, no range filtering is performed).

wMsgFilterMax
[in] Specifies the integer value of the highest message value to be retrieved. Use WM_KEYLAST to specify the last keyboard message or WM_MOUSELAST to specify the last mouse message.
Windows XP: Use WM_INPUT here and in wMsgFilterMin to specify only the WM_INPUT messages.

If wMsgFilterMin and wMsgFilterMax are both zero, GetMessage returns all available messages (that is, no range filtering is performed).

0 Comments

vc中CreateWindow Function函数简介

in 程序开发

The CreateWindow function creates an overlapped, pop-up, or child window. It specifies the window class, window title, window style, and (optionally) the initial position and size of the window. The function also specifies the window's parent or owner, if any, and the window's menu.

To use extended window styles in addition to the styles supported by CreateWindow, use the CreateWindowEx function.

Syntax

HWND CreateWindow(

LPCTSTR lpClassName,
LPCTSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam
);

0 Comments

vc中RegisterClassEx Function函数简介

in 程序开发

The RegisterClassEx function registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function.

Syntax

ATOM RegisterClassEx(

CONST WNDCLASSEX *lpwcx
);
Parameters

lpwcx
[in] Pointer to a WNDCLASSEX structure. You must fill the structure with the appropriate class attributes before passing it to the function.
Return Value

If the function succeeds, the return value is a class atom that uniquely identifies the class being registered. This atom can only be used by the CreateWindow, CreateWindowEx, GetClassInfo, GetClassInfoEx, FindWindow, FindWindowEx, and UnregisterClass functions and the IActiveIMMap::FilterClientWindows method.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

0 Comments

vc中WNDCLASSEX Structure结构简介

in 程序开发

WNDCLASSEX Structure

The WNDCLASSEX structure contains window class information. It is used with the RegisterClassEx and GetClassInfoEx functions.

The WNDCLASSEX structure is similar to the WNDCLASS structure. There are two differences. WNDCLASSEX includes the cbSize member, which specifies the size of the structure, and the hIconSm member, which contains a handle to a small icon associated with the window class.

Syntax

typedef struct {
UINT cbSize;
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCTSTR lpszMenuName;
LPCTSTR lpszClassName;
HICON hIconSm;
} WNDCLASSEX, *PWNDCLASSEX;
Members

0 Comments

vc中的WinMain函数

in 程序开发

函数头如下:
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
我找了很多资料,都没有讲的。

HINSTANCE hCur Instance 指应用程序的句柄
HINSTANCE hPrevInstance指前一个应用程序的句柄(一般都是NULL)
LPSTR lpCmdLine 指向命令行参数的字符串指针

int nCmdShow 要传给ShowWindow函数的变量,表名窗口如何显示

0 Comments

[献给想深入学习网络编程的朋友] C,C++网络编程学习简明指南

in 程序开发

C,C++网络编程学习简明指南
1. 扎实的C,C++基础知识
参考资料《C程序设计》,《C++ primer》。

2. TCP/IP协议
经典书是:W.Richard Stevens 著《TCP/IP详解》三卷书,卷1是协议,卷2是实现,卷3是TCP事务协议等。还有官方的协议文档:RFC
当然也可以在网上下载电子书。
经典的开源协议分析工具:Wireshark.
简单的开源TCP/IP协议栈:LwIP,或者Linux 1.0里包含的协议栈,当然也可以看看FreeBSD的TCP/IP协议栈。

0 Comments

vc6.0中的消息映射机制

in 程序开发

看一下vc6.0自动生成的这段代码,你可能就明白什么一些了

BEGIN_MESSAGE_MAP(CFFDlg, CDialog) //{{AFX_MSG_MAP(CFFDlg) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_BN_CLICKED(IDC_JUMP, OnJump) ON_BN_DOUBLECLICKED(IDC_Stop, OnDoubleclickedStop) //}}AFX_MSG_MAPEND_MESSAGE_MAP()
BEGIN_MESSAGE_MAP(CFFDlg, CDialog)

//{{AFX_MSG_MAP(CFFDlg)

ON_WM_SYSCOMMAND()

ON_WM_PAINT()

ON_WM_QUERYDRAGICON()

ON_BN_CLICKED(IDC_BUTTON1, OnButton1)

ON_BN_CLICKED(IDC_JUMP, OnJump)

ON_BN_DOUBLECLICKED(IDC_Stop, OnDoubleclickedStop)

//}}AFX_MSG_MAP

END_MESSAGE_MAP()

0 Comments