> Hello,
>
> if anyone has a similar problem, here is a possible solution:
>
> .method public hidebysignewslot abstract virtual instance void Item(
> [in] unsigned int32 dwIndex,
> [in] unsigned int32 dwWhichName,
> [in] unsigned int32 chLength,
> class [mscorlib]System.Text.StringBuilder marshal( lpstr) pszName)
> runtime managed internalcall
>
> Greetings,
> Henning Krause [MVP - Exchange]
> ==========================
> Visit my website:
http://www.infinitec.de > Try my free Exchange Explorer: Mistaya
> (
http://www.infinitec.de/software/mistaya.aspx)
>
>
> "Netveloper" <noone@nowhere.com> wrote in message
> news:uPmNH5idFHA.3224@TK2MSFTNGP10.phx.gbl...
>> Henning,
>>
>> I believe you chould just change the datatype of the pszName parameter
>> to a StringBuilder instead of a string.
>>
>> PS. You misspelled "Exchange" in your MVP declaration :-)
>>
>> HTH
>>
>> "Henning Krause [MVP - Exhange]" <newsgroup.no@spam.infinitec.de> skrev i
>> meddelandet news:O3IuYpadFHA.3808@TK2MSFTNGP14.phx.gbl...
>>> Hello,
>>>
>>> I have a COM interface which has the following method:
>>> HRESULT Item(
>>> [in] DWORD dwIndex,
>>> [in] DWORD dwWhichName,
>>> [in] DWORD cchLength,
>>> [out,size_is(cchLength)] LPSTR pszName
>>> );
>>>
>>> When I create a Wrapper-Dll with midl.exe and tlbimp.exe, this method is
>>> converted to:
>>>
>>> public void Item ( System.UInt32 dwIndex , System.UInt32 dwWhichName ,
>>> System.UInt32 cchLength , System.String pszName )
>>>
>>> pszName is supposed to be a buffer, so obviously, this won't work. I've
>>> already decompiled the dll I generated with ildasm, the result is this:
>>>
>>> .method public hidebysig newslot abstract virtual
>>> instance void Item([in] unsigned int32 dwIndex,
>>> [in] unsigned int32 dwWhichName,
>>> [in] unsigned int32 cchLength,
>>> [out] string marshal( lpstr) pszName)
>>> runtime managed internalcall
>>>
>>> My question is: How do I need to modify this so that pszName becomes a
>>> buffer that can be filled by the called method?
>>>
>>> Some time ago I read something about using a StringBuilder... but I lost
>>> the link.
>>>
>>> Any ideas?
>>>
>>> Greetings,
>>> Henning Krause [MVP - Exchange]
>>> ==========================
>>> Visit my website:
http://www.infinitec.de >>> Try my free Exchange Explorer: Mistaya
>>> (
http://www.infinitec.de/software/mistaya.aspx)
>>>
>>
>>
>
>