modeless dialog box in .NET add-in?

D

David Thielen

Hi;

Is there any problem with having a modeless dialog box in an add-in (C# .NET
- not VSTO)?

Anything special I need to do or not do? And what if Word exits while it is
up?
 
P

Peter Huang [MSFT]

Hi

I think we can use modaless form similar with modal one in the add-in in
..net so far.

Here is a link you may have a look.
Adding Windows Forms to Your Add-in

Tips and Tricks: Building Microsoft Office Add-ins with Visual C# .NET and
Visual Basic .NET
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechar
t/html/vbtchTipsTricksBuildingMicrosoftOfficeAdd-insWithVisualCNETVisualBasi
cNET.asp

If you have any specified problem, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

David Thielen

Hi;

That link shows a modal dialog box. Any information or do's/dont's for a
non-modal dialog box? For example, how do both Word and my dialog box get the
message pump?

thanks - dave
 
P

Peter Huang [MSFT]

Hi

From the link before,

The interaction of the form with Office depends on whether the form is
modeless. Modeless form cannot interact directly with the Office object
model. Instead, you will need to design your application such that the
modeless form returns information to the calling code. The calling code may
then interact with the object model. Generally, modal forms will be able to
interact with the Office object model.

We will know that we can use the Modeless form. While because the form is
modeless, if we want to interact the form with Office, we may need to hold
the reference to the office application in the form class and vice versa,
so that when the form get focus we can manipulate the office Object modal
to retrieve or set information, and when the office application get focus,
we can manupilate the Form instance to display different information.

A message queue is thread based, that is to say for the office application,
we can consider it has just one message queue, and if we show the modeless
form in the office application is similar with we have a windows
application and the windows application will have two windows or more. The
office application's will handle the message dispatch issue, i.e. how to
handle messages in the thread's message queue(known as message pump), e.g.
dispatch to certain window's winproc.

For detailed information about windows message, you may refer to
Programming Applications for Microsoft Windows written by Jeffrey Richter.

If you still have any concern, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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