Article ID: 111011
Article Last Modified on 10/14/2003
LONG SetWindowLong(HWND hwnd, int nOffset, LONG nVal)where hwnd is the handle of the window, nOffset is the offset of the value to change, and nVal is the new value for the offset. Further documentation for the SetWindowLong() function can be found in the documentation for the Windows 3.1 Software Development Kit (SDK). To change the window style, the value -16 (which is the value of the Windows constant GWL_STYLE) should be specified for nOffset. The possible values for nVal are combinations of:
WS_CLIPSIBLINGS: 0x04000000 WS_CLIPCHILDREN: 0x02000000 WS_VISIBLE: 0x10000000 WS_DISABLED: 0x08000000 WS_MINIMIZE: 0x20000000 WS_MAXIMIZE: 0x01000000 WS_CAPTION: 0x00C00000 WS_BORDER: 0x00800000 WS_DLGFRAME: 0x00400000 WS_VSCROLL: 0x00200000 WS_HSCROLL: 0x00100000 WS_SYSMENU: 0x00080000 WS_THICKFRAME: 0x00040000 WS_MINIMIZEBOX: 0x00020000 WS_MAXIMIZEBOX: 0x00010000These values would be combined simply by or'ing them together. Each call to SetWindowLong() completely replaces the previous styles for the window with the new styles specified in the nVal parameter. By default, the main Viewer window has the styles WS_VISIBLE, WS_CLIPSIBLINGS, WS_CLIPCHILDREN, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX (that is, nVal=0x16CF0000).
RegisterRoutine(`user',`SetWindowLong',`UiU')SetWindowLong() can then be called from anywhere within the title with hwndApp as the first parameter, -16 as the second parameter, and the appropriate new style value in the third parameter. Microsoft recommends always including the WS_VISIBLE, WS_CLIPSIBLINGS, and WS_CLIPCHILDREN styles in the new value. That means the value of nVal would always be at least 0x16000000.
SetWindowLong(hwndApp,-16,0x16CE0000)To cause the main window frame to be redrawn immediately after the change to its style, you may need to call the Windows function SetWindowPos(). It can be registered as follows
RegisterRoutine(`user',`SetWindowPos',`Uuiiiiu')and then it can be called from anywhere within the title as follows:
SetWindowPos(hwndApp,0,0,0,0,0,39)The SetWindowPos() call above is equivalent to calling SetWindowPos(hwndApp,0,0,0,0,0,SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER) using the Windows constants defined in the WINDOWS.H include file from the Windows SDK.
Additional query words: 2.00 2.00a
Keywords: KB111011