1

私は現在、VSNewFileに似たアドインを構築しようとしています。したがって、新しいファイルをより迅速に作成する方法を提供する単純な拡張機能です。VSNewFile の問題は、C++ プロジェクトでは機能しないことであり、そのために必要です。

ここに私の問題があります:
選択したディレクトリの絶対パスを取得できません。私が見つけたすべてのサンプルは次のようなものでした:
(string)((ProjectItem)parent).Properties.Item("FullPath").Value;

これは C# プロジェクトで動作していますが、C++ プロジェクトでは動作していません。C++ プロジェクトselectedItem.Projectでは、ディレクトリを選択するとselectedItem.ProjectItem両方になります。重要:フィルタについて話しているのではありません! つまり、実際のディレクトリです。 どんな助けでも大歓迎です。私は何時間も検索しましたが、成功しませんでした。 ありがとうnull




4

1 に答える 1

0

たぶん、これは同じ問題を抱えている他の人を助けるでしょう:
http ://social.msdn.microsoft.com/forums/en-US/vsx/thread/bd738463-ba24-4880-beea-f3ec110d981e

// Subscribe to the SVsShellMonitorSelection service somewhere:  
public void mySetupMethod()  
{  
     IVsMonitorSelection monitorSelection = 
     (IVsMonitorSelection)Package.GetGlobalService(
     typeof(SVsShellMonitorSelection));     
     monitorSelection.AdviseSelectionEvents(this, out cookie);    
}  

// This class (as used in AdviseSelection) must implement the IVsSelectionEvents interface  
// To get the folder path use the following  
public int OnSelectionChanged(IVsHierarchy pHierOld, uint itemidOld,   
  IVsMultiItemSelect pMISOld, ISelectionContainer pSCOld,   
  IVsHierarchy pHierNew, uint itemidNew, IVsMultiItemSelect pMISNew, ISelectionContainer pSCNew)  
{  
  string fullPath;  
  // Get the full path
  pHierNew.GetCanonicalName(itemidNew, out fullPath);  

  // Do something with the path...  
  return VSConstants.S_OK;  
}  
于 2010-09-20T01:26:10.373 に答える