Re: Passing a string as reference from a VB 3.0 application to a VC++ 3.0 DLL
From: Arnau Font (afont_at_nospam-ipssoft.com)
Date: 04/23/04
- Next message: Roger: "GetMenuItemID bug?"
- Previous message: ArtemK: "How to use CeRegisterReplNotification()?"
- In reply to: Arnau Font: "Passing a string as reference from a VB 3.0 application to a VC++ 3.0 DLL"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 23 Apr 2004 12:02:25 +0200
Well, the problem was in the declare function in the VB code, the String
must be passed as ByVal.
Public Declare Function GetMachineIdentification Lib "ProtocolsDLL" (ByVal
ident As String, ByRef size As Long) As Integer
"Arnau Font" <afont@nospam-ipssoft.com> escribió en el mensaje
news:OikBjgEKEHA.2380@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> I'm trying to make a DLL that contains a procedure that receives a string
as
> parameter, fills it and returns to the application that has made the call.
> The DLL is made under VC++ 3.0 and the calling application in VB 3.0.
>
> The code of the DLL is this:
>
> PROTOCOLSDLL_API void GetMachineIdentification(LPWSTR ident) {
> for (unsigned long i=0;i<128;i++) {
> ident[i]=_T('a'); //This should be more complicated, but I simplified
it
> for testing
> }
> }
>
> And the code for the calling is:
>
> ident = String(128, " ")
> Call GetMachineIdentification(ident)
> Text1.Text = Text1.Text & Mid(ident, 1, 3) & vbNewLine
>
> But it doesn't print anything in the memo (Text1)!
> Does anyone have any idea??
>
> Thanks,
> Arnau.
>
>
- Next message: Roger: "GetMenuItemID bug?"
- Previous message: ArtemK: "How to use CeRegisterReplNotification()?"
- In reply to: Arnau Font: "Passing a string as reference from a VB 3.0 application to a VC++ 3.0 DLL"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|