Announcement

Collapse
No announcement yet.

Just getting started in PB/DLL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Just getting started in PB/DLL

    Hello,

    I'm just getting started in PB/DLL, so I'll start
    off with a few questions:

    First, what code is used in PB/CC 2.0 to access a DLL created
    with PB/DLL? Something as easy as calling a function or sub, right?

    Second, PB/DLL has access to the entire WinAPI, so drawing lines, circles, etc
    isn't a problem? And once I write code for this, this may be called in my
    PB/CC code and it will work fine?

    Thanks!

    Regards,

    Paul
    [email protected]


    ------------------
    Westfront PC: Proudly
    programmed in PC/CC 2.0!
    Few cats act their age, while
    most just cough up furballs.

  • #2
    Paul,

    Your first question: How to access a PB.DLL from PBCC20.

    Here is a short sample DLL program and a PBCC program
    showing you how it is done.


    ' save this code for your DLL in \PBDLL60\BIN directory
    ' as filename.bas
    '
    ' compile code and copy filename.dll to your \pbcc20\?????????
    ' or the directory you will be putting the PBCC code in.
    Code:
       #COMPILE DLL
       #INCLUDE "Win32api.inc"   ' you may need to change path here
    
    DECLARE FUNCTION PxProgramName$ ()
    DECLARE FUNCTION PxFileSpecToken$ (BYVAL Which&, Spec$)
    
    
    FUNCTION PxProgramName$ () EXPORT
       #REGISTER NONE
       LOCAL appFileName AS ASCIIZ * 511
       GetModuleFileName Hmod&=GEtModuleHandle(""),appFileName,511
       FUNCTION=(appFileName)
    END FUNCTION
    
    FUNCTION PxFileSpecToken$ (BYVAL Which&, Spec$) EXPORT
    
        'Which& determines what part OF the path is extracted:
        '    0: Return All Back Does Nothing, default if which& <1 or >7
        '    1: Disk only (AS D [img]http://www.powerbasic.com/support/forums/smile.gif[/img]
        '    2: Path only
        '    3: Disk + Full Path
        '    4: BASE file NAME
        '    5: File extension
        '    6: File NAME + extension
        '    7: Disk + Master Path Only
           #REGISTER NONE
           LOCAL s$(),p&,sp$
           DIM s$(0 TO 7)
           IF which& < 1 OR which& > 7 THEN which&=0
           sp$=Spec$:s$(0)=sp$
           p& = INSTR(1,sp$,":")  ' GET DRIVE
           IF p& THEN s$(1)=LEFT$(sp$,p&):sp$=MID$(sp$,p&+1)
           P& = INSTR(-1,sp$,"\")
           IF p& THEN s$(2) = LEFT$(sp$,p&):sp$=MID$(sp$,p&+1)
           s$(3)=s$(1)+s$(2)
           p& = INSTR(4,s$(3),"\")
           IF p& THEN s$(7)= LEFT$(s$(3),p&)    ' disk+master path
           p& = INSTR(-1,sp$,".")
           IF p& THEN
              s$(5)=TRIM$(MID$(sp$,p&+1))
              s$(4)=TRIM$(LEFT$(sp$,p&-1))
              s$(6)=s$(4)+"."+s$(5)
           ELSE
              s$(4)=sp$:s$(6)=sp$
           END IF
           FUNCTION = s$(Which&)
    END FUNCTION
    
    '   end of DLL Code
    
    
    ' copy the code below to your pbcc20\?????? directory
    ' and save and compile as getname.bas
    ' make sure FILENAME.DLL is in the same directory or change path in the
    ' declare statements below
    
    DECLARE FUNCTION PxProgramName$ LIB "FILENAME.DLL" ()
    DECLARE FUNCTION PxFileSpecToken$ LIB "FILENAME.DLL" (BYVAL Which&, Spec$)
    
    FUNCTION PBMAIN() AS LONG
        P$=PxProgramName$
        CLS
        PRINT "Program Path and Name is > "p$
        d$=PxFileSpecToken$(3,p$)
        PRINT "Drive and Path is >>>>>>>> "d$
        d$=PxFileSpecToken$(6,p$)
        PRINT "Program Name and Ext. ...> "d$
        LINE INPUT "Press Any Key To Continue ";a$
       
    END FUNCTION
    ' end of getname.bas
    Phil

    ------------------
    E-Mail:
    pt AT pursuersoft DOT com

    Comment


    • #3
      Paul,

      As To Your Second Question:

      Second, PB/DLL has access to the entire WinAPI, so drawing lines, circles, etc
      isn't a problem? And once I write code for this, this may be called in my
      PB/CC code and it will work fine?


      1. PBDLL.EXE's use a graphical interface, where PBCC.exe's
      use Window's Console-Text Interface. Two different
      birds.

      2. You can write code in PBDLL creating functions and subs
      that handle strings, file io, math, etc. that do not output
      any informaion to the console screen and call those
      functions and subs from PBCC without any problems.
      "All screen output must be handled in PBCC."

      3. You can not create graphical functions and subs in a
      DLL and output the results directly to the Windows
      Console using a PBCC program.

      4. Using Console Tools Plus Graphics you can create a
      graphic window in the Console Window. Then you may
      be able to output the Dll results in the graphical
      window created with Graphic Tools.

      Eric can tell you more about how to do that.


      Phil

      ------------------
      E-Mail:
      pt AT pursuersoft DOT com

      Comment


      • #4
        Phil,

        I purchased PB/DLL to prevent the 496: Destination File write error as much as possible (i.e. include some
        of the larger SUBs in my PB/CC in a DLL and then just call the DLL at run-time)

        To see what project I have been working on, visit my page here:
        http://www.geocities.com/dunric/westfront.html

        If I can do more with PB/DLL, then that's just frosting on the cake. I've been using Resource Files to
        keep the string literals down, but it has been a tough process. You'd think a game like Westfront PC wouldn't
        require all that much, but it dwarfs the entire Zork trilogy by about 6 times over (I'd imagine Zork written in
        PB/CC in 1977 would have been something to see!)

        ZDNET and many other websites have Westfront PC for download, but I'm always amazed when people write me saying how
        good the game is...kind of flattering, because WFPC is an anti-establishment game against all the big game companies that
        are putting out these mega RPGs with all the latest graphical technology (voxels, 3-D TrueSpace-style design, etc)

        I mean, who besides a handfull of people write text adventures in the year 2000?

        Regards,

        Paul
        [email protected]

        ------------------
        Westfront PC: Proudly
        programmed in PC/CC 2.0!
        Few cats act their age, while
        most just cough up furballs.

        Comment


        • #5
          Phil,

          I tried out your example and it worked...well, sort of.

          Maybe I am a moron, but all I was able to do was create a simple message box and have
          the PB/CC program it. Which is cool, but what I want to do is:

          DLL stuff here
          FUNCTION whatever LIB whatever
          DIM a few variables
          (then, have the PB/CC program call the function in this DLL
          and be able to use the variables in the DLL)
          END FUNCTION

          Unfortunately, PB/CC gave me Error 516 (Def required or something). When I added a DIM variable
          statement before CALLing the DLL, it compiled fine, but when I tried to PRINT one of the variables in my PB/CC program (to make sure it
          read in the variable from the DLL, I received a blank line where a few sentences of text should be

          All I want my DLL to do is:

          A) DIMension variables for use in the PB/CC program
          B) Load in DATA from my data files (for use in my PB/CC program)
          C) Maybe a few message boxes to compliment what Console Tools is
          already doing for my program

          So something like:

          DLL stuff here
          FUNCTION PBMAIN() AS LONG
          FUNCTION DLL1 ALIAS "dll#1"
          DIM a variable
          DIM a second variable
          etc.
          ...
          END FUNCTION

          FUNCTION dll2 ALIAS "dll#2"
          OPEN "stuff.dat" for input as #1
          LINE INPUT #1,stuff1
          LINE INPUT #1,stuff2
          etc.
          ...
          CLOSE 1
          END FUNCTION

          END PBMAIN FUNCTION

          And then from my PB/CC app:

          REM get variable delcarations from DLL
          CALL dll#1
          do some other PB/CC stuff here
          blah
          blah
          REM Load in data files, using a DLL function
          CALL dll#2
          do some other PB/CC stuff here
          blah
          blah
          ...

          Does this all makes any sense?

          Regards,

          Paul
          [email protected]

          ------------------
          Westfront PC: Proudly
          programmed in PC/CC 2.0!
          Few cats act their age, while
          most just cough up furballs.

          Comment


          • #6
            Paul,

            Save the following code and save it in PBDLL as dlltest1.bas

            Compile with PBDLL.

            then copy dlltest1.dll to your working directory in PBCC20

            NOTE: in the next thread is your test PBCC20 CODE

            Code:
               #COMPILE DLL
               #INCLUDE "Win32api.inc"
            
            DECLARE FUNCTION PxFileStrings&(PathFileName$) AS LONG
            DECLARE FUNCTION PxGetFileString$(BYVAL index AS LONG) AS STRING
            DECLARE FUNCTION PxDataString$(BYVAL index AS LONG) AS STRING
            DECLARE FUNCTION PxChangeStringArray&(BYVAL dat AS STRING, BYVAL index AS LONG) AS LONG
            
            GLOBAL numberofstrings&           ' number of strings to read from file
            GLOBAL stringarray() AS STRING    ' global array
            
                            ' read global stringarray from a file
            FUNCTION PxFileStrings&(PathFileName$) EXPORT AS LONG
                ERRCLEAR
                ON ERROR GOTO funerrhandle
                #REGISTER NONE
                LOCAL FX&,a$
                fx&=FREEFILE:numberstrings&=0
                OPEN PathFileName$ FOR INPUT ACCESS READ SHARED AS #fx&
                 DO
                   LINE INPUT #fx&,a$
                   INCR numberofstrings&
                   REDIM PRESERVE stringarray$(1 TO numberofstrings&)
                   stringarray$(numberofstrings&)=a$
                 LOOP WHILE NOT EOF(fx&)
                 CLOSE fx&
                 FUNCTION = numberofstrings&
                 EXIT FUNCTION
            funerrhandle:
                 FUNCTION = ERR * -1
            END FUNCTION
                            ' retreive one stringarray$() by index
            FUNCTION PxGetFileString$(BYVAL index AS LONG) EXPORT AS STRING
                #REGISTER NONE
                IF index& < 1 OR index& > numberofstrings& THEN
                   FUNCTION = "String Bounds Error"
                ELSE
                   FUNCTION = stringarray$(index&)
                END IF
            END FUNCTION
                           ' change one of the stringarray$() by index
            FUNCTION PxChangeStringArray&(BYVAL dat AS STRING, BYVAL index AS LONG) EXPORT AS LONG
               #REGISTER NONE
               IF index& < 1 OR index& > numberofstrings& THEN
                   FUNCTION = -1
                ELSE
                   stringarray$(index&) = dat$
                   FUNCTION = 0
                END IF
            END FUNCTION
            
                          ' from string from DATA LINES IN DLL
            FUNCTION PxDataString$(BYVAL index AS LONG) EXPORT AS STRING
               #REGISTER NONE
               IF index& < 1 OR index& > DATACOUNT THEN
                  FUNCTION = "String Bounds Error"
               ELSE
                  FUNCTION = READ$(index&)
               END IF
               DATA "this is string 1","this is string 2","this is string 3"
               DATA "this is string 4","this is string 5","this is string 6"
            
            END FUNCTION

            ------------------
            E-Mail:
            pt AT pursuersoft DOT com

            Comment


            • #7
              Paul,

              Here is your PBCC20 Code.
              Save as pbctest1.bas
              Code:
              DECLARE FUNCTION PxFileStrings& LIB "dlltest1.dll" (PathFileName$) AS LONG
              DECLARE FUNCTION PxGetFileString$ LIB "dlltest1.dll" (BYVAL index AS LONG) AS STRING
              DECLARE FUNCTION PxDataString$ LIB "dlltest1.dll" (BYVAL index AS LONG) AS STRING
              DECLARE FUNCTION PxChangeStringArray& LIB "dlltest1.dll" (BYVAL dat AS STRING, BYVAL index AS LONG) AS LONG
              
              FUNCTION PBMAIN() AS LONG
                   CLS
                                  ' first go read some text strings in from a file
                   PathFilename$ = "\pbcc20\samples\hello\hello.bas"
                   uparray& = PxFileStrings&(PathFileName$)
                   IF uparray& < 0 THEN
                      PRINT "ERROR = "ABS(uparray&)
                   ELSEIF uparray&=0 THEN
                      PRINT "No data found in ";PathFileName$
                   ELSE
                      PRINT "The Number Of Lines Of Code in Hello.Bas = ";uparray&
                   END IF
                   LINE INPUT "Press Any Key To Continue ";kk$
                                 ' now print the lines of code found in hello.bas
                   CLS
                   FOR i& = 1 TO uparray&
                       PRINT PxGetFileString$(i&)
                   NEXT
                   LINE INPUT "Press Any Key To Continue ";kk$
                                 ' now change lines one and three in dll stringarray
              
                   x& = PxChangeStringArray&("THIS IS LINE ONE OF HELLO.BAS",1)
                   x& = PxChangeStringArray&("THIS IS LINE THREE OF HELLO.BAS",3)
                                 ' now re print the lines of code found in hello.bas
                   CLS
                   FOR i& = 1 TO uparray&
                       PRINT PxGetFileString$(i&)
                   NEXT
                   LINE INPUT "Press Any Key To Continue ";kk$
                   CLS
                                   ' now print string stored as DATA in DLL
                   FOR i& = 1 TO 6
                       PRINT PxDataString$(i&)
                   NEXT
                   LINE INPUT "Press Any Key To Continue ";kk$
               
                
              END FUNCTION

              Phil

              ------------------
              E-Mail:
              pt AT pursuersoft DOT com

              Comment


              • #8
                Paul,

                You need to look at my first reply again, I think you
                overlooked the fact that the first part of the sample
                code goes with PBDLL for creating a DLL.

                The second part of the sample goes in PBCC20.

                Phil

                ------------------
                E-Mail:
                pt AT pursuersoft DOT com

                Comment


                • #9
                  Phil,

                  This works pretty well. I am having problems, though, with figuring out how
                  to make it convert that one instance of stringarray$(index&) each time through
                  the DO:LOOP into specific components, a la:

                  (this is the code in my program to load in the 'ulti.dat' data file)

                  OPEN "ulti.dat" FOR INPUT AS #1
                  ver$="Type 'version' at the prompt to see recent changes":lver$="http://www.geocities.com/dunric/wfpc.zip"
                  ver2$="For extended help functions, enter 'hint' at the prompt."
                  22 ON ERROR GOTO 800:GOSUB 4200:FOR x=1 TO 143:INPUT #1, no$(x):ao$(x)=no$(x):INPUT #1, fl(x):INPUT #1, mh(x):INPUT #1, p(x):INPUT #1, e(x):INPUT #1, dm(x):INPUT #1, j(x):NEXT:FOR x=1 TO 26:INPUT #1,vb(x):NEXT:vb$(28)="give"
                  60 FOR x=7 TO 143:INPUT #1, ob(x):NEXT:FOR x=1 TO 808:LINE INPUT #1, de(x):NEXT:FOR x=827 TO 878:LINE INPUT #1,de(x):NEXT
                  61 ao(19)="slayer":ao(27)="ring":ao(58)="jester":ao(68)="king":ao(71)="t-rex":ao(74)="fireking":ao(92)="kennedy":ao(98)="blakemore":ao(99)="wally":ao(101)="krumpy":ao(103)="joe":ao(86 )="Raider!"
                  68 FOR x=7 TO 143:INPUT #1, lo(x):NEXT:FOR x=1 TO 808:FOR y=1 TO 6:INPUT #1, m(x, y):NEXT:NEXT
                  69 FOR x=37 TO 56:INPUT #1, ao(x):NEXT:FOR x=113 TO 125:INPUT #1, ao(x):NEXT:FOR x=1 TO 20:LINE INPUT #1, b(x):NEXT
                  70 FOR x=1 TO 6:FOR y=1 TO 6:INPUT #1, x(x, y):NEXT:NEXT:FOR x=1 TO 6:FOR y=1 TO 6:INPUT #1, y(x, y):NEXT:NEXT:LINE INPUT #1,lop$:LINE INPUT #1,le$::
                  LINE INPUT #1,pig$:FOR x=1 TO 15:LINE INPUT #1,say(x):NEXT:stat=6000
                  FOR x=1 TO 21:LINE INPUT #1,quest(x):NEXT:FOR x=811 TO 826:LINE INPUT #1,de(x):NEXT
                  FOR x=157 TO 171:INPUT #1,no$(x):ao(x)=no$(x):INPUT #1,p(x):INPUT #1,dm(x):INPUT #1,lo(x):LINE INPUT #1,ob(x):NEXT:FOR x=167 TO 171:mh(x)=fl(x):NEXT:FOR x=167 TO 171:dm(x)=0:NEXT
                  FOR x=37 TO 56:input#1,lo(x):NEXT:FOR x=61 TO 132:input#1,lo(x):NEXT:lo(143)=775:FOR x=37 TO 112:input#1,mh(x):NEXT:mh(143)=2000:FOR x=167 TO 171:INPUT #1,lo(x):NEXT
                  FOR x=172 TO 182:INPUT #1, no$(x):ao(x)=no$(x):INPUT #1, fl(x):INPUT #1, mh(x):INPUT #1, p(x):INPUT #1, e(x):INPUT #1, dm(x):INPUT #1, j(x):NEXT
                  FOR x=174 TO 182: LINE INPUT #1,ob(x):NEXT:FOR x=1 TO 143:INPUT #1,p(x):NEXT:INPUT #1,aa:INPUT #1,hi:INPUT #1,lp:INPUT #1,k:INPUT #1,naa$
                  FOR x=167 TO 173:INPUT #1,lo(x):NEXT:FOR x=1 TO 20:INPUT #1,wad(x):NEXT
                  FOR x=37 TO 56:input#1,lo(x):NEXT:FOR x=61 TO 132:input#1,lo(x):NEXT:lo(143)=775:FOR x=37 TO 112:input#1,mh(x):NEXT:FOR x=167 TO 173:INPUT #1,lo(x):NEXT
                  FOR x=827 TO 878:FOR y=1 TO 6:INPUT #1,m(x,y):NEXT:NEXT
                  FOR x=183 TO 187:INPUT #1, no$(x):ao$(x)=no$(x):INPUT #1, fl(x):INPUT #1, mh(x):INPUT #1, p(x):INPUT #1, e(x):INPUT #1, dm(x):INPUT #1, lo(x):INPUT #1,ob(x):NEXT
                  FOR x=172 TO 187:INPUT #1,lo(x):NEXT
                  FOR x=880 TO 898:LINE INPUT #1,de(x):NEXT:FOR x=879 TO 898:FOR y=1 TO 6:INPUT #1,m(x,y):NEXT:NEXT
                  FOR x=1 TO 92:LINE INPUT #1,plot$(x):NEXT:FOR x=1 TO 19:LINE INPUT #1,group$(x):NEXT:FOR x=1 TO 6:LINE INPUT #1,lob$(x):NEXT:FOR x=899 TO 900:LINE INPUT #1,de$(x):NEXT
                  FOR x=901 TO 987:LINE INPUT #1,de(x):NEXT:FOR x=901 TO 977:FOR y=1 TO 6:INPUT #1,m(x,y):NEXT:NEXT:FOR x=978 TO 986:FOR y=1 TO 6:INPUT #1,m(x,y):NEXT:NEXT
                  FOR x=189 TO 193:INPUT #1, no$(x):ao$(x)=no$(x):INPUT #1, fl(x):INPUT #1, mh(x):INPUT #1, p(x):INPUT #1, e(x):INPUT #1, dm(x):INPUT #1, j(x):LINE INPUT #1,ob(x):NEXT
                  FOR x=1 TO 10:LINE INPUT #1,dog$(x):NEXT
                  FOR x=1 TO 15:LINE INPUT #1,a(x):NEXT
                  FOR x=194 TO 203:INPUT #1, no$(x):ao$(x)=no$(x):INPUT #1, fl(x):INPUT #1, mh(x):INPUT #1, p(x):INPUT #1, e(x):INPUT #1, dm(x):INPUT #1, lo(x):LINE INPUT #1,ob(x):NEXT:ao(204)="dreamsword"
                  FOR x=1 TO 18:LINE INPUT #1,hint(x):NEXT
                  FOR x=204 TO 211:INPUT #1, no$(x):ao$(x)=no$(x):INPUT #1, fl(x):INPUT #1, mh(x):INPUT #1, p(x):INPUT #1, e(x):INPUT #1, dm(x):INPUT #1, lo(x):LINE INPUT #1,ob(x):NEXT
                  FOR x=21 TO 25:LINE INPUT #1,quest(x):NEXT
                  FOR x=21 TO 25:LINE INPUT #1,b(x):NEXT
                  FOR x=1 TO 18:LINE INPUT #1,vaa$(x):NEXT:FOR x=1 TO 20:LINE INPUT #1,vab$(x):NEXT
                  FOR x=1200 TO 1230:LINE INPUT #1,de$(x):NEXT
                  FOR x=1200 TO 1230:FOR y=1 TO 6:INPUT #1,m(x,y):NEXT:NEXT:no$(204)="Dreamsword":ao(204)="dreamsword"
                  FOR x=1 TO 10:LINE INPUT #1,dalv$(x):NEXT:FOR x=1 TO 34:LINE INPUT #1,front(x):NEXT
                  REM WF2.DAT
                  FOR x=37 TO 51:INPUT #1,lo(x):NEXT:lo(37)=7012:lo(38)=7076:lo(39)=7098:lo(40)=7135:lo(41)=7149:lo(42)=7007:lo(43)=7007:lo(44)=7153:lo(45)=7144:lo(49)=7008:lo(51)=7005
                  FOR x=7000 TO 7231:LINE INPUT #1,de(x):NEXT
                  FOR x=7000 TO 7231:FOR y=1 TO 6:INPUT #1,m(x,y):NEXT:NEXT
                  REM HOVER.DAT
                  LINE INPUT #1,help$:FOR x=1 TO 75:LINE INPUT #1,help2$(x):NEXT:FOR x=16 TO 50:LINE INPUT #1,say(x):NEXT
                  REM lResult& = ConsoleMessageBox (iString(help$),%OKONLY,"Westfront PC: Help Box",0,0)
                  CALL SecondBox
                  REM TABLET.DAT
                  FOR x=1 TO 20:LINE INPUT #1,alta4(x):NEXT
                  REM NPC.DAT
                  FOR x=38 TO 56:LINE INPUT #1,mark(x):NEXT:FOR x=38 TO 56:LINE INPUT #1,mark2(x):NEXT
                  REM CLIMATE.DAT
                  FOR x=1 TO 996:INPUT #1,cold(x):NEXT:LINE INPUT #1,vitals:REM COLOR 10:? vitals:SLEEP 550
                  REM TEMP.DAT
                  INPUT #1,nm:INPUT #1,cg:FOR x=1500 TO 2500:LINE INPUT #1,de$(x):INPUT #1,m(x,1):INPUT #1,m(x,2):INPUT #1,m(x,3):INPUT #1,m(x,4):INPUT #1,m(x,5):INPUT #1,m(x,6):NEXT
                  FOR x=1 TO 2500:FOR y=1 TO 6:INPUT #1,m(x,y):NEXT:NEXT:FOR x=187 TO 300:LINE INPUT #1,no$(x):LINE INPUT #1,ob$(x):INPUT #1,mh(x):INPUT #1,dm(x):INPUT #1,p(x):INPUT #1,e(x):INPUT #1,lo(x):NEXT
                  FOR x=1 TO 2500:LINE INPUT #1,de$(x):NEXT
                  CLOSE 1
                  OPEN "events.dat" FOR INPUT AS #1:INPUT #1,barc:INPUT #1,shopc:INPUT #1,mudc:INPUT #1,ipow:INPUT #1,freeze:CLOSE 1
                  OPEN "shell.dat" FOR INPUT AS #1:INPUT #1,sheller:FOR x=1 TO 15:LINE INPUT #1,fla(x):NEXT:INPUT #1,tp:CLOSE 1
                  OPEN "ulti.dat" FOR INPUT AS #1:FOR x=1 TO 8185:LINE INPUT #1,stuff(x):NEXT:CLOSE 1:OPEN "weap.dat" FOR INPUT AS #1:INPUT #1,cdam:CLOSE 1
                  LOCATE 1,1:?:COLOR 9,0:?"The changes have been loaded.":SLEEP 550:cus=1:month=1

                  (end of code snippet, sorry for the Commodore 64 spagetti code)

                  As you can see, it's a lot of gibberish, but it nevertheless reads in specific sections
                  of ulti.dat (sequentially). How might I point stringarray$(index&) to each item in every FOR/NEXT loop of
                  this OPEN/CLOSE section? DIMing all these variables in the DLL and then passing them one by
                  one to the EXE would prove impractical.

                  I have 37,770 lines of "text" (alphanumeric) that are read into the program from ulti.dat.

                  Regards,

                  Paul
                  [email protected]



                  ------------------
                  Westfront PC: Proudly
                  programmed in PC/CC 2.0!
                  Few cats act their age, while
                  most just cough up furballs.

                  Comment


                  • #10
                    Phil,

                    Better yet, can I just keep that code snippet and place it in
                    the DLL? Like a SUB in the main EXE? Because a lot of the code
                    in my program is specific to PB/CC (i.e. locate, print, etc) so it
                    won't work in a DLL (unfortunately).

                    Regards,

                    Paul
                    [email protected]

                    ------------------
                    Westfront PC: Proudly
                    programmed in PC/CC 2.0!
                    Few cats act their age, while
                    most just cough up furballs.

                    Comment


                    • #11
                      Paul,

                      I downloaded your 11.50 version of your program.

                      First you will have a very hard time every getting your DLL
                      set up for retrieving this data, besides being able to access
                      it, until you get your ulti.dat file organized.

                      Example:

                      I saw several locations in your code where you are
                      inputting the variable de(by x)
                      for x&=1 to 808:input #1,de(x):next
                      several lines down
                      for x&=811 to 826:input #1,de(x):next
                      several line down again
                      for x&=880 to 898:input #1,de(x):next

                      Some places you define an string array variable directly
                      with no$(x)="This is something" ' etc. But you reading
                      most of no$(x's) from the ulti.dat file.

                      you have some of them define in a INC File.

                      This seems to be true for all your other variables.

                      I think before you can ever get DLL Code written to do what
                      you want, you need to re-create your ulti.dat file in a
                      organized order.
                      matter a fact you need to create a file with all
                      Code:
                      your string  arrays  file 1  newulti.str
                           integer arrays  file 2  newulti.int
                           long    arrays  file 3  newulti.lng
                           etc.
                      
                      Just below your code (after you have read all the data from
                      ulti.dat, you need to do the following.
                      
                      Start by only rewriting just string array data out 
                      to the new file.
                       
                      You can get all there names from your wftrent.inc file
                      
                      xx&=freefile:a$=chr$(34):b$=chr$(34)+","
                      open "Newulti.str" for output as #xx&  ' string array file
                         ' do one string array at a time and until all are written 
                         ' out to the new file.
                        print #xx&,a$+"NO$+b$;      ' variable name
                        print #xx&,a$+str$(ubound(no$))+b$;  ' how many
                        for x&= 1 to ubound(no$)-1
                         print #xx&,a$+no$(x&)+b$;
                        next
                         print #xx&,a$+no$(ubound(no$))+a$   ' the last no$
                        print #xx&,a$+"AO$+b$;      ' variable name
                        print #xx&,a$+str$(ubound(AO$))+b$;  ' how many 
                        for x&= 1 to ubound(ao$)-1
                         print #xx&,a$+ao$(x&)+b$; 
                        next
                         print #xx&,a$+ao$(ubound(no$))+a$   ' the last ao$
                         ' continue to repeat the above code until you have
                         ' all your string array data written to the new file.
                      close xx&
                      
                      then email me that file, I will see if I can help you
                      create a dll for inputting and accessing your string array
                      data.
                      
                      Continue with your coding and create a file for integer arrays
                      only those dimmed as single dim. x(x) not (x,y)
                      xx&=freefile:a$=chr$(34):b$=chr$(34)+","
                      open "newulti.int" for output as #xx&
                       print #xx&,a$+"XX"+b$;
                       print #xx&,a$+str$(ubound(xx))+b$;
                        for x&= 1 to ubound(xx)-1
                         print #xx&,a$+str$(xx(x&))+b$; 
                        next
                         print #xx&,a$+str$(xx(ubound(xx))+a$   ' the last xx
                      NOTE:;;;;;;;; email is [email protected]
                      Phil


                      ------------------


                      [This message has been edited by Phil Tippit (edited September 21, 2000).]
                      E-Mail:
                      pt AT pursuersoft DOT com

                      Comment


                      • #12
                        Phil,

                        You are right, the ulti.dat file is terribly unorganized. I will do what you suggested
                        and get back to you this evening.

                        Regards,

                        Paul
                        [email protected]


                        ------------------
                        Westfront PC: Proudly
                        programmed in PC/CC 2.0!
                        Few cats act their age, while
                        most just cough up furballs.

                        Comment


                        • #13
                          Phil,

                          Was able to break them into small .dat files according to
                          your wishes. Go download the example files here:
                          http://members.tripod.com/~panks/phil.zip

                          Regards,

                          Paul
                          [email protected]

                          ------------------
                          Westfront PC: Proudly
                          programmed in PC/CC 2.0!
                          Few cats act their age, while
                          most just cough up furballs.

                          Comment


                          • #14
                            Paul,

                            The download is not working correctly.

                            You need to email the actual data files you have created
                            as attachments to "[email protected]"


                            Phil

                            ------------------
                            E-Mail:
                            pt AT pursuersoft DOT com

                            Comment


                            • #15
                              Phil,

                              I e-mailed them in 4 e-mails to your account.

                              Paul


                              ------------------
                              Westfront PC: Proudly
                              programmed in PC/CC 2.0!
                              Few cats act their age, while
                              most just cough up furballs.

                              Comment

                              Working...
                              X