For example if I’m working on Visual Studio 2008, I want the values devenv and 2008 or 9.
The version number is very important…
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is going to be PInvoke city…
You’ll need to PInvoke the following API’s in User32.dll
Win32::GetForegroundWindow() in returns the HWND of the currently active window.
Win32::GetWindowThreadProcessId(HWND,LPDWORD) returns the PID of a given HWND
In C#
Process.GetProcessByID() takes the PID to create a C# process object
processInstance.MainModule returns a ProcessModule with FileVersionInfo attached.