WINDOW SET USER statement

Purpose | Manipulate a Window in the program, which may include setting or retrieving data. The target window may be of any class, including a CONTROL or Dialog.
Syntax | WINDOW SET ID hWin, NewVal& TO OldValVar& WINDOW SET STYLE hWin, NewVal& TO OldValVar& WINDOW SET STYLEX hWin, NewVal& TO OldValVar& WINDOW SET USER hWin, NewVal& TO OldValVar&
hWin | Handle of the Window to be used.
OldValVar& | A long integer variable to which the old value of the item is assigned.

Remarks

The WINDOW SET statement may be used with any type of window in your program, including a Control or Dialog. However, you must use care due to possible side effects. Generally speaking, the window to be manipulated is identified by its handle (hWin), which is often obtained at the time it is created. However, since a control is usually accessed by a "Parent / ID" combination, you must use WINDOW GET HANDLE or CONTROL HANDLE to retrieve its handle for this purpose.

WINDOW SET ID hWin, NewVal& To OldValVar&

The integral ID of the window hWin is changed to NewVal&. The prior ID value is assigned to the variable designated by OldValVar&. If the operation fails, the value zero (0) is assigned to OldValVar&. As a general rule, you should not change the ID of a Window, Dialog, or Control created with DDT as it will cause unpredictable results.

WINDOW SET STYLE hWin, NewVal& TO OldValVar&

The window style value of the window hWin is changed to NewVal&. The prior style value is assigned to the variable designated by OldValVar&. If the operation fails, the value zero (0) is assigned to OldValVar&.

WINDOW SET STYLEX hWin, NewVal& TO OldValVar&

The extended window style value of the window hWin is changed to NewVal&. The prior extended style value is assigned to the variable designated by OldValVar&. If the operation fails, the value zero (0) is assigned to OldValVar&.

WINDOW SET USER hWin, NewVal& TO OldValVar&

The 32-bit user data value associated with the window specified by the handle hWin is changed to NewVal&. The prior user data value is assigned to the variable designated by OldValVar&. This particular user data value is associated with every window in your program, and is maintained by the Windows operating system. It is separate and apart from user data maintained by DDT for each dialog and control created with DDT. If the operation fails, the value zero (0) is assigned to OldValVar&. However, this is not a certain indication of failure, since the prior user value might have been zero.

See also | CONTROL HANDLE, WINDOW GET