home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 2 / DATAFILE_PDCD2.iso / utilities2 / desklib / Libraries / Window / c / GetInfo < prev    next >
Encoding:
Text File  |  1993-05-11  |  1.6 KB  |  43 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Window.GetInfo.c
  12.     Author:  Copyright © 1992 Jason Williams
  13.     Version: 1.00 (19 Mar 1992)
  14.     Purpose: High-level window management functions: Get Window info
  15. */
  16.  
  17.  
  18. #include "WimpSWIs.h"
  19.  
  20. #include <stdlib.h>
  21. #include <string.h>
  22.  
  23.  
  24.  
  25. extern void Window_GetInfo(window_handle window, window_info *result)
  26. /* Returns just the window part of the window_info block (strips icon defn.s)
  27.  * The real solution would be to find out how many icons were in the window
  28.  * and then get a flex block big enough for the whole thing and then do it,
  29.  * but you can't read the number of icons until you have read the window_info
  30.  * so it's a bit difficult! As a result, I just use a 4kB block to hold
  31.  * the window definition in.
  32.  *      NOTE THAT THIS WILL CRASH IF A WINDOW HAS TOO MANY ICONS!!!!!
  33.  *      (anything more than about 120 icons will cause undefined results)
  34.  */
  35. {
  36.   int         block[1024];             /* 4096 bytes for winfo return block */
  37.   window_info *winfo = (window_info *) &block[0];
  38.  
  39.   winfo->window = window;
  40.   Wimp_GetWindowInfo(winfo);
  41.   memcpy(result, winfo, sizeof(window_info));
  42. }
  43.