|
-
Mar 5th, 2001, 04:31 AM
#1
Thread Starter
New Member
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.
-
Mar 6th, 2001, 04:59 AM
#2
Fanatic Member
If it's not passing anything back, the fault must lie in the DLL.
-
Mar 6th, 2001, 08:45 PM
#3
Thread Starter
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|