Article ID: 111011 - Last Review: October 14, 2003 - Revision: 2.1 Changing the Style of the Main WindowThis article was previously published under Q111011 SUMMARY
The style of Viewer's main window can be changed using the Windows
SetWindowLong() function. The prototype for SetWindowLong() is
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: 0x00010000 To use SetWindowLong() from Viewer, it must be registered in the [CONFIG] section of the .MVP file as follows: Note that SetWindowLong() is registered with the first parameter as an unsigned long (U) even though the SetWindowLong() function properly takes an HWND, which is an unsigned short int (u) in Windows 3.1, as the first parameter. SetWindowLong() must be registered this way if the internal hwndApp variable, which is an unsigned long, is to be passed to it. Because of the way arguments are passed, SetWindowLong() will still work correctly; the high word of hwndApp, which is zero-filled, will be ignored. However, if an unsigned short value will be passed to SetWindowLong(), then RegisterRoutine() must specify "u" for the first parameter. A Viewer title could obtain an unsigned short window handle by calling one of the Windows functions such as GetParent(). To remove the maximize box from the main Viewer window, the SetWindowLong() call would look as follows: MORE INFORMATION
The following list describes the styles mentioned above:
WS_BORDER - Creates a window that has a border. WS_CAPTION - Creates a window that has a title bar (implies the WS_BORDER style). This style cannot be used with the WS_DLGFRAME style. WS_CLIPCHILDREN - Excludes the area occupied by child windows when drawing within the parent window. Used when creating the parent window. WS_CLIPSIBLINGS - Clips child windows relative to each other; that is, when a particular child window receives a paint message, the WS_CLIPSIBLINGS style clips all other overlapped child windows out of the region of the child window to be updated. (If WS_CLIPSIBLINGS is not specified and child windows overlap, it is possible, when drawing within the client area of a child window, to draw within the client area of a neighboring child window.) For use with the WS_CHILD style only. WS_DISABLED - Creates a window that is initially disabled. WS_DLGFRAME - Creates a window with a double border but no title. WS_HSCROLL - Creates a window that has a horizontal scroll bar. WS_MAXIMIZE - Creates a window of maximum size. WS_MAXIMIZEBOX - Creates a window that has a Maximize button. WS_MINIMIZE - Creates a window that is initially minimized. For use with the WS_OVERLAPPED style only. WS_MINIMIZEBOX - Creates a window that has a Minimize button. WS_SYSMENU - Creates a window that has a System-menu box in its title bar. Used only for windows with title bars. WS_THICKFRAME - Creates a window with a thick frame that can be used to size the window. WS_VISIBLE - Creates a window that is initially visible. This applies to overlapped, child, and pop-up windows. For overlapped windows, the y parameter is used as a ShowWindow function parameter. WS_VSCROLL - Creates a window that has a vertical scroll bar. Note that one can determine the current styles of the main Viewer window using the Spy utility shipped with the Windows SDK. Choose Window\Window from Spy's menu. Then position the cursor over the main Viewer window. Spy will display the style of the window in the last line of the "Spy Window" dialog box. APPLIES TO
| Article Translations
|

Back to the top
