Click here to Skip to main content
15,926,507 members
Home / Discussions / C#
   

C#

 
AnswerRe: floating toolbars Pin
Robert Rohde8-Feb-06 18:59
Robert Rohde8-Feb-06 18:59 
AnswerRe: floating toolbars Pin
Suelinda_W14-Feb-06 11:12
Suelinda_W14-Feb-06 11:12 
QuestionHow to change property of controls in main form frim other forms ? Pin
hdv2128-Feb-06 12:55
hdv2128-Feb-06 12:55 
AnswerRe: How to change property of controls in main form frim other forms ? Pin
Dave Kreskowiak8-Feb-06 16:46
mveDave Kreskowiak8-Feb-06 16:46 
AnswerRe: How to change property of controls in main form frim other forms ? Pin
tiancaidao8-Feb-06 17:19
tiancaidao8-Feb-06 17:19 
QuestionA good 128-bit signed integer impl? Pin
Gywox8-Feb-06 12:55
Gywox8-Feb-06 12:55 
AnswerRe: A good 128-bit signed integer impl? Pin
Dave Kreskowiak8-Feb-06 16:39
mveDave Kreskowiak8-Feb-06 16:39 
QuestionRegEx - Allowing Spaces Pin
Expert Coming8-Feb-06 11:37
Expert Coming8-Feb-06 11:37 
GeneralRe: RegEx - Allowing Spaces Pin
Guffa8-Feb-06 12:42
Guffa8-Feb-06 12:42 
AnswerRe: RegEx - Allowing Spaces Pin
DigitalKing8-Feb-06 13:10
DigitalKing8-Feb-06 13:10 
GeneralRe: RegEx - Allowing Spaces Pin
Expert Coming8-Feb-06 13:32
Expert Coming8-Feb-06 13:32 
GeneralRe: RegEx - Allowing Spaces Pin
Dave Kreskowiak8-Feb-06 16:36
mveDave Kreskowiak8-Feb-06 16:36 
GeneralRe: RegEx - Allowing Spaces Pin
Expert Coming8-Feb-06 19:19
Expert Coming8-Feb-06 19:19 
QuestionRich Text Box and Hyperlinks Pin
DELETEUSER8-Feb-06 11:32
DELETEUSER8-Feb-06 11:32 
AnswerRe: Rich Text Box and Hyperlinks Pin
DigitalKing8-Feb-06 13:07
DigitalKing8-Feb-06 13:07 
QuestionConverting and things to their html codes Pin
eggie58-Feb-06 11:05
eggie58-Feb-06 11:05 
AnswerRe: Converting and things to their html codes Pin
Edbert P8-Feb-06 11:28
Edbert P8-Feb-06 11:28 
QuestionDevExpress ASPxGrid question Pin
golfaddict8-Feb-06 9:51
golfaddict8-Feb-06 9:51 
QuestionPassing string from C++ code to C# Pin
Roman Muntyanu8-Feb-06 9:47
Roman Muntyanu8-Feb-06 9:47 
Hi all,

I am passing string from C++ to C# but not sure which way is more correct. Here it is:
First approach:
CDAnetCSharpHooks::PassString( )
{
char str[] = "String to pass";
DotNetObject *obj = new DotNetObject();
obj->UseStringInDotNet( str );
}

Second approach:
CDAnetCSharpHooks::PassString( )
{
char str[] = "String to pass";
CString temp(str);
System::String * dotNetStr = new System::String( temp);
DotNetObject *obj = new DotNetObject();
obj->UseStringInDotNet( dotNetStr );
}

C# method
public void UseStringInDotNet( String str )
{
// create new thread and use string in it
}

UseStringInDotNet() is creating new thread and that is why PassString() will finish its work before UseStringInDotNet() finishes its own.
Basically first approach is working, but sometimes on the .NET side I have some unpredictable behaviour in memory. I am wondering if that memory for str buffer is cleared before C# get its work done. In this respect will be the second approach more safe ?

Thank you very much in advance for any suggestions

Roman
AnswerRe: Passing string from C++ code to C# Pin
leppie8-Feb-06 10:57
leppie8-Feb-06 10:57 
Questioncompile .dll into .exe file Pin
sergej8-Feb-06 6:22
sergej8-Feb-06 6:22 
AnswerRe: compile .dll into .exe file Pin
Judah Gabriel Himango8-Feb-06 7:27
sponsorJudah Gabriel Himango8-Feb-06 7:27 
QuestionTreeView Send Message Error Pin
sameerhanda8-Feb-06 5:36
sameerhanda8-Feb-06 5:36 
GeneralRe: TreeView Send Message Error Pin
DigitalKing8-Feb-06 9:20
DigitalKing8-Feb-06 9:20 
Questionimages uploading and displaying Pin
Net-Programer-and-developer8-Feb-06 4:35
Net-Programer-and-developer8-Feb-06 4:35 

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.