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

Managed C++/CLI

 
GeneralRe: delete all label in windows form CLI Pin
TheCaptain1012-Jul-15 23:37
TheCaptain1012-Jul-15 23:37 
GeneralRe: delete all label in windows form CLI Pin
Richard MacCutchan12-Jul-15 23:48
mveRichard MacCutchan12-Jul-15 23:48 
Questionremove all label in windows form c++ Pin
TheCaptain1011-Jul-15 18:33
TheCaptain1011-Jul-15 18:33 
AnswerRe: remove all label in windows form c++ Pin
Richard MacCutchan11-Jul-15 21:57
mveRichard MacCutchan11-Jul-15 21:57 
QuestionHow do I convert an .mp3 file to an .sty (style file) - C/C++? Pin
Member 1171281228-Jun-15 21:01
Member 1171281228-Jun-15 21:01 
QuestionRe: How do I convert an .mp3 file to an .sty (style file) - C/C++? Pin
Richard MacCutchan28-Jun-15 21:30
mveRichard MacCutchan28-Jun-15 21:30 
QuestionWideCharToMultiByte vs Encoding::UTF8->GetBytes Pin
John Schroedl17-Jun-15 8:48
professionalJohn Schroedl17-Jun-15 8:48 
AnswerRe: WideCharToMultiByte vs Encoding::UTF8->GetBytes Pin
John Schroedl17-Jun-15 9:29
professionalJohn Schroedl17-Jun-15 9:29 
Update:

Well, my initial experiment proved to me that YES, it's much faster to use WideCharToMultiByte().

The speedup varies by language of text I'm converting of course.

The time to run my tests were reduced by: English: 13%, German: 18%, Japanese: 16%, Chinese: 12%

The gist of my code is now:

C++
String^ str = "...the string to convert...";
			
pin_ptr<const wchar_t> unicode16 = PtrToStringChars(str);

// Perf Note: Surprisingly, using -1 for length is MUCH faster than using a precomputed str->Length+1 
int const cbNeeded = WideCharToMultiByte(CP_UTF8, 0, unicode16, -1, nullptr, 0, nullptr, nullptr);

auto converted = make_unique<MyBuffer>(cbNeeded);

int const cbConverted = WideCharToMultiByte(CP_UTF8, 0, unicode16, -1, converted.get(), cbNeeded, nullptr, nullptr);
			
// ... use converted ...


It was a surprise that passing -1 for the length parameter to WCtoMB resulted in an even faster conversion!

I hope this helps someone out there and I'm still interested in any responses from any devs doing similar work.

John
GeneralRe: WideCharToMultiByte vs Encoding::UTF8->GetBytes Pin
Richard Andrew x6417-Jun-15 15:36
professionalRichard Andrew x6417-Jun-15 15:36 
QuestionConvert From c# - For Report Viewer Report save as PDF format Pin
Paramu197316-Jun-15 20:41
Paramu197316-Jun-15 20:41 
AnswerRe: Convert From c# - For Report Viewer Report save as PDF format Pin
Richard MacCutchan16-Jun-15 21:54
mveRichard MacCutchan16-Jun-15 21:54 
AnswerRe: Convert From c# - For Report Viewer Report save as PDF format Pin
John Schroedl17-Jun-15 8:39
professionalJohn Schroedl17-Jun-15 8:39 
GeneralRe: Convert From c# - For Report Viewer Report save as PDF format Pin
Paramu197317-Jun-15 15:07
Paramu197317-Jun-15 15:07 
QuestionOOP - Error | Unhandled exception at 0x0FD2CCC8 (msvcp110d.dll) Pin
Member 1164129910-Jun-15 2:23
Member 1164129910-Jun-15 2:23 
QuestionRe: OOP - Error | Unhandled exception at 0x0FD2CCC8 (msvcp110d.dll) Pin
Richard MacCutchan10-Jun-15 21:32
mveRichard MacCutchan10-Jun-15 21:32 
QuestionEnabling ListControl pane in MFC (C++) Pin
Yateesh KR12-May-15 22:14
Yateesh KR12-May-15 22:14 
QuestionRe: Enabling ListControl pane in MFC (C++) Pin
Richard MacCutchan13-May-15 2:55
mveRichard MacCutchan13-May-15 2:55 
QuestionInheritance tricky question Pin
Amrit Agr12-May-15 9:30
Amrit Agr12-May-15 9:30 
AnswerRe: Inheritance tricky question Pin
Sascha Lefèvre12-May-15 11:38
professionalSascha Lefèvre12-May-15 11:38 
GeneralRe: Inheritance tricky question Pin
Amrit Agr13-May-15 7:47
Amrit Agr13-May-15 7:47 
AnswerRe: Inheritance tricky question Pin
Sascha Lefèvre13-May-15 9:12
professionalSascha Lefèvre13-May-15 9:12 
Questionenglish language implementation Pin
Member 936602117-Apr-15 3:58
professionalMember 936602117-Apr-15 3:58 
AnswerRe: english language implementation Pin
Member 936602117-Apr-15 4:00
professionalMember 936602117-Apr-15 4:00 
Questionmultiple Pin
memoarfaa16-Apr-15 1:28
memoarfaa16-Apr-15 1:28 
GeneralRe: multiple Pin
Richard MacCutchan16-Apr-15 2:20
mveRichard MacCutchan16-Apr-15 2:20 

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.