Xojo Conferences
XDCMay2019MiamiUSA

VB to RB Help (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Setting PreserveWhiteSpace in XMLDocument
Next thread: PostgreSQL 8.0


Win32 API Declares   -   Berg, Heath
  VB to RB Help   -   Jim Meyer
   Re: VB to RB Help   -   Charles Yeomans

VB to RB Help
Date: 31.01.05 21:39 (Mon, 31 Jan 2005 15:39:57 -0500)
From: Jim Meyer
Hi VB experts.....

I am trying to implement a Win32 declare working from a VB example.....
I think I have most of it but not sure what to do with the following
VB code...... in particular the StrPtr() and VarPrt() functions:

' Convert the Unicode strings to null terminated ANSI byte arrays
' then get pointers to the byte arrays.
intElementCount = UBound(astrGSArgs)
ReDim aAnsiArgs(intElementCount)
ReDim aPtrArgs(intElementCount)

For intCounter = 0 To intElementCount
aAnsiArgs(intCounter) = StrConv(astrGSArgs(intCounter),
vbFromUnicode)
aPtrArgs(intCounter) = StrPtr(aAnsiArgs(intCounter))
Next
ptrArgs = VarPtr(aPtrArgs(0))

The VB declare looks like:
Private Declare Function gsapi_init_with_args Lib "gsdll32.dll" (ByVal
lngGSInstance As Long, ByVal lngArgumentCount As Long, ByVal
lngArguments As Long) As Long

.... and the example passes "ptrArgs" into "lngArguments"

Any help is appreciated..... thank you,

Jim

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: VB to RB Help
Date: 01.02.05 00:18 (Mon, 31 Jan 2005 18:18:43 -0500)
From: Charles Yeomans

On Jan 31, 2005, at 3:39 PM, Jim Meyer wrote:

> Hi VB experts.....
>
> I am trying to implement a Win32 declare working from a VB
> example..... I think I have most of it but not sure what to do with
> the following VB code...... in particular the StrPtr() and VarPrt()
> functions:
>
> ' Convert the Unicode strings to null terminated ANSI byte arrays
> ' then get pointers to the byte arrays.
> intElementCount = UBound(astrGSArgs)
> ReDim aAnsiArgs(intElementCount)
> ReDim aPtrArgs(intElementCount)
>
> For intCounter = 0 To intElementCount
> aAnsiArgs(intCounter) = StrConv(astrGSArgs(intCounter),
> vbFromUnicode)
> aPtrArgs(intCounter) = StrPtr(aAnsiArgs(intCounter))
> Next
> ptrArgs = VarPtr(aPtrArgs(0))
>
> The VB declare looks like:
> Private Declare Function gsapi_init_with_args Lib "gsdll32.dll" (ByVal
> lngGSInstance As Long, ByVal lngArgumentCount As Long, ByVal
> lngArguments As Long) As Long
>
> .... and the example passes "ptrArgs" into "lngArguments"
>
> Any help is appreciated..... thank you,
>

I think that a correct Rb declaration is

Declare Function gsapi_init_with_args Lib "gsdll32.dll" (instance as
Ptr, argc as Integer, argv as Ptr) as Integer

To say more, I'd need to have a look at the header file iapi.h.

Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>