Board index » delphi » Strings as Dll function parameters?

Strings as Dll function parameters?

Hi there,
        I have a small but annoying problem..... I'm trying to write a
functionin a  dll that will allow me to pass a file name as a parameter.
The rub is that I would like to use this Dll in VB (null terminated
strings) and I am having no end of trouble getting my dll to reconize the
string that VB feeds it. Any suggestions..... please?!
                                                              Thanks,

     Dave                                                                  

 

Re:Strings as Dll function parameters?


Dave Parsons <go...@webspan.net> schrieb im Beitrag
<01bc6ca9$49aeda40$39589ace@Pgordo>...

Quote
> Hi there,
>         I have a small but annoying problem..... I'm trying to write a
> functionin a  dll that will allow me to pass a file name as a parameter.
> The rub is that I would like to use this Dll in VB (null terminated
> strings) and I am having no end of trouble getting my dll to reconize the
> string that VB feeds it. Any suggestions..... please?!
>                                                               Thanks,

>      Dave                                                                

Use PChar instade of string.

----------------------------------------------------------------------------
-------------------------
///\\\ Hartwig MOTAL ///\\\  e-mail: m...@bue.magwien.gv.at
 Weinberggasse 60/9/7, A-1190  Vienna/Austria/Europe

Re:Strings as Dll function parameters?


Dave,

That may not be enough to solve the problem.

VB (at least version 3) uses a different format for internal strings.  If
you want to pass the value into a DLL as a PChar, you have to pass it ByVal
inside your VB function (believe it or not).  Look up the MS whitepapers on
using VB with the Windows API (DLL's).

Ken
--------------------------------------
Notice at no time do my fingers leave my hands...
Quality training touches your technical side and helps you grow.
--------------------------------------
Master Certified Delphi 3 Instructor
Master Certified C++Builder Instructor
http://www.knowledgeable.com
k...@knowledgeable.com
+

Hartwig MOTAL <m...@bue.magwien.gv.at> wrote in article
<01bc6cd5$32d0a660$162dc...@pc01705.m55.magwien.gv.at>...

Quote
> Dave Parsons <go...@webspan.net> schrieb im Beitrag
> <01bc6ca9$49aeda40$39589ace@Pgordo>...
> > Hi there,
> >         I have a small but annoying problem..... I'm trying to write a
> > functionin a  dll that will allow me to pass a file name as a
parameter.
> > The rub is that I would like to use this Dll in VB (null terminated
> > strings) and I am having no end of trouble getting my dll to reconize
the
> > string that VB feeds it. Any suggestions..... please?!
> >                                                               Thanks,

> >      Dave                                                              

> Use PChar instade of string.

----------------------------------------------------------------------------

- Show quoted text -

Quote
> -------------------------
> ///\\\ Hartwig MOTAL ///\\\  e-mail: m...@bue.magwien.gv.at
>  Weinberggasse 60/9/7, A-1190  Vienna/Austria/Europe

Other Threads