VB Script to capture Window Title

damdell used Ask the Experts™
I am trying to capture the window title of all active windows through VB Script.Some how it is not working.Does VB Script has the ability..?I could   do that in powershell..but I prefer VB Script since we dont have powershell in our production server farm.

Thanks in Advance
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Please post the ps script, shuld be useful to adapt to vbscript
Solutions Architect
I'm afraid you may be out of luck using VBScript.   The Win32 way would be to call the EnumWindows function, but that can't be access directly via VBScript.  You would need to get a 3rd part component or write your own dll.  

Alternately you can list the processes via WMI using vbscript: http://www.eggheadcafe.com/microsoft/Win32-WMI/33959865/enumorating-open-windows.aspx  However, it doesn't list the active window titles.

Thiscan be done directly in VB6: http://support.microsoft.com/kb/183009 or .NET: http://www.pinvoke.net/default.aspx/user32.enumchildwindows, or http://msdn.microsoft.com/en-us/library/d186xcf0(VS.71).aspx
With the .net example, you can create a simple console application to output the active windows quite easily using the .Net code above

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial