home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 20074 < prev    next >
Encoding:
Text File  |  1993-01-28  |  1.6 KB  |  49 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!ukma!netsys!decwrl!csus.edu!netcom.com!uzzell
  3. From: uzzell@netcom.com (David Uzzell)
  4. Subject: extern structs
  5. Message-ID: <1993Jan28.230920.7789@netcom.com>
  6. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  7. Date: Thu, 28 Jan 1993 23:09:20 GMT
  8. Lines: 39
  9.  
  10. ubj:  extern structs Adv Windows Prog
  11.   To:  All
  12. From:  David Uzzell             71031,1411
  13. I am trying to find a clean way to do something that is probably not
  14. good C++ programming.  I have a C++ code generator that transfers data
  15. for dialog boxes via a struct defined as extern. This seems to require
  16. that I set the maximum number of items that can appear in a listbox at
  17. compile time. I don't want to do that.
  18.  
  19. Let's say I have a dialog box with a listbox and an editbox. This will
  20. generate a struct like so:
  21.  
  22.     extern struct
  23.         {
  24.             listItems[50][26]
  25.             editItem[25]
  26.         } ListData;
  27.  
  28. I want to define the listItems member of ListData such that it is 1 row
  29. by 26 columns at compile time, and at run time request the exact amount
  30. of RAM I need from the Windows global heap, put the listbox data there,
  31. and redefine listItems to point there.
  32.  
  33. I think that ListData should actually consist of 2 far pointers, and all
  34. I have to do is change the one that points to the listbox data. But I
  35. can't figure out the syntax to do it.
  36.  
  37. Is there an assignment statment I can write that will let me alter a
  38. pointer in an extern struct, effectively allowing me to reallocate an
  39. external array while retaining global access and keeping the same array
  40. name?
  41.  
  42. Thanks.
  43. David
  44.  
  45. uzzell@netcom.com
  46. uzzell@netcom.com
  47. D
  48.  
  49.