• 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.

  • 相关阅读:
    11Java网络编程
    Java字节流与字符流
    10缓冲流、转换流、序列化流、Files
    JavaFile类和递归
    Java线程池 与Lambda
    Java多线程与线程同步
    5Java异常处理
    php base64数据与图片的转换
    PHP的json_encode中文被转码的问题
    设置MySQL允许外网访问
  • 原文地址:https://www.cnblogs.com/chunyou128/p/2653494.html
Copyright © 2020-2023  润新知