Windows form freezing

Add-in Express™ Support Service
That's what is more important than anything else

Windows form freezing
 
Cyrus Major




Posts: 3
Joined: 2011-02-08
I am using Add-In Express 2010 for .Net and I added an Outlook Inspector bar and added a button to it that bar.

OnClick of that button i have a code to open windows forms like this
private void adxCommandBarButton2_Click(object sender)
{
TestForm test = new TestForm();
test.Show();
}
The addin registers correctly in Outlook 2003 but when i click the button from New Mail window it opens my windows forms but it just freeze that windows form. I just have a textbox and button on that windows forms and no other code.



This freezing behavior only happens when the button is clicked from Mail item. If I click on the button from New appointment window or anywhere else the windows forms opens perfectly. Can you help?
Posted 08 Feb, 2011 01:46:27 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Cyrus,

It looks like you need to specify the parent window for your windows form. Please have a look at the sample add-in project which shows the required functionality. Does it help?
.NET, Extended MAPI, Windows Phone & RT
Posted 08 Feb, 2011 10:08:46 Top
Cyrus Major




Posts: 3
Joined: 2011-02-08
It still does not work. I have sent you an email with sample project yesterday. Can you please look into that?
Posted 09 Feb, 2011 04:59:02 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Cyrus,

Thank you for providing me with a sample add-in project. I have reproduce the issue you described above. Please see my remarks below:

1. Please use the following line of code instead:

window = OutlookApp.ActiveInspector();


not

window = OutlookApp.ActiveWindow();


2. Do you use Word as an e-mail editor? If so, the inspector window is run from another process (WORD.EXE). The approach, the the sample add-in project illustrates, will not work in that case. Please have a look at another sample add-in project. It will help you to bridge the gap ;-)
.NET, Extended MAPI, Windows Phone & RT
Posted 09 Feb, 2011 12:46:05 Top
Cyrus Major




Posts: 3
Joined: 2011-02-08
Yes i do use Word as the email editor. So i downloaded your new example and it worked for model window. But i dont want a Model form. So as mentioned in your example i used

SetParent(myForm.Handle.ToInt32(), GetForegroundWindow());

But when i tried that it did not open any window. So its not working for non-model window. Can you please help?
Posted 10 Feb, 2011 03:38:19 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Cyrus,

Please make sure that you use the Show method of the form (not ShowDialog). For example:

SetParent(myForm.Handle.ToInt32(), GetForegroundWindow());
myForm.Show();


Note, I used the Show method without parameters.
.NET, Extended MAPI, Windows Phone & RT
Posted 10 Feb, 2011 11:58:30 Top