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.

https://groups.google.com/forum/#!topic/microsoft.public.scripting.vbscript/gR_Gi87qojU

http://www.visualbasicscript.com/Getting-exit-code-with-Exec-method-m62896.aspx shows the solution.

Do While objExec.Status = 0
WScript.Sleep 100
Loop

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 http://support.microsoft.com/kb/169443

— 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

non-intrusive test – if current process has admin privilege

Just run qq(openfiles) command.

See https://groups.google.com/forum/#!topic/alt.msdos.batch.nt/1dnlamNqZ7U

==============================

Information in this message is confidential. It is intended solely for the person or the entity to whom it is addressed. If you are not the intended recipient, you are not to disseminate, distribute or copy this communication. Please notify the sender and delete the message and any other record of it from your system immediately.

==============================

window procedure in microsoft windows app, briefly

http://msdn.microsoft.com/en-us/library/ms644927(v=vs.85).aspx explains that Every (visual) window is an instance of a window class. “Every window class has a window procedure, and every {{visual}} window created with that class uses that same window procedure to respond to messages.”

Therefore every visual window has a window procedure – a function that processes all messages sent or posted to All window instances of the class. The window procedure (i.e. callback) has the business logic.