Using OOo 2.3 on Windows, I need to call a DLL from StarBasic.
The argument to the DLL is a simple array of characters. Consider a
super simple example:
Type FOO1TYPE
Dim name1 As String * 10
Dim rank1 As String * 10
End Type
Type FOO2TYPE
Dim name2 As String * 10
Dim rank2 As String * 10
Dim foo As FOO1TYPE
End Type
Normally, I would declare my DLL call similar to
Declare Sub MethodName Lib "wow.dll" (arg As FOO2TYPE)
Although I can do this from VB, I have many problems with this in
StarBasic. To avoid the issues, I created a string with 40 characters in
to, and tried to make a call using a string. I did not use this code, it
is simple and not efficient.
Declare Sub MethodName Lib "wow.dll" (arg As String)
Dim i As Integer
Dim s As String
For i = 1 To 40
s = s & Chr(0)
Next
Mid(s, 1, 5, "12345")
Mid(s, 10, 3, "123")
If I inspect my string, things look as I expect, but as soon as I make a
call, things change.
MethodName s
Now, if I inspect the string, the string length is 5 rather than 40. I
assume that this is related to the way that the string is converted and
sent around. I do not know what string value makes it to the DLL.
My next thought was that I could avoid this problem all together by
creating an array of type Byte.
Declare Sub MethodName Lib "wow.dll" (arg(0 To 39) As Byte)
This does not seem to work.
I am considering writing a Calc-Addon so that I can hide the DLL call in
C++. Any help is appreciated.
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info: http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]