Like this:
Code: Select all
ProcedureReturn Result1$,Result2$Code: Select all
ProcedureReturn Result1$,Result2$
Code: Select all
Structure test
  a.l
  b.l
EndStructure
Procedure test(*ReturnMe.test)
  *ReturnMe\a = 42
  *ReturnMe\b = 23
EndProcedure
TestMe.test
TestMe\a =0815
TestMe\b = 4711
test(TestMe)
Debug TestMe\a
Debug TestMe\b
Having 2 small arrays as return buffers, you can return numbers or strings easily.GeoTrail wrote:When using ProcedureDLL or just Procedure, can it return more than one variable?
Code: Select all
;Return multiple values from Procedure
Dim Buff.L(10):Dim Buff$(10)  ; Return buffers
Procedure.s DoSomething() 
  Buff(0)=111:  Buff(1)=222  : Buff(2)=333       
  Buff$(0)="Result$ Zero" : Buff$(1)="Result$ One" :Buff$(2)="Result$ Two"
  ProcedureReturn "Here are 6 returns from Procedure DoSomething:"
EndProcedure
Debug DoSomething()
For i=0 to2
  Debug Str(buff(i))+"  "+ buff$(i)
Next
Code: Select all
!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw
Code: Select all
Procedure.l x_exist(filename.s)
  Global x_creation.l, x_lastaccess.l, x_lastwrite.l, x_filesize.l
  Protected st.SYSTEMTIME
  ;
  ; *** check if a file exist and if so, retrieve information on a file
  ;
  ; in:     filename.s               - path + filename
  ; retval: 1 #True                  - found and info retrieved
  ;         0 #False                 - not found or cannot get my greedy fingers on it
  ; out:    x_filesize.l             - size of file
  ;         x_creation.l             - when created
  ;         x_lastaccess.l           - when last accessed
  ;         x_lastwrite.l            - last written To
  ;
  file_h = CreateFile_(@filename.s,0,0,0,#OPEN_EXISTING,0,0)    ; open only for retrieval of attributes
  If file_h <> #INVALID_HANDLE_VALUE                            ; ok it exists
    x_filesize.l = GetFileSize_(file_h,0)                       ; that's the size
    ;
    creation.FILETIME                                           ; create temp vars  
    lastaccess.FILETIME
    lastwrite_ft.FILETIME
    st.SYSTEMTIME
    ;
    GetFileTime_(file_h,@creation,@lastaccess,@lastwrite)
    ;
    x_creation.l = x_filetimetodate(@creation)
    x_lastaccess.l = x_filetimetodate(@lastaccess)
    x_lastwrite.l = x_filetimetodate(@lastwrite)
    CloseHandle_(file_h) 
    ProcedureReturn #True
  Else
    ProcedureReturn #False
  EndIf
EndProcedure

Code: Select all
Structure dockedproperties
  MDIWidth.l 
  MDIHeight.l 
  MDIdockedx.l
 MDIdockedy.l
EndStructure 
Structure undockedproperties
  MDIWidth.l 
  MDIHeight.l 
  MDIdockedx.l
 MDIdockedy.l
EndStructure 
proceduredll dockedproperties(MDIgadget);this will set the efined values of above structures
endprocedure
proceduredll undockedproperties(
endprocedure
proceduredll flipdockstate(dockhandle,MDIgadget,@docked/undockedproperties)
resizegadget(MDIgadget,----structure here)
endprocedure
Code: Select all
!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw

Code: Select all
!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw