28 Sep, 2009
in 网络编程
by admin
The LoadIcon function loads the specified icon resource from the executable (.exe) file associated with an application instance.
Note This function hase been superseded by the LoadImage function.
Syntax
HICON LoadIcon(
HINSTANCE hInstance,
LPCTSTR lpIconName
);
Parameters
28 Sep, 2009
in 网络编程
by admin
在vc2005中,调用setwindowtext时,第二个参数用char[]会出错,建议使用TCHAR,因为vc2005默认为unicode。
如果是Unicode编程的话建议你使用TCHAR(16位w_char),不要用char,实际上是不是Unicode编程都好,使用TCHAR是个好习惯。 如果你想转换到Unicode的话可以用,MultiByteToWideChar函数。
28 Sep, 2009
in 网络编程
by admin
The WNDCLASSEX structure contains window class information. It is used with the RegisterClassEx and GetClassInfoEx functions.
//WNDCLASSEX结构包含了window 类信息。 它被RegisterClassEx 和GetClassInfoEx函数所使用。
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.
28 Sep, 2009
in 网络编程
by admin
BOOL ShowWindow( int nCmdShow ) throw(); Example //The following example attaches an HWND to the CWindow object and //calls CWindow::ShowWindow() to show the window in its maximized state CWindow myWindow; myWindow.Attach(hWnd); myWindow.ShowWindow(SW_SHOWMAXIMIZED); Requirements Header: atlwin.h
28 Sep, 2009
in 网络编程
by admin
一、关于MessageBox
消息框是个很常用的控件,属性比较多,本文列出了它的一些常用方法,及指出了它的一些应用场合。
1.MessageBox(“这是一个最简单的消息框!”);
2.MessageBox(“这是一个有标题的消息框!”,”标题”);
3.MessageBox(“这是一个确定 取消的消息框!”,”标题”, MB_OKCANCEL );
4.MessageBox(“这是一个警告的消息框!”,”标题”, MB_ICONEXCLAMATION );
5.MessageBox(“这是一个两种属性的消息框!”,”标题”, MB_ICONEXCLAMATION|MB_OKCANCEL );
6.if(MessageBox(“一种常用的应用”,”标题”,MB_ICONEXCLAMATION|MB_OKCANCEL)==IDCANCEL)
return;
28 Sep, 2009
in 网络编程
by admin
Windows使用两种字符集ANSI和UNICODE, 前者就是通常使用的单字节方式,但这种方式处理象中文这样的双字节字符不方便,容易出现半个汉字的情况。 而后者是双字节方式,方便处理双字节字符。 Windows NT的所有与字符有关的函数都提供两种方式的版本,而Windows 9x只支持ANSI方式。_T一般同字常数相关,如_T(“Hello”)。如果你编译一个程序为ANSI方式,_T实际不起任何作用。 而如果编译一个程序为UNICODE方式,则编译器会把”Hello”字符串以UNICODE方式保存。 _T()和_L()的区别在于,_L不管你是以什么方式编译,一律以以 UNICODE方式保存
28 Sep, 2009
in 个人收藏
by admin
Visual Studio 2008简体中文试用版(90天)变成永久正式版的两种方法:
一、先安装试用版,然后在“添加或删除程序”里找到VS2008,点“更改/删除”就会看到一个输入序列号的地方,把序列号输进去,点“升级”按钮即可,Team Suite和Professional通用。
二、把安装盘下Setupsetup.sdb文件中的[Product Key]项中对应的序列号更改为正式版的序列号后再安装即可。此方法需要重新打包。
因为九十天试用版本已经是rtm版本。所以改变序列号以后的升级或者安装,就会变成正式版,不再有使用期限。
26 Sep, 2009
in 网络编程
by admin
Windows GDI
WM_PAINT
The WM_PAINT message is sent when the system or another application makes a request to paint a portion of an application’s window. The message is sent when the UpdateWindow or RedrawWindow function is called, or by the DispatchMessage function when the application obtains a WM_PAINT message by using the GetMessage or PeekMessage function.
A window receives this message through its WindowProc function.
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_PAINT
WPARAM wParam, // not used
LPARAM lParam // not used
);
Parameters
wParam
This parameter is not used.
lParam
This parameter is not used.
Return Values
An application returns zero if it processes this message.
26 Sep, 2009
in 网络编程
by admin
The TextOut function writes a character string at the specified location, using the currently selected font, background color, and text color.
BOOL TextOut(
HDC hdc, // handle to DC
int nXStart, // x-coordinate of starting position
int nYStart, // y-coordinate of starting position
LPCTSTR lpString, // character string
int cbString // number of characters
);
Parameters
hdc
[in] Handle to the device context.
nXStart
[in] Specifies the x-coordinate, in logical coordinates, of the reference point that the system uses to align the string.
nYStart
[in] Specifies the y-coordinate, in logical coordinates, of the reference point that the system uses to align the string.
lpString
[in] Pointer to the string to be drawn. The string does not need to be zero-terminated, since cbString specifies the length of the string.
cbString
[in] Specifies the length of the string pointed to by lpString.Windows 95/98/Me: This value may not exceed 8192.
26 Sep, 2009
in 网络编程
by admin
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).