views:

49

answers:

1

I know when I put something in the log using ::MsiProcessMessage(hModule, INSTALLMESSAGE(INSTALLMESSAGE_INFO), ...); that I can check if the return value is IDCANCEL and return ERROR_INSTALL_USEREXIT to Windows installer.

How do I check for that return value without having to put something in the log or alter the progress bar?

A: 

I believe the call you describe will place the info message in the log. But other than that, why would you have to put something in the log or alter the progress bar? If your action takes a long time, it should report progress. If it is short and you never call MsiProcessMesssage, Windows Installer will handle cancel immediately afterward. The only problem case is if you call MsiProcessMessage and swallow a cancel without reporting it.

Michael Urman
Right now, I'm trying to debug a CA that might infinite-loop under certain conditions. So I want to be able to check for cancels within the code that might infinite-loop, without doing anything else.
Curtis Jewell
Ah. So how about call MsiProcessMessage with INSTALLMESSAGE_PROGRESS and a record {2, 0, x, x} (increment progress by 0 ticks)?
Michael Urman
Good catch. Didn't think of that. Ended up getting it debugged anyway, but I'll need it for other things.
Curtis Jewell