How can I disable the processing of messages while doing long operations for my application and also avoid that the user can cancel operations?

You can call

CGXLongOperation::SetTicksFirstTime(LONG_MAX);