You can create, switch, and destroy screens from within server-based applications. A single NLM can have multiple screens, one screen, or no screens.
Screens are created using CreateScreen, which returns a handle to the new screen, but it does not switch to the new screen. You switch to a screen by passing a screen handle into SetCurrentScreen. Once the current screen has been set, all output for functions such as printf go to that screen.
The following function shows the creation of a new screen, which is then switched to be the current screen. A new thread is created from within ThreadTwo, so the new thread belongs to the same thread group as ThreadTwo. Therefore, its output goes to the new screen.
void ThreadTwo()
{
int screenHandle;
int oldScreen;
screenHandle = CreateScreen("Second Screen", 0);
oldScreen=SetCurrentScreen(screenHandle);
BeginThread(ThreadThree, NULL, NULL, "THREAD THREE ");
printf("This is printing on the second screen\n");
}
NOTE:Setting the current screen changes the current screen for all of the threads within the thread group.
By default, NLM screens do not close automatically when the NLM terminates. Instead, the following message is displayed at the bottom line of the monitor console when an NLM terminates:
<Press any key to close screen>
This occurs because some preexisting applications that are being ported to the NetWare environment might have been designed to write out a closing message to the screen and then terminate their execution. The auto-closing feature would immediately destroy the screen, possibly causing the operator to miss an important status message. If an application requires auto-closing, you can turn off the default <Press any key to close screen> screen-closing mode by using SetAutoScreenDestructionMode. Screens can also be closed within the NLM by calling DestroyScreen.
For more information about screens and how to write to them, see Screen Handling Concepts.
An NLM screen has two cursors associated with it: an input cursor and an output cursor. It is possible to position both an input cursor and an output cursor on the NLM screens, giving your application the ability to accept input at one location on the screen and write output at a different location. If you want to mimic the DOS cursor, you can couple the two cursors, causing them to always act as one cursor. (The default setting is to have the cursors coupled.) The cursor coupling is set using SetCursorCouplingMode.