Click here to Skip to main content
15,889,462 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: Questions about string manipulation [modified] Pin
TabascoSauce21-Apr-09 15:59
TabascoSauce21-Apr-09 15:59 
QuestionExecuting Code on App Exit Pin
turkmeistr120-Apr-09 9:16
turkmeistr120-Apr-09 9:16 
AnswerRe: Executing Code on App Exit Pin
Luc Pattyn20-Apr-09 9:22
sitebuilderLuc Pattyn20-Apr-09 9:22 
GeneralRe: Executing Code on App Exit Pin
turkmeistr120-Apr-09 9:32
turkmeistr120-Apr-09 9:32 
GeneralRe: Executing Code on App Exit Pin
Luc Pattyn20-Apr-09 9:40
sitebuilderLuc Pattyn20-Apr-09 9:40 
GeneralRe: Executing Code on App Exit Pin
turkmeistr120-Apr-09 10:01
turkmeistr120-Apr-09 10:01 
GeneralRe: Executing Code on App Exit Pin
Luc Pattyn20-Apr-09 10:03
sitebuilderLuc Pattyn20-Apr-09 10:03 
QuestionHow to copy/convert System::Object^(unsigned char) to local variable Pin
marcusab18-Apr-09 10:27
marcusab18-Apr-09 10:27 
I would like to copy the data content of pDataByte to QByte using Microsoft Visual C++ 2008 .NET

Debug Info
Name         Value           Type
pDataByte    {System.Array}  System::Object^
 [0x0]       0x41 ‘A’        unsigned char
 [0x1]       0x42 ‘B’        unsigned char
 [0x2]       0x43 ‘C’        unsigned char
 [0x3]       0x44 ‘D’        unsigned char

QByte        {Length=0x4}    unsigned char[]
 [0x0]       0x00 ‘’         unsigned char
 [0x1]       0x00 ‘’         unsigned char
 [0x2]       0x00 ‘’         unsigned char
 [0x3]       0x00 ‘’         unsigned char


I have tried several approaches, for example:

<br />
//Declare variables<br />
System::Object ^pDataByte;<br />
unsigned char QByte[4];<br />
<br />
//External DLL Function<br />
ReadOutput(pDataByte);<br />
<br />
//Current variable status see "Debug Info"<br />
<br />
//Copy values to local variable<br />
QByte[0] = (unsigned char)System::Convert::ToChar(pDataByte); <br />


Error Code (at runtime at line: QByte[0] = (unsigned char)System...)
An unhandled exception of type 'System.InvalidCastException' occurred in mscorlib.dll
Additional information: Unable to cast object of type 'System.Byte[]' to type 'System.IConvertible'.


Please help, I have tried very hard to get this to work, I am used to plane C++ (not .NET Framework) Sniff | :^)
AnswerRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
N a v a n e e t h18-Apr-09 16:42
N a v a n e e t h18-Apr-09 16:42 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
marcusab18-Apr-09 23:30
marcusab18-Apr-09 23:30 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
N a v a n e e t h19-Apr-09 6:41
N a v a n e e t h19-Apr-09 6:41 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable [modified] Pin
marcusab19-Apr-09 11:04
marcusab19-Apr-09 11:04 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
N a v a n e e t h19-Apr-09 15:34
N a v a n e e t h19-Apr-09 15:34 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
Luc Pattyn19-Apr-09 16:10
sitebuilderLuc Pattyn19-Apr-09 16:10 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
N a v a n e e t h19-Apr-09 17:02
N a v a n e e t h19-Apr-09 17:02 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
Mark Salsbery20-Apr-09 8:31
Mark Salsbery20-Apr-09 8:31 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
Luc Pattyn20-Apr-09 8:40
sitebuilderLuc Pattyn20-Apr-09 8:40 
AnswerRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
Mark Salsbery19-Apr-09 6:40
Mark Salsbery19-Apr-09 6:40 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
marcusab19-Apr-09 10:55
marcusab19-Apr-09 10:55 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
Mark Salsbery19-Apr-09 11:12
Mark Salsbery19-Apr-09 11:12 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
marcusab19-Apr-09 11:32
marcusab19-Apr-09 11:32 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
marcusab19-Apr-09 11:44
marcusab19-Apr-09 11:44 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
Mark Salsbery19-Apr-09 11:44
Mark Salsbery19-Apr-09 11:44 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
marcusab19-Apr-09 11:57
marcusab19-Apr-09 11:57 
QuestionDialogBox in C++/CLI Pin
J_E_D_I9-Apr-09 11:29
J_E_D_I9-Apr-09 11:29 

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.