2013-12-13 71 views

回答

2

从VS.内运行时,您可以检查

System.Diagnostics.Process.GetCurrentProcess().ProcessName 

值应该devenv.exe

1

在代码中,您可以通过查看CurrentDomain.FriendlyName来检查vshosts.exe是否正在运行。如果它以“.vshosts.exe”结尾,那么它正在运行。

bool is_vshost = false; 
    int i = AppDomain.CurrentDomain.FriendlyName.IndexOf("."); 
    string s = AppDomain.CurrentDomain.FriendlyName.Substring(i); 
    if (s == ".vshosts.exe") 
     is_vshost = true; 
相关问题