The batch file should work without errors.
The first command makes the dll from the cls file. He will say "Compilation Sucessfull." He expects the files to be in the wso folder on the desktop.
The second team registers it on the car. You must be an administrator to do this. If you are not an administrator, you must create a reg file and change all HKEY_CURRENT_ROOT to HKEY_CURRENT_USER \ Software \ Classes.
To create regfile
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm" /regfile:"%userprofile%\desktop\wso\wso.reg" "%userprofile%\desktop\wso\wso.dll" /v
After editing wso.reg merge it with
regedit /m "%userprofile%\desktop\wso\wso.reg"
And you need to read the results of the commands.
Below is an example script showing hwnd, PID and window title (and error code). Please note that when the script starts, there is no active window for about two seconds (windows wait until your program creates one so that it activates, it only waits 2 seconds). Usually, when the program starts, but also in other cases, there will be no active window for short periods. You have to trap. Here is a script that does.
On error resume next Set wso=CreateObject("WindowScriptingObject") Do x = wso.ActiveWindow wscript.echo x wscript.echo wso.windowtext(x) wscript.echo (err.number) err.clear wscript.echo wso.windowpid(x) wscript.echo (err.number) err.clear wscript.sleep 1000 Loop
And this is what it looks like when launched from CScript on the command line.
C:\Users\User>cscript "C:\Users\User\Desktop\ActiveWindow.vbs" Microsoft (R) Windows Script Host Version 5.7 Copyright (C) Microsoft Corporation. All rights reserved. -2147024809 -2147024809 3344366 Administrator: Command Prompt - cscript "C:\Users\User\Desktop\ActiveWin dow.vbs" 0 972 0 3344366 Administrator: Command Prompt - cscript "C:\Users\User\Desktop\ActiveWin dow.vbs" 0 972 0 3344366 1312854 vbscript - How to find the window Title of Active(foreground) window using Windo w Script Host - - Windows Internet Explorer 0 4724 0 1312854 vbscript - How to find the window Title of Active(foreground) window using Windo w Script Host - - Windows Internet Explorer 0 4724 0 3344366 Administrator: Command Prompt - cscript "C:\Users\User\Desktop\ActiveWin dow.vbs" 0 972 0 ^C C:\Users\User>
---- EDIT ----
It looks like you got a notepad error when pasting from web pages from a ridiculous interval of the object name in the error message.
If you use notepad to copy and paste it into a text block to check line breaks. Notepad completely ignores and hides carriage returns, but other programs do not. Notepad is only looking for lines. If copying from browser-based documentation, such as web pages and help systems, sometimes wandering carriage returns become imperceptibly pasted into a notebook.