Click here to Skip to main content
15,920,468 members
Home / Discussions / C#
   

C#

 
GeneralRe: Repainting window. Pin
Heath Stewart8-Jul-04 17:08
protectorHeath Stewart8-Jul-04 17:08 
GeneralRe: Repainting window. Pin
Nick Z.8-Jul-04 17:51
Nick Z.8-Jul-04 17:51 
GeneralA far more superior solution. Pin
Nick Z.8-Jul-04 18:54
Nick Z.8-Jul-04 18:54 
General"contexMenu" in "TreeView" for specific "Node". Pin
novitzky8-Jul-04 9:50
novitzky8-Jul-04 9:50 
GeneralRe: "contexMenu" in "TreeView" for specific "Node". Pin
Judah Gabriel Himango8-Jul-04 9:59
sponsorJudah Gabriel Himango8-Jul-04 9:59 
GeneralRe: "contexMenu" in "TreeView" for specific "Node". Pin
novitzky8-Jul-04 22:01
novitzky8-Jul-04 22:01 
GeneralRe: "contexMenu" in "TreeView" for specific "Node". Pin
saud_a_k9-Jul-04 1:37
saud_a_k9-Jul-04 1:37 
GeneralReturning a String from Managed to Unmanaged Code Pin
SanShou8-Jul-04 6:25
SanShou8-Jul-04 6:25 
Hey,

I am trying to get a string returned from my managed code to my unmanaged code. Basically what I have so far is an interface as follows:

<br />
[ComVisible(true)]<br />
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]<br />
[Guid("")]<br />
<br />
public interface IGet<br />
{<br />
    void GetString([MarshalAs(UnmanagedType.LPWStr)] out string Value);<br />
}<br />
<br />
public class PropertyGet : IGet<br />
{<br />
     public PropertyGet(Item item)<br />
     {<br />
         m_item = item;<br />
     }<br />
<br />
     public void GetString(out string Value)<br />
     {<br />
         Property prop = m_item.GetProperty();<br />
<br />
         Value = prop.ToString();<br />
     }<br />
}<br />


In the managed code
<br />
HRESULT CFileProperties(BSTR fileName, IGet pIGet)<br />
{<br />
     WCHAR wszWideBuffer[1024];<br />
     // NULL_CHARACTER is appropriate for wide characters<br />
     wszWideBuffer[0] = NULL_CHARACTER;<br />
     pIGet->GetString(wszWideBuffer);<br />
}<br />


So in the managed code right now, the wszWideBuffer is filled with some wierd characters. So something is not marshalling correctly and with my limited experience I am not sure where to look for the problem. Most articles seem to handle passing strings the other way (i.e. getting a string back from the unmanaged which works in my property setting code.)

Any help would be appreciated.

Brian

If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
GeneralRe: Returning a String from Managed to Unmanaged Code Pin
Heath Stewart8-Jul-04 8:49
protectorHeath Stewart8-Jul-04 8:49 
GeneralRe: Returning a String from Managed to Unmanaged Code Pin
SanShou8-Jul-04 8:57
SanShou8-Jul-04 8:57 
Generalmicrosoft.office.interop Pin
dcronje8-Jul-04 5:49
dcronje8-Jul-04 5:49 
GeneralRe: microsoft.office.interop Pin
Heath Stewart8-Jul-04 8:28
protectorHeath Stewart8-Jul-04 8:28 
GeneralIDragSourceHelper problem Pin
TylerBrinks8-Jul-04 4:17
TylerBrinks8-Jul-04 4:17 
GeneralRe: IDragSourceHelper problem Pin
Heath Stewart8-Jul-04 5:28
protectorHeath Stewart8-Jul-04 5:28 
GeneralRe: IDragSourceHelper problem Pin
TylerBrinks8-Jul-04 5:52
TylerBrinks8-Jul-04 5:52 
GeneralRe: IDragSourceHelper problem Pin
Heath Stewart8-Jul-04 6:43
protectorHeath Stewart8-Jul-04 6:43 
GeneralRe: IDragSourceHelper problem Pin
Heath Stewart8-Jul-04 6:53
protectorHeath Stewart8-Jul-04 6:53 
GeneralForm display porblem Pin
wk_vigorous8-Jul-04 1:52
wk_vigorous8-Jul-04 1:52 
GeneralRe: Form display porblem Pin
Nick Parker8-Jul-04 3:43
protectorNick Parker8-Jul-04 3:43 
GeneralRe: Form display porblem Pin
wk_vigorous8-Jul-04 4:43
wk_vigorous8-Jul-04 4:43 
GeneralRe: Form display porblem Pin
Heath Stewart8-Jul-04 5:21
protectorHeath Stewart8-Jul-04 5:21 
GeneralSelection in datagrid gets really slow Pin
Atlemann8-Jul-04 1:02
Atlemann8-Jul-04 1:02 
Generalstring==C#?YES:NO Pin
saud_a_k7-Jul-04 22:49
saud_a_k7-Jul-04 22:49 
GeneralRe: string==C#?YES:NO Pin
SJ_Phoenix8-Jul-04 0:13
SJ_Phoenix8-Jul-04 0:13 
GeneralRe: string==C#?YES:NO Pin
Nick Parker8-Jul-04 1:37
protectorNick Parker8-Jul-04 1:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.