没分了好心人帮住,由于用mfc的dll需要返回一个pchar的类型,由于中用到了CString,但是(LPSTR)(LPCTSTR)获取为乱码,获取如何在mfc的dll中返回一个可以显示字符串的类型???不太了解win32,天天用mfc今天终于over了,大虾救助,有分一定再加

解决方案 »

  1.   

    CString::GetBuffer()和CString::ReleaseBuffer()试试。
    不行的话把相关转换和显示的代码贴上来看看。
      

  2.   

    CString a;
    a.GetBuffer(a.GetLengh());
      

  3.   

    由参数返回的话
    fun(LPTSTR lpout)
    {
       CString a = "asdasdasasdas";
       _tcscpy(lpout,a);
    }
      

  4.   

    CString a="sddd";
    char *pchar=a.GetBuffer(a.GetLengh());
    如果是unicode的可以直接用w2c()函数转换成char*类型..
    你可以去看一下w2c这个函数..或者用WideCharToMultiByte()这个函数.祝你好运