>Scott -
> Char ** is a fair representation of "ByRef xx As String", but the catch
>is that you have to provide a pre-allocated string. Fixed-length strings
are
>not very efficient for this.
> Also, VB/32 expects Unicode strings, so you'll probably have to use
>StrConv to get them into the proper form.
> Dim sProduct As String
> sProduct = String$(100, 0)
> ... your call ...
> sProduct = StrConv(sProduct, vbUnicode)
>--
> Jim Mack
> MicroDexterity, Inc
> PO Box 5372
> Plymouth, MI 48170-5372
> http://www.microdexterity.com
> Fax: +1 734-453-8942
>> Gang:
>> Please bare with me, I am new to VB5...
>> I am trying to access the Ghostscript 5.03 for Windows
>> DLL "gsdll32.dll" via the Private Declare Sub construct
>> in VB5. There are several functions present in this DLL, but
>> I started with gsdll_revision which returns the product name,
>> copyright information, the revision number, and the revision
>> date.
>> In the documentation for gsdll_revision, we are told that the
>> function's arguments are:
>> char **product;
>> char **copyright;
>> long *revision;
>> long *revisiondate;
>> I created my VB declare as follows:
>> Private Declare Sub gsdll_revision Lib "gsdll32" (ByVal product As
>> String, ByVal copyright As String, rev As Long, revdate As Long)
>> I then ran the program to test the results:
>> Private Sub Command1_Click()
>> Dim product As String
>> Dim copyright As String
>> Dim revision As Long
>> Dim revisiondate As Long
>> Dim rc As Integer
>> gsdll_revision product, copyright, revision, revisiondate
>> rc = MsgBox("Product=" + product, vbOKOnly, "Product Information")
>> rc = MsgBox("Copyright=" + copyright, vbOKOnly, "Copyright
>> Information")
>> rc = MsgBox("Revision=" + Str(revision), vbOKOnly, "Revision
>> Information")
>> rc = MsgBox("Product=" + Str(revisiondate), vbOKOnly, "Revision Date
>> Information")
>> End Sub
>> The messagebox for product and copyright both returned blank strings,
>> while the revision returned the number 503 and revisiondate returned
>> 19970808,
>> both of which are correct.
>> I have checked the documentation provided with VB5 on accessing DLLs,
>> but I am not able to find anything about character pointers to
>> pointers. I have
>> tried to remove the "ByVal"s in the declaration and running it that way,
>> but I
>> get a crash.
>> Curious, though, when I force the product and copyright string Dim's to
>> a fixed length of 10...
>> Dim product As String * 10
>> Dim copyright As String * 10
>> ...both the product and copyright return jibberish characters. (I am
>> assuming that what I am getting is the address to a memory location, but
>> I do not know that
>> for sure.)
>> Any help would be greatly appreciated!
>> Thanks,
>> Scott