请问 GetWindowslong()这个函数的参数和用法,谢谢
请尽量详细一些

解决方案 »

  1.   

    The GetWindowLong function retrieves information about the specified window. The function also retrieves the 32-bit (long) value at the specified offset into the extra window memory.If you are retrieving a pointer or a handle, this function has been superseded by the GetWindowLongPtr function. (Pointers and handles are 32 bits on 32-bit Microsoft® 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.
    SyntaxLONG GetWindowLong(          HWND hWnd,
        int nIndex
    );
    ParametershWnd
    [in] Handle to the window and, indirectly, the class to which the window belongs. 
    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 four; for example, if you specified 12 or more bytes of extra memory, a value of 8 would be an index to the third 32-bit integer. To retrieve any other value, specify one of the following values. 
    GWL_EXSTYLE
    Retrieves the extended window styles. For more information, see CreateWindowEx. 
    GWL_STYLE
    Retrieves the window styles.
    GWL_WNDPROC
    Retrieves the address of the window procedure, or a handle representing the address of the window procedure. You must use the CallWindowProc function to call the window procedure.
    GWL_HINSTANCE
    Retrieves a handle to the application instance.
    GWL_HWNDPARENT
    Retrieves a handle to the parent window, if any.
    GWL_ID
    Retrieves the identifier of the window.
    GWL_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 hWnd parameter identifies a dialog box.
    DWL_DLGPROC
    Retrieves the address of the dialog box procedure, or a handle representing the address of the dialog box procedure. You must use the CallWindowProc function to call the dialog box procedure.
    DWL_MSGRESULT
    Retrieves the return value of a message processed in the dialog box procedure.
    DWL_USER
    Retrieves extra information private to the application, such as handles or pointers.
    Return ValueIf the function succeeds, the return value is the requested 32-bit value.If the function fails, the return value is zero. To get extended error information, call GetLastError. If SetWindowLong has not been called previously, GetWindowLong returns zero for values in the extra window or class memory.
      

  2.   

    函数功能:该函数获得有关指定窗口的信息,函数也获得在额外窗口内存中指定偏移位地址的32位度整型值。    函数原型:LONG GetWindowLong(HWND hWnd,int nlndex);    参数:    hWnd:窗口句柄及间接给出的窗口所属的窗口类。    nlndex:指定要获得值的大于等于0的值的偏移量。有效值的范围从0到额外窗口内存空间的字节数一4例如,若指定了12位或多于12位的额外类存储空间,则应设为第三个32位整数的索引位8。要获得任意其他值,指定下列值之一:    GWL_EXSTYLE;获得扩展窗日风格。    GWL_STYLE:获得窗口风格。    GWL_WNDPROC:获得窗口过程的地址,或代表窗口过程的地址的句柄。必须使用GWL_WNDPROC函数调用窗口过程。    GWL_HINSTANCE:获得应用事例的句柄。    GWL_HWNDPAAENT:如果父窗口存在,获得父窗口句柄。    GWL_ID:获得窗口标识。    GWL_USERDATA:获得与窗口有关的32位值。每一个窗口均有一个由创建该窗口的应用程序使用的32位值。    在hWnd参数标识了一个对话框时也可用下列值:    DWL_DLGPROC:获得对话框过程的地址,或一个代表对话框过程的地址的句柄。必须使用函数CallWindowProc来调用对话框过程。    DWL_MSGRESULT:获得在对话框过程中一个消息处理的返回值。    DWL_USER:获得应用程序私有的额外信息,例如一个句柄或指针。    返回值:如果函数成功,返回值是所需的32位值;如果函数失败,返回值是0。若想获得更多错误信息请调用 GetLastError函数。    备注:通过使用函数RegisterClassEx将结构WNDCLASSEX中的cbWndExtra单元指定为一个非0值来保留额外类的存储空间。    Windows CE:nlndex参数指定的字节偏移量必须为 4的倍数。不支持 unaligmned access。    Windows CE:不支持在参数nlndex中设定的GWL_HINSTANCE和GWL_HWNDPARENT。    Windows CE1.0也不支持在 nlndex参数中的 DWL_DLGPROC和 GWL_USERDATA。    速查:Windows NT:3.1以上版本;Windows:95以上版本;Windows CE:1.0对以上版本;头文件:winuser.h;库文件:user32.lib;在Windows NT上实现为Unicode和ANSI两种版本。