Custom Dialog Box in MS Word

R

Rob

I have been developing an addin for Word that coincides with one of our
companies applications. In part of our code, we allow the user to open
a document in Word (from our own application). Within the new Word that
has opened, we override the save button so that a custom modal dialog
pops up with a few choices for the user. The problem that I encounter
is that when dragging the dialog, it overpaints Microsoft Word (MS Word
is not refreshing). I have tried to lock the dialog so that it is not
movable, but that does not work (the dialog is still able to be moved).
Also, I have experimented with making the dialog non modal, but that
seems to lock up the dialog completely such that it doesn't respond and
won't display any text. My next thought was to set the parent of the
dialog to the Word Application or Window, but I can't seem to figure
out this cast (Word.Window to Forms.IFormsWindow).

Does anyone have any ideas?

Thanks,
Rob Heinen
 
C

Cindy M.

Hi Rob,

It's not clear in which programming language you're working, but if it
supports events for dragging/moving the dialog/form try (for the Word
application): Application.ScreenRefresh

Otherwise, you may need to use the Windows API to force a repaint.
I have been developing an addin for Word that coincides with one of our
companies applications. In part of our code, we allow the user to open
a document in Word (from our own application). Within the new Word that
has opened, we override the save button so that a custom modal dialog
pops up with a few choices for the user. The problem that I encounter
is that when dragging the dialog, it overpaints Microsoft Word (MS Word
is not refreshing). I have tried to lock the dialog so that it is not
movable, but that does not work (the dialog is still able to be moved).
Also, I have experimented with making the dialog non modal, but that
seems to lock up the dialog completely such that it doesn't respond and
won't display any text. My next thought was to set the parent of the
dialog to the Word Application or Window, but I can't seem to figure
out this cast (Word.Window to Forms.IFormsWindow).

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
R

Rob

Hi Cindy,

I'm using C# to program the addin. I tried using the
Application.ScreenRefresh, and it works over the editable area of the
Word Document, but it will not refresh the toolbars or side panels
(they'll be erased by the document). How would you suggest using the
Windows API to repaint?

Thanks,
Rob Heinen
 
C

Cindy M.

Hi Rob,
How would you suggest using the
Windows API to repaint?
I'm afraid coding that goes beyond my current knowledge.
You should try asking this in a C# group or forum. It's
possible the necessary interfaces are exposed in the .NET
Framework - someone there may know.

In case you need to get the hWnd of the Word application
window, the Word application name for this kind of thing
is: OpusApp

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

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