Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Switching between Visual Studio instances
#9
Function VS_ActivateSolution2
Code:
Copy      Help
;\
function $solutionPath

;Activates main window of specified Visual Studio solution.

;solutionPath - solution path, like "Q:\app\app.sln".
;;;It must be command line of the solution process.


def wbemFlagReturnImmediately 16
def wbemFlagForwardOnly 32
int IFlags = wbemFlagReturnImmediately|wbemFlagForwardOnly
IDispatch objWMIService._getfile("winmgmts:")
IDispatch colProcesses = objWMIService.ExecQuery("SELECT ProcessId,CommandLine FROM Win32_Process WHERE Name='devenv.exe'",@,IFlags)

IDispatch objProcess
foreach objProcess colProcesses
,str cl=PathGetArgs(objProcess.CommandLine)
,cl.trim("''")
,if cl~solutionPath
,,int pid=objProcess.ProcessId
,,act win("Microsoft Visual" "wndclass_desked_gsk" pid)
,,break


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)