SetProp

http://www.vckbase.com/index.php/wv/473

	
CString g_szPropName = "Your Prop Name";
HANDLE	g_hValue = (HANDLE)1;

//设置窗口属性
SetProp(m_hWnd,g_szPropName,g_hValue);

HANDLE h = GetProp(hwnd,g_szPropName);
if( h == g_hValue)
{
	*(HWND*)lParam = hwnd;
	return false;
}

 

LONG_PTR SetWindowLongPtr(      

HWND hWnd, int nIndex, LONG_PTR dwNewLong );

Parameters

hWnd
[in] Handle to the window and, indirectly, the class to which the window belongs. The SetWindowLongPtr function fails if the window specified by the hWndparameter does not belong to the same process as the calling thread.
nIndex
[in] Specifies the zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of extra window memory, minus the size of an integer. To set any other value, specify one of the following values.
GWL_EXSTYLE
Sets a new extended window style. For more information, seeCreateWindowEx.
GWL_STYLE
Sets a newwindow style.
GWLP_WNDPROC
Sets a new address for the window procedure.
GWLP_HINSTANCE
Sets a new application instance handle.
GWLP_ID
Sets a new identifier of the window.
GWLP_USERDATA
Sets the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero.
The following values are also available when the hWndparameter identifies a dialog box.
DWLP_DLGPROC
Sets the new pointer to the dialog box procedure.
DWLP_MSGRESULT
Sets the return value of a message processed in the dialog box procedure.
DWLP_USER
Sets new extra information that is private to the application, such as handles or pointers.
dwNewLong
[in] Specifies the replacement value.

Return Value

If the function succeeds, the return value is the previous value of the specified offset.

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

If the previous value is zero and the function succeeds, the return value is zero, but the function does not clear the last error information. To determine success or failure, clear the last error information by calling SetLastError(0), then call SetWindowLongPtr. Function failure will be indicated by a return value of zero and a GetLastError result that is nonzero.

 

LONG_PTR GetWindowLongPtr(     

    HWND hWnd,
    int nIndex
);

 

hWnd
[in]

Handle to the window and, indirectly, the class to which the window belongs.

If you are retrieving a pointer or a handle, this function supersedes the GetWindowLong function. (Pointers and handles are 32 bits on 32-bit Windows and 64 bits on 64-bit Windows.) To write code that is compatible with both 32-bit and 64-bit versions of Windows, use GetWindowLongPtr.

nIndex
[in] Specifies the zero-based offset to the value to be retrieved. Valid values are in the range zero through the number of bytes of extra window memory, minus the size of an integer. To retrieve any other value, specify one of the following values.
GWL_EXSTYLE
Retrieves the extended window styles. For more information, seeCreateWindowEx.
GWL_STYLE
Retrieves thewindow styles.
GWLP_WNDPROC
Retrieves the pointer to the window procedure, or a handle representing the pointer to the window procedure. You must use theCallWindowProcfunction to call the window procedure.
GWLP_HINSTANCE
Retrieves a handle to the application instance.
GWLP_HWNDPARENT
Retrieves a handle to the parent window, if there is one.
GWLP_ID
Retrieves the identifier of the window.
GWLP_USERDATA
Retrieves the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero.
The following values are also available when the hWndparameter identifies a dialog box.
DWLP_DLGPROC
Retrieves the pointer to the dialog box procedure, or a handle representing the pointer to the dialog box procedure. You must use the CallWindowProcfunction to call the dialog box procedure.
DWLP_MSGRESULT
Retrieves the return value of a message processed in the dialog box procedure.
DWLP_USER
Retrieves extra information private to the application, such as handles or pointers.

Return Value

If the function succeeds, the return value is the requested value.

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

If SetWindowLongor SetWindowLongPtrhas not been called previously, GetWindowLongPtr returns zero for values in the extra window or class memory.

转载于:https://www.cnblogs.com/chunyou128/archive/2012/08/24/2653494.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值