I use the IProgressDialog
interface as per normal, everything works all right but the progress dialog only appears after a few seconds when it decides that the operation is indeed lengthy. Although this is nowhere documented, it seems to be intended behavior and not bad in many cases. However, in this particular application I'd need to display it immediately.
I found a single reference on the whole wide web to acknowledge this and to suggest a workaround. However, maybe because there were quite a few new Windows versions during that nine years, it doesn't seem to work today:
IProgressDialog dialog;
dialog.StartProgressDialog(owner, null, flags, IntPtr.Zero);
...
IntPtr DialogHWnd;
((IOleWindow)dialog).GetWindow(out DialogHWnd);
SendMessage(DialogHWnd, WM_TIMER, new IntPtr(1), IntPtr.Zero);
The window handle is OK, I checked it, there is no error, just there is no change in behavior. The dialog only appears after a few seconds.
Does anybody have a suggestion short of re-creating the same dialog and functionality in C# again? Not impossible, of course, but the stock dialog has nice features like animation and canceling behavior, in addition to being very familiar to users.