hWnd and Redrawing a Window

B

bormesh

Hello all:

I'm currently developing an add in for Microsoft Word. The problem
that I'm running into is that when I use a custom Modal Dialog and drag
the Dialog around the screen, the Micrsoft Word window will be painted
over and not refresh until the dialog has been closed. Microsoft Word
has a ScreenRefresh method, but this only refreshed the editable
portion of the window, while the overwriting was occurring for
everything (toolbars, scrollbars, etc).

The moderator in the Add in group pointed me in the direction of using
the hWnd handle to some how force a redraw. The name of the Word window
is "OpusApp". If anybody could point me in the next step, that would be
great. I'm lost as what to do next.

Thank You,
Rob Heinen
 
A

Andy Bates

Hi -

It sounds like you're blocking Word's message queue in some manner. If you
have the hWnd of Word then you could try using PInvoke to call
InvalidateRect() and then call UpdateWindow() to cause the window to be
refreshed (not a very nice solution though).

Which add in component are you using as I know our company has written a
similar application using add-in express? How are you constructing and
displaying the modal dialog?

Regards

- Andy
 
B

bormesh

Hey Andy,

I'm just creating a general add-in using the extension wizard in
visual studio 2005. Within the addin, I change the functionality of the
save button, such that when a user clicks on it, I display a modal
dialog. (The dialog is used to either use the same save functionality,
or do something that will integrate the document with our own
software). I found a bug report
(http://support.microsoft.com/default.aspx?scid=kb;ko;242017) that
seems to be describing the same type of error that I am getting. I'll
try using the work around to see if that gets me any further. If you
can think of anything else, that'd be great.

Thanks,
Rob Heinen
 
B

bormesh

Hey Andy,

I'm just creating a general add-in using the extension wizard in
visual studio 2005. Within the addin, I change the functionality of the
save button, such that when a user clicks on it, I display a modal
dialog. (The dialog is used to either use the same save functionality,
or do something that will integrate the document with our own
software). I found a bug report
(http://support.microsoft.com/default.aspx?scid=kb;ko;242017) that
seems to be describing the same type of error that I am getting. I'll
try using the work around to see if that gets me any further. If you
can think of anything else, that'd be great.

Thanks,
Rob Heinen

I got it to work. In the Location Changed event of my custom dialog, I
call InvalidateRect on the word window (that I found using FindWindow).
And then I call UpdateWindow. Thanks for the help =)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top