home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code2 / pxcreate / pxcreate.txt < prev   
Text File  |  1991-07-12  |  2KB  |  33 lines

  1. CONTENTS:
  2. PXCREATE.MAK    Visual Basic project file.
  3. PXCREATE.FRM    Visual Basic form file.
  4. PXCREATE.EXE    Executable generated with Visual Basic.
  5. PXCREATE.TXT    This file.
  6.  
  7. I needed a way to use The Paradox Engine to create Paradox tables in VB. At
  8. first this seemed impossible because VB doesn't provide for arrays of
  9. pointers to strings. The solution is to use arrays of longs. The problem
  10. with this is that basic will not allow conversion of one type to another.
  11. This had me stumped because I could not get the address of a string into
  12. the elements of an array of longs. The solution was to make a Windows API
  13. call that accepts a pointer to a string, and a return value that is also a
  14. pointer to that same string. When you declare the function within VB you
  15. have to LIE to VB about it's return value. Instead of declaring it as
  16. returning a string value you declare it as returning a long. This is not
  17. a problem since they are both the same size. You can now assign the returned
  18. long value to an element of an array of longs and VB will not complain.
  19. When you call the PXTblCreate function you can pass the array to it. Since
  20. arrays are passed by reference you end up passing a pointer to an array
  21. of pointers to strings.
  22.  
  23. See the code attached to the button in the file "pxcreate.frm".
  24. This code has not been tested very well so it could contain bugs. Use it at
  25. your own risk.
  26.  
  27.  
  28. Jim Nech
  29. OurRider Systems  -   (Producers of Custom Controls for Visual Basic)
  30. 3701 Kirby DR. STE. 1196
  31. Houston, TX 77098
  32. Voice:(713)521-0486    Fax:(713)523-0386
  33.