System::String ^ St = gcnew System::String("Hey ho!");
St = str; //This line won't work, but it's what I'd like to achieve
The only way I can make it work is by doing gcnew again St = gcnew System::String(str.c_str()); but I'm guessing this is not the right way. All the examples I have found tell how to do this when creating a new instance of System::String but none how to do it with an existing one.
am I not re-allocating memory without freeing it first?
It depends on the actual structure of your code. I think a more pertinent question would be: why are you using both std::string and System::String when you only really need one of them, probably the latter. For example code such as:
std::string str("Some string");
System::String ^ st = gcnew(str.c_str());
serves no real purpose, in that the std::string is totally redundant.
While I execute the program only boxes are displayed in place of the chinese characters. If I open the XML file in a browser, the chinese characters are displayed. What else to do to display the chinese language?
Where are you displaying the text and seeing the boxes? To the console? To a TextBox or TextBlock?
If they are going to the console, then it probably makes sense that you'd see boxes as the console font is probably not set properly to a font with those characters. Use the system menu to change the font to a unicode font and try again if that's the case.
If it's to a textbox, again, check the typeface you're using. The browser is probably dynamically loading the font glyphs it needs and painting with those.
How to set Full Control & Write Unlock to a file from C++/CLI? The reason why I want this is:
I'm creating a log in form. While clicking a button, I'm writing the log in information to a file(to implement "Remember Me" functionality). While creating installer for this application, this works fine under Win XP. But did not work with Windows 7. There I've to manually set Full Control to the file. Users of my app won't like this. I used the following code to set Access control:
I'm working on a user control which is basicly a customized edit control (HexEditBox).
It has a context menu which is activated by the right mouse click, as per normal.
All is working fine with the control, but has a visual aspect that I'm not happy with.
When the context menu is activated the caret is hidden from the control.
For most of the menu items this is irrelevant, but for the paste option the user looses
visual indication where the paste will occur.
It is anyway possible the prevent the context menu from hiding the controls caret?
Thanks in advance .. Milton
Thank you. Now, can you explain why that works to me? I am a very seasoned native C++ and C# developer, but am pretty green to the CLI stuff. an out parameter would normally be passed by reference, but the way that this is being called seems to be by value.
It's all in the metadata of the method signature written by the C# compiler. When C++/CLI compiler resolves the call, it sees the IL Metadata indicating that the parameter is 'out'. So, the C++/CLI compiler knows to generate calling code with the value passed by reference. I haven't looked at the generated IL but it's also possible that the double is boxed when passed as an out parameter.
This bothered me a little at first too but then it was pointed out that it's not too different than standard C++ pass-by-reference.
int x = 5;
Without examining the declaration of DoSomething() there's no indication at the calling site whether it's pass by value or by reference. The usual hidden C++ magic. Of course, intellisense helps some unless you're using C++/CLI...oh wait we are I use Visual Assist which helps sometimes.
yes you are right. I got that working too. but there is a differences between C++/CLI and C# version of the code. In C# (VS2010) you have form called AboutBox which is prebuild with all of the information. In C++/CLI you do not have it. I am sorry if I confuesd you.
Last Visit: 31-Dec-99 18:00 Last Update: 27-Sep-23 19:42