Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23

Thread: how to call a user script function from TB_Module?

  1. #21
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,526
    Rep Power
    170
    maybe this helps?
    '----------------------------------------------------------------------------
      'thinBasic_FunctionSimpleCall_ByPtr
      '----------------------------------------------------------------------------
      ' Call a script function and optionally returns it value (numeric or string)
      ' This function permits to call script callback functions passing automatic
      ' pseudo callbacks variables 
      ' USE only when in need of a callback function from module
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_FunctionSimpleCall_ByPtr                _
                              Lib "thinCore.DLL"                          _
                              Alias "thinBasic_FunctionSimpleCall_ByPtr"  _
                              (                                          _
                                ByVal FunctionPtr As Long              , _  '---PTR to function returned by thinBasic_FunctionGetPtr or other way
                                Optional                                  _
                                ByVal ptrEXT As Ext Ptr                , _  '---Used to get back from the called function a numeric value
                                ByVal ptrSTR As String Ptr              , _  '---Used to get back from the called function a string value
                                ByVal IsCallBack  As Long              , _
                                ByVal lCBHNDL    As Long              , _
                                ByVal lCBMSG      As Long              , _
                                ByVal lCBCTL      As Long              , _
                                ByVal lCBCTLMSG  As Long              , _
                                ByVal lCBLPARAM  As Long              , _
                                ByVal lCBWPARAM  As Long              , _                                        
                                ByVal lCBNMCODE  As Long              , _                                        
                                ByVal lCBNMHDR    As Long              , _                                        
                                ByVal lCBNMHWND  As Long              , _                                        
                                ByVal lCBNMID    As Long                _                                        
                              ) As Long
    
     '----------------------------------------------------------------------------
      'thinBasic_FunctionGetPtr
      '----------------------------------------------------------------------------
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_FunctionGetPtr                      _
                              Lib "thinCore.DLL"                      _
                              Alias "thinBasic_FunctionGetPtr"        _
                              (                                      _
                                ByVal fName      As String          _
                              ) As Long
    
    But maybe I'm on the wrong track here...
    I think there are missing some Forum-sections as beta-testing and support

  2. #22
    I have used this one successfully with an Oxygen script: It supports an array of parameters (stride 8 bytes) , and also returns double, string and long types from thinBasic

    From thincore
      '----------------------------------------------------------------------------
      'thinBasic_FunctionCall_ByPtr
      '----------------------------------------------------------------------------
      ' Call a script function and optionally returns it value (numeric or string)
      ' This function permits to call script functions passing parameters
      ' Parameters are passed using a shared memory area made by a sequence of DOUBLEs
      ' (8 bytes) one for each parameter to be passed.
      ' The paramaters memory area will be interpreted by thinBasic core engine
      ' depending by parameters declaration made in script.
      '
      ' So far the following type of parameters are supported:
      '   - numeric parameters passed ByVal up to DOUBLE range
      '
      ' Example: if programmer wants to pass 2 parameters, set lModParams = 2 and setup
      ' a 16 bytes memory area (2 params * 8 bytes each) where to store the 2 parameter
      ' values.
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_FunctionCall_ByPtr                      _
                              Lib "thinCore.DLL"                          _
                              Alias "thinBasic_FunctionCall_ByPtr"        _
                              (                                           _
                                ByVal FunctionPtr   As Long             , _  '---PTR to script function
                                ByVal lModParams    As Long             , _  '---MANDATORY: number of params module is passing
                                ByVal lModParamsPtr As Long             , _  '---MANDATORY: pointer to a memory area where to find parameters (8 bytes for each parameter)
                                Optional                                  _  '---If no need to get back script function result value, do not indicate the next 2 parameters
                                ByVal ptrDOUBLE     As Double Ptr       , _  '---Pointer to DOUBLE that will get back script function return value in case of numeric
                                ByVal ptrSTR        As BSTR Ptr           _  '---Pointer to a OLE32 dynamic string handle that will get back script function return value in case of string
                              ) As Long
    
    Attached Files Attached Files
    Last edited by Charles Pegge; 20-05-2013 at 10:52.

  3. #23
    Thank you both.
    Now i can get it
    it was missing in my "thinCore.bi" file.

    than you

    Joshy
    (Sorry about my bad English.)

Page 3 of 3 FirstFirst 123

Similar Threads

  1. CALL keyword with function name as string expression
    By ErosOlmi in forum Sources, Templates, Code Snippets, Tips and Tricks, Do you know ...
    Replies: 0
    Last Post: 07-09-2006, 16:16

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •