So, where are you at right now...
Does your function execute without error?
Does it just return and tell you that it couldn't find the item?
Are you absolutely sure that you are marshalling all of the parameters
correctly? (i.e. the inName ? )
A lot of times functions can execute without error, though the data is not
being marshalled correctly so you get bad results.
Can you post your complete vb.net "KPDCIteratorFind" function here?
Yes, I believe that is it. I do not believe the inName parameter is
marshalling correctly.
I don't have the KPDCIteratorFind function, as it is in unmanaged DLL that I
do not have the source code too.
Here is what the documentation gives me for this function:
int KPDCIteratorFind(KPDCIteratorRef inIteratorRef, const char *inName,
KPDCOpaqueRef *outfoundItemRef);
The function executes without error, it simple returns an int value other
than 0. According to the documentation, 0 means the function fired okay. The
int I get (201) means that it could not find the item.
I know the item is there, because I can see it walking the iterator.
> So, where are you at right now...
>
[quoted text clipped - 7 lines]
>
> Can you post your complete vb.net "KPDCIteratorFind" function here?
Eric Carlson - 15 Dec 2004 16:25 GMT
Ok, thank for that info... now post your vb.net import for this function, and
tell me the different ways that you have tried to marshal your inName string,
then i can hopefully give you some suggestions.
M K - 15 Dec 2004 17:13 GMT
Declare Auto Function KIteratorFind Lib "DCSPro4SLR.dll" Alias
"KPDCIteratorFind" (ByVal inIteratorRef As IntPtr,
<MarshalAs(UnmanagedType.LPStr)> ByRef inName As String, ByRef
outFoundItemRef As IntPtr) As Integer
I've also tried:
Declare Auto Function KIteratorFind Lib "DCSPro4SLR.dll" Alias
"KPDCIteratorFind" (ByVal inIteratorRef As IntPtr, ByRef inName As
StringBuilder, ByRef outFoundItemRef As IntPtr) As Integer
Thanks
> Ok, thank for that info... now post your vb.net import for this function, and
> tell me the different ways that you have tried to marshal your inName string,
> then i can hopefully give you some suggestions.
Eric Carlson - 15 Dec 2004 20:13 GMT
Have you tried sending the inName as ByVal ?
"KPDCIteratorFind" (ByVal inIteratorRef As IntPtr,
<MarshalAs(UnmanagedType.LPStr)> ByVal inName As String, ByRef
outFoundItemRef As IntPtr) As Integer
M K - 15 Dec 2004 21:21 GMT
Sorry, you are correct. I thought I had, but I went through one more time.
And it worked. Thank you.
> Have you tried sending the inName as ByVal ?
>
> "KPDCIteratorFind" (ByVal inIteratorRef As IntPtr,
> <MarshalAs(UnmanagedType.LPStr)> ByVal inName As String, ByRef
> outFoundItemRef As IntPtr) As Integer