On Jun 29, 2004, at 10:49 AM, Joseph J. Strout wrote:
At 10:07 AM -0700 6/29/04, Jason Toews wrote:
Still no success. Here's my updated attempt, which still kills the
debug or built app with a Windows "MyApp.exe has encountered a
problem and must shut down" message:
Hmm, looks OK to me. Does the DLL contain a C header file, or any C
sample code that calls this function? That would help us confirm that
the declare is correct.
Some further info on this: The crash that occurs when calling the DLL
appears to be occurring in 'oleaut32.dll' which (according to MSDN)
handles conversion between data types. Which makes sense; I'm sure the
format of one of my parameters is wrong, but I'm having a devil of a
time figuring out which one. The Visual Basic example provided with
the DLL works dandy; my RB translation does not. In fact, my app
crashes whenever I try to call the DLL.
Examining the strings being passed by VB, then comparing them to the
strings being passed by REALbasic, I noticed that the byte length of
the VB strings was twice that of the RB strings. I assume this would
indicate that they are UTF16-encoded, but I'm not sure how to confirm
that in VB.
The DLL documentation says the strings should be "ANSI style OLE2(BSTR,
OLECHAR FAR *) strings, single byte characters, zero terminated string,
length returned by 'SysStringByteLen()' Windows API call"
According to MSDN, 'BSTR' ends with a null character and begins with a
length indicator (if I'm reading the info correctly).
Arrrgh. What should I do with my RB strings to make them similar to
the VB strings? I've tried ConvertEncoding to Encodings.UTF16, which
makes the byte lengths of the RB strings the same as the VB strings,
but I'm still crashing. Looping through the bytes of each string with
MidB and looking at the ASCII code of each byte with AscB, the RB and
VB strings now appear to be identical. Anything I could be missing
here? Or am I barking up the wrong tree?
Thanks for all the suggestions so far.
Jason P Toews ~ Production Systems Analyst
Trader Publishing Company
907 IS-Seattle
Office: 425-487-2237 x3066
Cell: 425-891-3051
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|