INFO: Setting the Console Configuration <br><br>--------------------------------------------------------------------------------<br>The information in this article applies to:<br><br>Microsoft Win32 Application Programming Interface (API), used with:<br>the operating system Microsoft Windows NT, versions 3.1, 3.5, 4.0 <br>the operating system Microsoft Windows 2000<br><br>--------------------------------------------------------------------------------<br><br><br>SUMMARY<br>To create a command prompt with custom features such as <br><br>Settings<br>Fonts<br>Screen Size and Position<br>Screen Colors<br><br>create a new entry in the Program Manager for CMD.EXE (suppose that the description is CUSTOM), or a shortcut named custom if you are using NT4 or later), choose these items from the CMD system menu, and select Save Configuration in each dialog box. The settings are saved in the registry under <br> HKEY_CURRENT_USER/ <br> Console/ <br> custom <br>and are used when starting the CUSTOM command prompt from the Program Manager or when specifying: <br>start "custom" <br>This behavior is really a convenient side effect of <br>start <string> <br>which sets the title in the window title bar. When you create a new console window with the START command, the system looks in the registry and tries to match the title with one of the configurations stored there. If it cannot find it, it defaults to the values stored in: <br><br><br> HKEY_CURRENT_USER/ <br> Console/ <br> Configuration <br>This functionality can be duplicated in your own applications using the registry application programming interface (API). <br><br>For more information, please see the "Registry and Initialization Files" overview and the REGISTRY sample. <br><br>Additional query words: 3.10 3.50 <br><br> <br>SetConsoleWindowInfo<br>The SetConsoleWindowInfo function sets the current size and position of a console screen buffer's window. <br><br>BOOL SetConsoleWindowInfo(<br> HANDLE hConsoleOutput, // handle to screen buffer<br> BOOL bAbsolute, // coordinate type<br> CONST SMALL_RECT *lpConsoleWindow // window corners<br>);<br>Parameters<br>hConsoleOutput <br>[in] Handle to a console screen buffer. The handle must have GENERIC_WRITE access. <br>bAbsolute <br>[in] Specifies how the coordinates in the structure pointed to by the lpConsoleWindow parameter are used. If bAbsolute is TRUE, the coordinates specify the new upper-left and lower-right corners of the window. If it is FALSE, the coordinates are offsets to the current window-corner coordinates. <br>lpConsoleWindow <br>[in] Pointer to a SMALL_RECT structure that contains values that determine the new upper-left and lower-right corners of the window. <br>Return Values<br>If the function succeeds, the return value is nonzero.<br><br>If the function fails, the return value is zero. To get extended error information, call GetLastError. <br><br>Remarks<br>The function fails if the specified window rectangle extends beyond the boundaries of the screen buffer. This means that the Top and Left members of the lpConsoleWindow rectangle (or the calculated top and left coordinates, if bAbsolute is FALSE) cannot be less than zero. Similarly, the Bottom and Right members (or the calculated bottom and right coordinates) cannot be greater than (screen buffer height – 1) and (screen buffer width – 1), respectively. The function also fails if the Right member (or calculated right coordinate) is less than or equal to the Left member (or calculated left coordinate) or if the Bottom member (or calculated bottom coordinate) is less than or equal to the Top member (or calculated top coordinate). <br><br>For consoles with more than one screen buffer, changing the window location for one screen buffer does not affect the window locations of the other screen buffers. <br><br>To determine the current size and position of a screen buffer's window, use the GetConsoleScreenBufferInfo function. This function also returns the maximum size of the window, given the current screen buffer size, the current font size, and the screen size. The GetLargestConsoleWindowSize function returns the maximum window size given the current font and screen sizes, but it does not consider the size of the screen buffer. <br><br>SetConsoleWindowInfo can be used to scroll the contents of the screen buffer by shifting the position of the window rectangle without changing its size.