1、我已经知道了比如某个文件c:\test\test.exe
如果我用::ShellExecute( NULL, "explore", "c:\test", NULL, NULL, SW_SHOWNORMAL );只能打开test.exe文件所在地目录,如何才能既打开文件所在地文件夹,还能够选中test.exe这个文件?
2、我在用
         PSHARE_INFO_2      pBuf;
PSHARE_INFO_2      pBuffer;
NET_API_STATUS     nStatus;
nStatus = NetShareEnum(NULL,dwLevel,(PBYTE *)&pBuf,MAX_PREFERRED_LENGTH,&entriesread,&totalentries,&resume);
if((nStatus == ERROR_SUCCESS) || (nStatus == ERROR_MORE_DATA))
{
      pBuffer=pBuf;
     for(i=1;i<=entriesread;i++)  
{m_shareinfolist.InsertItem (0,CA2W(pBuffer->shi2_netname));列举共享的时候,发现直接输出pBuffer->shi2_netname是乱码,在.NET下面用CA2W转换一下即可。不过由于要在VC6.0下面编译。CA2W用不上。我试着这样转换
CString tempstr;
tempstr.Format("%S",pBuffer->shi2_netname);//大写S
m_shareinfolist.InsertItem (0,tempstr);
这样转换下来,如果共享名是英文的就对了,不过如果共享名是汉字,就会空了。请问如何解决?release下面的。该如何设置或者用什么函数转换那?非常感谢!!!

解决方案 »

  1.   

    你再加上ShellExecute( NULL, "open", "c:\test\test.exe", NULL, NULL, SW_SHOWNORMAL );不就可以了
      

  2.   

    CString tempstr=_T("");
    tempstr.Format(_T("%S"),pBuffer->shi2_netname);//大写S
    试试呢
      

  3.   

    还能够选中test.exe这个文件?的意思是这个文件高亮显示(向鼠标点住的那种效果),不是打开这个。ShellExecute( NULL, "open", "c:\test\test.exe", NULL, NULL, SW_SHOWNORMAL );是打开TEST.EXE了。
      

  4.   


    第一个问题有两种解决方法,用createprocess或ShellExecute( NULL, NULL, "c:\test\test.exe", NULL, NULL, SW_SHOWNORMAL )第二个问题,可以使用WideCharToMultiByte转换
      

  5.   

    WinExec("explorer /n,/select,c:\\txt\\support.txt",SW_SHOWNORMAL );
      

  6.   

    USES_CONVERSION;
    W2A();
    A2W();
      

  7.   

    C:\WINDOWS\EXPLORER.EXE {/n},{/e},{options},{folder}/n, - Opens a new single pane Explorer window/e, Opens a 2 pane view of the selected folderoptions- lets you choose between /root and /select/root, Used with folder. (Ordinarily, \DESKTOP is the root)/select,  Highlights the designated folder.folder  designates the folder path---------------------------------------
    可以用打开文件夹并且高亮文件WinExec("explorer /n,/select,c:\\1.txt", SW_SHOWNORMAL );