"can't show a non modal form when modal form is displayed"

  • Thread starter Thread starter tomer
  • Start date Start date
T

tomer

Hi,

As i understood there is some problems displaying modal dialogs from
outlook,
So my add in uses modeless dialog

while outlook propeties dialog was opened,my add in tried to display a
modeless dialog
and i get the following error:

"can't show a non modal form when modal form is displayed"

What can i do inorder to solve the problem? can i detect whenever a modal
form is opened?


Thanks in advance
 
There are problems when displaying an Inspector modally, I use modal
VB forms in my addins and also from Outlook property pages. It depends
on whether I want the form code to run before any other code that
follows the call to the form. You will have to provide more
information about what you are doing and how.
 
Thanks ken.

Here is what I am doing:

When a new message arrived to the inbox ,I am moving it to a different
folder,than I display
a VB modeless form, from my add in ,without setting it's
'OwnerForm'(myForm.Show) ,waiting for user input.

it works fine until the VB Form was displayed while I was changing account
properties
(tool->accounts->properties)

I don't need to display Inspector modally.
as a matter of fact I prefer using Modal forms so i can wait for user input
before farther processing,but as I explained, I thought it make problems.


thanks in advance
 
Tools, Accounts? You are working in Outlook 2000 Internet only mode?

The only thing I can think of to suggest is to handle any error that
occurs and if there's an error then don't show your form.
 
Tomer,

I think maybe you could kick around the idea of trapping an error on
MyForm.Show and then looping to retry every, say, 10 seconds until it
works...

On Error Resume Next
MyForm.Show
If Err.Number <> 0 Then
mystarttimevar = Time
Do While True
myendtimevar = Time
if myendvartime - mystarttimevar > 10 then ' ten seconds has
passed
MyForm.Show
If Err.Number= 0 then ' THE FORM WAS DISPLAYED
Exit Do
End if
' START TEN SECOND COUNT ALL OVER AGAIN
mystarttimevar = Time
end if
Loop
End if

I think that's not how one computes the difference between two times.
Maybe you could toss a MsgBox in there if ten seconds elapses just to let
the user know something is happening that they can't see.

John
 
Thanks john and ken,
What about using MODAL VB Form,will this work for me?

Thanks in advance.
 
A modal form also cannot be displayed when another modal form is being
displayed by the same process. Since Outlook COM addins run in-process
with Outlook the situation would be the same except if the custom form
was displayed the Outlook property sheet couldn't be displayed by the
user, they would get an error.
 
Thanks ken,you helped me a lot.
What about CBT_Hook ? do you think it can help me?
I will hook into the process of the window creation and will not display my
form as long as there are windows still opened
(either modal like option,or modeless like inpsectors) in outlook process.


Thanks again.

Btw:i tried to display my form as MODAL,it did not raise any exception,but
since i didnot set it's parent(i will do it soon)
the form was behind outlook.
 
I'm not familiar with CBT_Hook.

You can control how the form is displayed by setting its ZOrder.
 
Unable to Display my Form on Outlook Word Email Editor

Hi All,

I'm developing COM Add-in for Outlook using Visual Basic 6.0.

I'm able to see my form while the editor is normal. If the editor is word then I'm unable to see my VB forms on the same word email editor, instead of its appearing on the outlook explorer.

I'm struggling how to retain the same behavior as for Normal Editor.

Your prompt reply would be appreciated.

Thanks & Regards
Ashokkumar P
 
Back
Top