Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
GeneralRe: netzwerk / network Pin
Anonymous29-Apr-04 2:08
Anonymous29-Apr-04 2:08 
GeneralRe: netzwerk / network Pin
Daniel Turini29-Apr-04 2:28
Daniel Turini29-Apr-04 2:28 
Generaldetermine mouse button from System.EventArgs Pin
mookeroo29-Apr-04 1:16
mookeroo29-Apr-04 1:16 
GeneralRe: determine mouse button from System.EventArgs Pin
Stefan Troschuetz29-Apr-04 1:49
Stefan Troschuetz29-Apr-04 1:49 
GeneralRe: determine mouse button from System.EventArgs Pin
mookeroo29-Apr-04 1:53
mookeroo29-Apr-04 1:53 
GeneralRe: determine mouse button from System.EventArgs Pin
Syed Abdul Khader29-Apr-04 2:39
Syed Abdul Khader29-Apr-04 2:39 
GeneralRe: determine mouse button from System.EventArgs Pin
mookeroo29-Apr-04 2:32
mookeroo29-Apr-04 2:32 
GeneralWin32 Interop: Returning BSTR from ATL C++ DLL Pin
inter8ection29-Apr-04 0:07
inter8ection29-Apr-04 0:07 
Hi, I am trying to return a BSTR from a C++ function that takes a single BSTR argument. I am using the ATL type CComBSTR. My C++ function looks as follows:

extern "C" BSTR __stdcall MyStringFunction( BSTR s )<br />
{<br />
   std::string str = string((LPSTR)s);<br />
   ...<br />
   ...<br />
   return CComBSTR(str.c_str());<br />
}


At the moment my C# declaration looks like this:

[DllImport(@"C:\MyDll.dll", CharSet = CharSet.Unicode)]<br />
[return : MarshalAs(UnmanagedType.BStr)] public static extern string MyStringFunction( [MarshalAs(UnmanagedType.BStr)] string s );


I have had varying success with different combinations. When I don't add the MarshalAs attribute to the return string, I get the string back ok, but when it gets large ( a few 1000 characters) , I hit problems. With the current declaration, which according to documentation is correct, I only receive the first two characters.

Does anyone know, or can suggest what the problem with my approach is? I am aware of Unicode/Ansi issues, but as far as I can tell, what I have should work.

Thanks,
Christopher

The bomb lives only as it is falling
GeneralRe: Win32 Interop: Returning BSTR from ATL C++ DLL Pin
Mike Dimmick29-Apr-04 0:53
Mike Dimmick29-Apr-04 0:53 
GeneralRe: Win32 Interop: Returning BSTR from ATL C++ DLL Pin
inter8ection29-Apr-04 1:06
inter8ection29-Apr-04 1:06 
GeneralRe: Win32 Interop: Returning BSTR from ATL C++ DLL Pin
Mike Dimmick29-Apr-04 2:15
Mike Dimmick29-Apr-04 2:15 
GeneralJustify alignment in c# ritchtextbox control!!! Pin
hassan azizi28-Apr-04 22:47
hassan azizi28-Apr-04 22:47 
GeneralRe: Justify alignment in c# ritchtextbox control!!! Pin
Heath Stewart29-Apr-04 4:03
protectorHeath Stewart29-Apr-04 4:03 
GeneralRe: Justify alignment in c# ritchtextbox control!!! Pin
hassan azizi29-Apr-04 4:42
hassan azizi29-Apr-04 4:42 
GeneralRe: Justify alignment in c# ritchtextbox control!!! Pin
Heath Stewart29-Apr-04 4:48
protectorHeath Stewart29-Apr-04 4:48 
GeneralRe: Justify alignment in c# ritchtextbox control!!! Pin
hassan azizi29-Apr-04 12:24
hassan azizi29-Apr-04 12:24 
GeneralRe: Justify alignment in c# ritchtextbox control!!! Pin
Heath Stewart29-Apr-04 14:08
protectorHeath Stewart29-Apr-04 14:08 
GeneralRe: Justify alignment in c# ritchtextbox control!!! Pin
hassan azizi1-May-04 7:49
hassan azizi1-May-04 7:49 
GeneralRe: Justify alignment in c# ritchtextbox control!!! Pin
Heath Stewart1-May-04 9:05
protectorHeath Stewart1-May-04 9:05 
GeneralRe: Justify alignment in c# ritchtextbox control!!! Pin
hassan azizi1-May-04 14:19
hassan azizi1-May-04 14:19 
GeneralRe: Justify alignment in c# ritchtextbox control!!! Pin
Heath Stewart1-May-04 14:23
protectorHeath Stewart1-May-04 14:23 
GeneralRe: Justify alignment in c# ritchtextbox control!!! Pin
hassan azizi1-May-04 14:57
hassan azizi1-May-04 14:57 
GeneralRe: Justify alignment in c# ritchtextbox control!!! Pin
Heath Stewart2-May-04 5:55
protectorHeath Stewart2-May-04 5:55 
GeneralRe: Justify alignment in c# ritchtextbox control!!! Pin
hassan azizi2-May-04 9:18
hassan azizi2-May-04 9:18 
GeneralRe: Justify alignment in c# ritchtextbox control!!! Pin
Heath Stewart2-May-04 10:09
protectorHeath Stewart2-May-04 10:09 

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.