RE: how to convert from char * to string

From: Lewis Miller (LewisMiller_at_discussions.microsoft.com)
Date: 01/18/05


Date: Tue, 18 Jan 2005 10:01:02 -0800

try this function

Private Declare Function MultiByteToWideChar Lib "kernel32.dll" (ByVal
CodePage As Long, ByVal dwFlags As Long, ByVal lpMultiByteStr As String,
ByVal cchMultiByte As Long, ByVal lpWideCharStr As String, ByVal cchWideChar
As Long) As Long

"sree" wrote:

> hi all,
>
> i am trying to use a vc++ dll i made in vb. i am not much familiar to
> vb.i just want to check if my dll will work in vb also. the function from dll
> returns char *.i decalare a string in vb 'Dim str As String ' and try to get
> the returned value in str. str=func()
> . but when i print it ;here i use MsgBox(str) i am getting only junk value.
> So guys anybody knows how to solve this problem.any method to convert char *
> to string? or a method to convert StrPtr(str) to string will also be fine.
>
> Thanks and regards,sree



Relevant Pages

  • Re: Explicit Linking of DLLs in VB.net
    ... yes this technique will only work on managed assemblys (exe or dll) ... "YourObject" is a form and is limited to the form methods. ... Wel implement propertys, methods, events in your interface and start ... Public Shared Function LoadMeByName(ByVal vstrAssemblyName As String, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Explicit Linking of DLLs in VB.net (attn Michel or any others)
    ... loads the dll and finds a form in the dll. ... Dim extForm As Form = extAssembly.CreateInstance("test.entry", ... Wel implement propertys, methods, events in your interface and start ... Public Shared Function LoadMeByName(ByVal vstrAssemblyName As String, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Access crashes when calling DLL function.
    ... I have started bypassing code in the form to find the problem. ... are local String variables. ... I then built a simple input form (in the same mdb) that calls the crashing ... functions from a DLL they provide. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Populating CString in Win32 dll interface that accepts LPCTSTR
    ... ReleaseBuffer() if I actually modify the buffer after GetBuffer is called ... But the OP wanted the string to be "populated" by the DLL. ... Unicode or ANSI string, but the DLL might think it is a non-const pointer to an ANSI ...
    (microsoft.public.vc.mfc)
  • Re: DLL with string params callable via D4 and VB
    ... > I have a DLL written in D6 that uses ShortStrings as parameters. ... I can't get beyond Delphi to ... > Is there any guidance you could give in regards to passing string ... written in order to be used by EXCEL 97 VBA. ...
    (borland.public.delphi.language.objectpascal)

Loading