clq
    
    
    
		
        浏览(0) + 
        2010-09-10 16:27:57 发表
        
编辑
         
        
        
        
        关键字: 
        
 
        
        
        
        
                
        unicode 的 mfc 工程可以直接如此.
--------------------------------------------------
// TODO: Add your control notification handler code here
    FormEvent ^form1 = gcnew FormEvent();
    form1->Show();
    //form1->ShowWindow();
    //FormEvent form1;
    //form1.Show();
    int handle = 0;
    System::IntPtr p(handle);
    //form1->GetWindowHandle(&handle);
    //p = 
    form1->GetWindowHandle(p);
    handle = p.ToInt32();
    System::String ^ s = form1->GetCaption();
    PtrToStringChars(s);
    std::string s2;
    std::wstring ws2;
    //s2 = (wchar_t*)(s->ToCharArray().ToPointer());
//    s2 = (wchar_t*)(s->Chars());
    pin_ptr<const wchar_t> src = PtrToStringChars(s);
    CStringW cs = src; 
    CStringA csa(cs.GetBuffer());
    ws2 = src;
        
        
        
        		
		        
                
                
     
    
 
	
	
     
    
       
    
    clq
    
    
    
    
    
    		    
    
          
              
    	// exe_win32.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <string>
#include <iostream>
#include <vcclr.h>
#include <windows.h>
#using "D:\test1\c#dll_test\ClassLibrary_dll1\ClassLibrary_dll1\bin\Debug\ClassLibrary_dll1.dll"
//#using "..\Debug\ClassLibrary_dll1.dll"
using namespace cs_test;
int _tmain(int argc, _TCHAR* argv[])
{
    System::Windows::Forms::Application::Run(gcnew FormEvent);
    //--------------------------------------------------
    //关掉前面的窗口后才能到这里来
    FormEvent ^form1 = gcnew FormEvent();
    form1->Show();
    //form1->ShowWindow();
    //FormEvent form1;
    //form1.Show();
    int handle = 0;
    System::IntPtr p(handle);
    //form1->GetWindowHandle(&handle);
    //p = 
    form1->GetWindowHandle(p);
    handle = p.ToInt32();
    System::String ^ s = form1->GetCaption();
    PtrToStringChars(s);
    std::string s2;
    std::wstring ws2;
    //s2 = (wchar_t*)(s->ToCharArray().ToPointer());
//    s2 = (wchar_t*)(s->Chars());
    pin_ptr<const wchar_t> src = PtrToStringChars(s);
    //CStringW cs = src; 
    //CStringA csa(cs.GetBuffer());
    ws2 = src;
    //System.Windows.Forms
//    Application.Run();
    ::Sleep(10000);
    char c;
    std::cin >> c;
    return 0;
}
    
    
     
 
	 
    
       
    
    clq
    
    
    
    
    
    
    
          
              
    	    std::string stds = "aaa中文";
    System::String ^ s3 = Marshal::PtrToStringAnsi(static_cast<IntPtr>((char*)stds.c_str()));
    
    
     
 
	 
	
    NEWBT官方QQ群1: 276678893
    可求档连环画,漫画;询问文本处理大师等软件使用技巧;求档softhub软件下载及使用技巧.
    但不可"开车",严禁国家敏感话题,不可求档涉及版权的文档软件.
    验证问题说明申请入群原因即可.