Results 1 to 3 of 3

Thread: Passing string parameters out

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Posts
    5

    Wink

    I have a query regarding the passing and returning of string parameters from VB to exposed function in dll written on VC.

    Say in the given scenario below,
    In VB bas module:
    Declare function encode_str lib "encoder.dll" (ByVal strInput As String,
    ByRef strOutput As String,ByRef strOuputLen As Long) As Long

    In VC:
    long encode_str(LPSTR strInput,LPSTR *strOutput,long *strOutputLen)

    In VB form:
    Dim strInput,strOutput As String
    Dim strOutputLen As Long
    Dim retval As Long

    strOutput = String(256,vbNullChar)

    retval = encode_str(strInput,strOutput,strOutputLen)
    MsgBox strOutput



    The above code seems to work once, but on further calls to "encode_str", the call fails to generate any strOutput result to be passed back to the VB form.

    Anyone has any idea or suggestions? Thanks.

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Dunmow,Essex,England
    Posts
    898
    If it's not passing anything back, the fault must lie in the DLL.

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Posts
    5
    Lets say I've put the code in the VB form as a click routine of a button. When the button is pressed the first time, strOutput is assigned a correct result. The next time the button is pressed, strOutput is not assigned any value.
    Hence I don't think the problem lies in the dll.

    Help...anyone??

Posting Permissions

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



Click Here to Expand Forum to Full Width