- 193 名前:デフォルトの名無しさん mailto:sage [2006/12/04(月) 17:30:11 ]
- あと、Marshal::StringToHGlobalAnsiで確保したメモリを開放していないな。
方法は幾通りもある。あんマネージ文字列への変換はCString (ATL/MFC 7以上)使うのと結構楽。 TCHARも適当にやってくれるし。 #using <mscorlib.dll> #include <atlstr.h> #include <windows.h> #pragma comment(lib, "user32.lib") void func (System::String* str1, System::String* str2, System::String* str3) { using ATL::CString; CString cs1(str1), cs2(str2), cs3(str3); CString arg; arg.Format(TEXT("%s\0%s\0%s\0"), static_cast<PCSTR>(cs1), static_cast<PCSTR>(cs2), static_cast<PCSTR>(cs3)); ::MessageBox(0, arg, TEXT(""), MB_OK); }
|

|