Microsoft COM – a few keywords

“COM library” vs “type library”???

I suspect most code (whether people mention COM or not) written before dotnet are probably technically COM code???

— dotnet without the dotnet context —

Client/server — A COM client is whatever code or object that gets a pointer to a COM server and uses its services. A COM server is any object that provides services to clients. In-process servers are implemented in a dynamic linked library (DLL), and out-of-process servers are implemented in an executable file (EXE). Out-of-process servers can reside either on the local computer or on a remote computer.

Registry — COM types are usually listed by GUIDs in the registry, though some COM types are RegFree

DLL — COM components are usually implemented in DLL files, and registration allows only a single version of a DLL. Dotnet classes also exist in DLL or EXE files.

MS-Office – For example COM allows Word documents to dynamically link to data in Excel spreadsheets
Bindings — COM interfaces have bindings in several languages, such as C, C++, Visual Basic

ActiveX – is part of COM

— Excel Addin —
All COM Add-ins must implement each of the five methods of this interface: OnConnection, OnStartupComplete, OnAddinsUpdate, OnBeginShutDown, and OnDisconnection.

exit code lost – Horror story on Microsoft dev environment

This is such a poorly documented feature!

If you run your exe and then echo %ERRORLEVEL% you can get the correct exit code 99. If you use WScript.Shell Exec to invoke it, then check the ExitCode property you always see 0.!topic/microsoft.public.scripting.vbscript/gR_Gi87qojU shows the solution.

Do While objExec.Status = 0
WScript.Sleep 100

WScript.Echo objExec.ExitCode

windows task scheduler tips

To view the hidden scheduler log, use DOS to list the files in c:windowstasks folder. Or use notepad++ on c:WINDOWSTasksSchedLgU.Txt

To increase the log size limit, follow

— forever running tasks

This will block subsequent reruns.

Fix: try the max run time (default 72 hours)

Fix: To kill forever-running tasks, restart the task scheduler “service” itself

Some reasons for a forever-running task

* vbs may need to use wscript.quit