网站首页  词典首页

请输入您要查询的函数:

 

术语 setclasslongptr
释义 SetClassLongPtr
语法:
ULONG_PTR SetClassLongPtr( HWND hWnd,
int nIndex,
LONG_PTR dwNewLong
);
SetClassLongPtr功能
替换函数的SetClassLongPtr在指定的存储器或增加课时为哪一等级指定的窗口所属WNDCLASSEX结构抵消指定的值。
此函数取代SetClassLong功能。要编写的代码是与32位和64位微软Windows,使用SetClassLongPtr兼容。
参数
hWnd
[in]的窗口句柄,并间接地类所属的窗口。
nIndex
[in]指定的值替换。要设定额外的类内存值,指定的积极,从零开始的字节偏移值被设置。有效值范围在零通过额外的类内存的字节数,减去8,例如,如果您指定的24个或更多字节内存的增加课时,16个值将是第三个整数索引。要设置值以外的其他WNDCLASSEX结构,指定下列值之一。
GCL_CBCLSEXTRA
设置大小,以字节为单位,与类相关的额外的内存。设置此值不会改变已拨出额外的字节数。
GCL_CBWNDEXTRA
设置大小,以字节,额外的窗口,类中的每个窗口相关的内存。设置此值不会改变已拨出额外的字节数。有关如何访问此内存,见SetWindowLongPtr信息。
GCLP_ HBRBACKGROUND
替换的句柄与背景刷类关联。
GCLP_HCURSOR
取代了手柄与类相关的光标。
GCLP_HICON
取代了手柄与类相关的图标。
GCLP_HICONSM
检索的句柄小图标与类相关联。
GCLP_HMODULE
替换一个模块句柄注册类。
GCLP_MENUNAME
替换指针到菜单名称字符串。该字符串标识菜单资源与类相关联。
GCL_STYLE
替换窗口类样式位。
GCLP_WNDPROC
指针替换窗口过程与类相关联。
dwNewLong
[in]指定替代的价值。
返回值
如果函数成功,返回值是指定的偏移以前的值。如果这不是以前设置,返回值是零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
如果您使用SetClassLongPtr函数和GCLP_WNDPROC指数,以取代窗口程序,窗口过程必须符合在的WindowProc回调函数的描述中指定的指导方针。
调用与GCLP_WNDPROC指数SetClassLongPtr创建一个窗口类,影响其后的类创建的所有窗口的子类。应用程序可以子类系统类,但不应子窗口类由另一个进程创建的。
通过指定储备在与RegisterClassEx函数所使用的WNDCLASSEX结构cbClsExtra成员非零值增加课时的内存。
使用保健SetClassLongPtr功能。例如,它有可能改变使用SetClassLongPtr为一类的背景颜色,但这种改变不会立即重新绘制所有的窗口属于类。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
UnicodeImplemented为ANSI和Unicode版本。
参见
窗口类的概述,GetClassLongPtr,RegisterClassEx,SetWindowLongPtr,的WindowProc,窗口类
==英文原文==SetClassLongPtr Function
The SetClassLongPtr function replaces the specified value at the specified offset in the extra class memory or the WNDCLASSEX structure for the class to which the specified window belongs.
This function supersedes the SetClassLong function. To write code that is compatible with both 32-bit and 64-bit Microsoft Windows, use SetClassLongPtr.
Syntax
ULONG_PTR SetClassLongPtr( HWND hWnd,
int nIndex,
LONG_PTR dwNewLong
);
Parameters
hWnd
[in] Handle to the window and, indirectly, the class to which the window belongs.
nIndex
[in] Specifies the value to replace. To set a value in the extra class memory, specify the positive, zero-based byte offset of the value to be set. Valid values are in the range zero through the number of bytes of extra class memory, minus eight; for example, if you specified 24 or more bytes of extra class memory, a value of 16 would be an index to the third integer. To set a value other than the WNDCLASSEX structure, specify one of the following values.
GCL_CBCLSEXTRA
Sets the size, in bytes, of the extra memory associated with the class. Setting this value does not change the number of extra bytes already allocated.
GCL_CBWNDEXTRA
Sets the size, in bytes, of the extra window memory associated with each window in the class. Setting this value does not change the number of extra bytes already allocated. For information on how to access this memory, see SetWindowLongPtr .
GCLP_ HBRBACKGROUND
Replaces a handle to the background brush associated with the class.
GCLP_HCURSOR
Replaces a handle to the cursor associated with the class.
GCLP_HICON
Replaces a handle to the icon associated with the class.
GCLP_HICONSM
Retrieves a handle to the small icon associated with the class.
GCLP_HMODULE
Replaces a handle to the module that registered the class.
GCLP_MENUNAME
Replaces the pointer to the menu name string. The string identifies the menu resource associated with the class.
GCL_STYLE
Replaces the window-class style bits.
GCLP_WNDPROC
Replaces the pointer to the window procedure associated with the class.
dwNewLong
[in] Specifies the replacement value.
Return Value
If the function succeeds, the return value is the previous value of the specified offset. If this was not previously set, the return value is zero.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
Remarks
If you use the SetClassLongPtr function and the GCLP_WNDPROC index to replace the window procedure, the window procedure must conform to the guidelines specified in the description of the WindowProc callback function.
Calling SetClassLongPtr with the GCLP_WNDPROC index creates a subclass of the window class that affects all windows subsequently created with the class. An application can subclass a system class, but should not subclass a window class created by another process.
Reserve extra class memory by specifying a nonzero value in the cbClsExtra member of the WNDCLASSEX structure used with the RegisterClassEx function.
Use the SetClassLongPtr function with care. For example, it is possible to change the background color for a class by using SetClassLongPtr, but this change does not immediately repaint all windows belonging to the class.
Function Information
Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 3.1
UnicodeImplemented as ANSI and Unicode versions.
See Also
Window Classes Overview , GetClassLongPtr , RegisterClassEx , SetWindowLongPtr , WindowProc , WNDCLASSEX
==原始网址==http://msdn.microsoft.com/en-us/library/ms633589(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:24:29