ScanScreens

Returns a screen ID (a pointer to an OS screen structure) associated with the specified screen

Local Servers:nonblocking
Remote Servers:N/A
Classification:3.11, 3.12, 3.2, 4.x, 5.x, 6.x
Service:Screen Handling

Syntax

  #include <nwconio.h>  
   
  int ScanScreens  (  
     int     LastScreenID,   
     char   *name,   
     LONG   *attrib); 
  

Parameters

LastScreenID

(IN) Specifies a screen ID obtained by a previous ScanScreens call (or NULL to get the first screen ID).

name

(OUT) Points to the name of the screen.

attrib

(OUT) Points to the attributes of the given screen ID.

Return Values

This function returns the screen ID of the next screen on the list. If it returns a NULL value, there are no more screen IDs, or an invalid screen ID has been passed to the function, and errno is set to EBADHNDL.

Remarks

This function is used to get the next member on the list of the OS screen IDs.

When calling this function, pass a NULL value to obtain the first screen ID on the list. (Currently, it is always the system console’s ID. However, this might change in the future.)

You can also pass NULL values in the name and attrib parameters.

See Also

CreateScreen

Example

  /*  
     This example demonstrates using the Screen ID/Screen Handle  
     Conversion APIs. This program looks for all the screens  
     in the system and then prints on those screens their  
     names and attributes.  
  */  
   
  #include <errno.h>  
  #include <nwtypes.h>  
  #include <nwconio.h>  
  #include <stdio.h>  
  #include <nwthread.h>  
  #define property (x) if (att & x) printf ("%-40s\n", #x)  
  main ()  
  {  
     int  sID;  
     int  sh;  
     char buf[80];  
     LONG attr;  
     for (sID = NULL; sID = ScanScreens (sID, buf, &attr);)  
     {  
        sh = GetScreenInfo (sID, NULL, NULL);  
        /* there is no CLIB equivalent? */  
        if (!sh)  
        sh = CreateScreen ((char*) sID, 0);  
        /* let’s create one */  
        if (!sh)  
        {  
           ConsolePrintf ("errno: %d\n", errno);  
           abort();  
        }  
        SetCurrentScreen (sh);  
        gotoxy (1,1);  
        printf ("This screen is %s with these attributes:\n\r", buf);  
        property(HAS_A_CLIB_HANDLE);  
        property(_KEYBOARD_INPUT_ACTIVE);  
        property(_PROCESS_BLOCKED_ON_KEYBOARD);  
        property(_PROCESS_BLOCKED_ON_SCREEN);  
        property(_INPUT_CURSOR_DISABLED);  
        property(_SCREEN_HAS_TITLE_BAR);  
        property(_NON_SWITCHABLE_SCREEN);  
        property(DONT_CHECK_CTRL_CHARS);  
        property(AUTO_DESTROY_SCREEN);  
        property(POP_UP_SCREEN);  
        property(UNCOUPLED_CURSORS);  
        DestroyScreen (sh);  
     }  
  /* 
  getchar(); It abends if another process is doing input on this screen.
  */  
  }