次の方法で共有


GweBypassCoredllThunk_t::SetWindowLongW_I (Windows Embedded CE 6.0)

1/6/2010

This method changes an attribute of the specified window. GweBypassCoredllThunk_t::SetWindowLongW_I also sets a 32-bit (LONG) value at the specified offset into the extra window memory of a window.

Syntax

static LONG WINAPI SetWindowLongW_I(
  HWND hwndThis,
  int nIndex,
  LONG lNewLong
);

Parameters

  • hwndThis
    [in] Handle to the window and, indirectly, the class to which the window belongs.
  • nIndex
    [in] Integer that 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 4; 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. For Windows Embedded CE, the byte offset but must be a multiple of 4 bytes.

    The following table shows other possible values.

    Value Description

    GWL_EXSTYLE

    Sets a new extended window style.

    GWL_STYLE

    Sets a new window style.

    GWL_ID

    Sets a new identifier of the window.

    GWL_USERDATA

    Sets the 32-bit value associated with the window. Each window has a corresponding 32-bit value intended for use by the application that created the window.

    The following table shows values that are also available when the hWnd parameter identifies a dialog box.

    Value Description

    DWL_DLGPROC

    Sets the new address of the dialog box procedure.

    DWL_MSGRESULT

    Sets the return value of a message processed in the dialog box procedure.

    DWL_USER

    Sets new extra information that is private to the application, such as handles or pointers.

  • lNewLong
    [in] Long integer that specifies the replacement value.

Return Value

The previous value of the specified 32-bit integer indicates success. Zero indicates failure. To get extended error information, call GetLastError.

If the previous value of the specified 32-bit integer is zero, and the function succeeds, the return value is zero, but the function does not clear the last error information. This behavior causes difficult when determining success or failure. To deal with this, you should clear the last error information by calling SetLastError (0) before calling GweBypassCoredllThunk_t::SetWindowLongW_I. Then, function failure is indicated by a return value of zero and a GetLastError result that is nonzero.

Remarks

This method is an internal version of the SetWindowLong function.

The GweBypassCoredllThunk_t::SetWindowLongW_I method fails if the window specified by the hWnd parameter does not belong to the same process as the calling thread.

Unaligned access is not supported.

Certain window data is cached, so changes you make using GweBypassCoredllThunk_t::SetWindowLongW_I do not take effect until you call the GweBypassCoredllThunk_t::SetWindowPos_I method.

If you use GweBypassCoredllThunk_t::SetWindowLongW_I with the GWL_WNDPROC index to replace the window procedure, the window procedure must conform to the guidelines specified in the description of the WindowProc callback function.

If you use GweBypassCoredllThunk_t::SetWindowLongW_I with the DWL_MSGRESULT index to set the return value for a message processed by a dialog procedure, you should return TRUE directly afterwards. Otherwise, if you call any function that results in your dialog procedure receiving a window message, the nested window message could overwrite the return value you set using DWL_MSGRESULT.

Calling GweBypassCoredllThunk_t::SetWindowLongW_I with the GWL_WNDPROC index creates a subclass of the window class used to create the window. An application can subclass a system class, but should not subclass a window class created by another process. The GweBypassCoredllThunk_t::SetWindowLongW_I function creates the window subclass by changing the window procedure associated with a particular window class, causing the system to call the new window procedure instead of the previous one. An application must pass any messages not processed by the new window procedure to the previous window procedure by calling CallWindowProc. This call allows the application to create a chain of window procedures.

You must not call GweBypassCoredllThunk_t::SetWindowLongW_I with the GWL_HWNDPARENT index to change the parent of a child window. Instead, use the GweBypassCoredllThunk_t::SetParent_I method.

Requirements

Header gwebypasscoredllthunk.hpp
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

GweBypassCoredllThunk_t
CallWindowProc
RegisterClass
SetWindowLong
GweBypassCoredllThunk_t::GetWindowLongW_I
GweBypassCoredllThunk_t::SetParent_I
GweBypassCoredllThunk_t::SetWindowPos_I
WindowProc
WNDCLASS

Other Resources

SetLastError