What I am attempting to do, is create a backgound process that
communicates to a COM server. The interface provided to me has a
callback function that is called when data changes. When the data
changes, I want to write the information to a file.

All of the sample programs that I can find seem to have a form
associated with them, then the form is updated by the callback
function. This is not what I want to do.

I have written this program, but the callback function doesn't seem to
get called when the data changes.

The basic flow is initialize COM, then setup the callback. Then wait
for some external trigger to signal that it is time to terminate the
process. I have attempted to sleep, but the callback function doesn't
get called while sleeping. I have also tried waiting for keyboad input,
but this also doesn't work. (Obviously in this case the program is
running in the foreground).

The callback works OK, because I can create a form, and have the form
updated as a result of the callback, and this works OK.

Does anyone have a sample even close to what I am looking to do?
Any ideas what I need to do differently?