Set wait cursor for word document

I have a long running VSTO procedure running. During its processing, I would like to display hourclass as the cursor. Please advice how to change the word's cursor.

Thanks,

Yuhang



Answer this question

Set wait cursor for word document

  • Rob Washo

    I don't have experiance with Word, but in dealing with Excel, I had to place my operations on a seperate thread and then invoke back to the main thread to do the windows update for hourglass and a progress bar. The reasoning for that is that is, the hourglass operation request is asynchronous; the user would never see it changed until the work was done. (It gave the impression that Excel was locked up, even though work was happening.)

    You may want to read a post I did to figure out how to invoke back to the main thread if you have similar situation. (Hint its not on the Mainworksheet but off of the control!)(Threading issues GUI updates in the Action Pane)

    Here is my code for the hourglass, note it needed state due to other operations, hence the WaitCursorOperational boolean:

    #region Wait cursor
    bool WaitCursorOperational = false;
    private void WaitCursorSet()
    {
    if (WaitCursorOperational == false)
    {
    originalCursor = this.Application.Cursor;
    this.Application.Cursor = XlMousePointer.xlWait;
    WaitCursorOperational = true;
    }
    }

    private void WaitCursorEnd()
    {
    this.Application.Cursor = originalCursor;
    WaitCursorOperational = false;

    }
    #endregion



  • Kevinbe

    this.Application.System.Cursor = wdCursorWait

  • Set wait cursor for word document