如题!!
typedef struct _NETRESOURCE {  
    DWORD  dwScope; 
    DWORD  dwType; 
    DWORD  dwDisplayType; 
    DWORD  dwUsage; 
    LPTSTR lpLocalName; 
    LPTSTR lpRemoteName; 
    LPTSTR lpComment; 
    LPTSTR lpProvider; 
} NETRESOURCE;
NETRESOURCE ns;
CStringList grouplist;
我想把
grouplist.RemoveHead()的值赋给
ns.lpRemoteName
怎么办??

解决方案 »

  1.   

    grouplist.RemoveHead()的反回值是什么类型呢?
      

  2.   

    直接转换就可以
    (LPTSTR)CString1
      

  3.   

    CString str("demo");
    LPTSTR lpstr=(LPTSTR)(LPCTSTR)str;
      

  4.   

    直接不行呀!
    出错!!
    (LPTSTR)CString1也不行!!
      

  5.   

    (LPTSTR*)str呢?

    (LPTSTR)&str
    多试一下,具体的不知道
      

  6.   

    grouplist.RemoveHead().GetBuffer( XX);
    用完后ReleaseBuffer(),参照July 2000 MSDN 的CString::GetBuffer 。
    顺便Copy给你看ExampleThe following example demonstrates the use of CString::GetBuffer.// example for CString::GetBuffer
    CString s( "abcd" );
    LPTSTR p = s.GetBuffer( 10 );
    strcpy( p, "Hello" );   // directly access CString buffer
    s.ReleaseBuffer( );
      

  7.   

    zhuojohn(闲云野鹤)的
    CString str("demo");
    LPTSTR lpstr=(LPTSTR)(LPCTSTR)str;
    方法可行 
    谢谢zhuojohn
     
    我还不知道为什么?能解释一下吗??