Find instances of Visual Studio with the given solution file open. Pass "ALL" for slnFile to gather all running instances of Visual Studio.
| 325 | //! open. Pass "ALL" for slnFile to gather all running instances |
| 326 | //! of Visual Studio. |
| 327 | HRESULT FindVisualStudioInstances(std::string const& slnFile, |
| 328 | std::vector<IDispatchPtr>& instances) |
| 329 | { |
| 330 | std::map<std::string, IUnknownPtr> mrot; |
| 331 | |
| 332 | HRESULT hr = GetRunningInstances(mrot); |
| 333 | ReportHRESULT(hr, "GetRunningInstances"); |
| 334 | |
| 335 | if (SUCCEEDED(hr)) { |
| 336 | std::map<std::string, IUnknownPtr>::iterator it; |
| 337 | for (it = mrot.begin(); it != mrot.end(); ++it) { |
| 338 | if (cmHasLiteralPrefix(it->first, "!VisualStudio.DTE.")) { |
| 339 | IDispatchPtr disp(it->second); |
| 340 | if (disp != (IDispatch*)0) { |
| 341 | std::string slnName; |
| 342 | hr = GetIDESolutionFullName(disp, slnName); |
| 343 | ReportHRESULT(hr, "GetIDESolutionFullName"); |
| 344 | |
| 345 | if (FilesSameSolution(slnFile, slnName)) { |
| 346 | instances.push_back(disp); |
| 347 | |
| 348 | // std::cout << "Found Visual Studio instance." << std::endl; |
| 349 | // std::cout << " ROT entry name: " << it->first << std::endl; |
| 350 | // std::cout << " ROT entry object: " |
| 351 | // << (IUnknown*) it->second << std::endl; |
| 352 | // std::cout << " slnFile: " << slnFile << std::endl; |
| 353 | // std::cout << " slnName: " << slnName << std::endl; |
| 354 | } |
| 355 | } |
| 356 | } |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | return hr; |
| 361 | } |
| 362 | |
| 363 | #endif // defined(HAVE_COMDEF_H) |
| 364 |
no test coverage detected
searching dependent graphs…