Office 2007 and Windows Forms-pop under?

C

Chris Bardon

I have an office COM add-in that I designed for 2003 that creates
controls which in turn create windows forms. I had a problem in 2003
where clicking a button would create the appropriate form, but the
form would be created behind the Outlook main window (i.e. in the
background). I managed to solve this by using the Win32
SetForegroundWindow method in the form's OnLoad, and this solved the
problem for Office 2003. In 2007 though, the problem has resurfaced,
and the SetForegroundWindow command doesn't seem to be working. Is
there something that has changed in 2007 that could be causing this
behaviour? I've installed the latest VSTO on my build machine, and
the 2007 PIAs on the target, but still no luck.

Any ideas?

Thanks,

Chris
 
P

Patrick Schmid [MVP]

I am using SetForegroundWindow myself successfully with 2007. How are
you using it?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Outlook 2007 Performance Update: http://pschmid.net/blog/2007/04/13/105
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
 
C

Chris Bardon

I think the problem is in my add-in architecture. The add-in is
nothing more than an interface to a COM server running on the
machine. The COM server has the ability to show notification forms,
so all the add-in does is invoke a COM method. The method gets
invoked on 2007, but all that happens is that the taskbar item
flashes.

What I don't understand now is why this works on one machine (server
2003 with office 11), and not on another (XP with office 12).

I'm going to try returning a window handle to my add-in, and then
having IT call setForegroundWindow.

I am using SetForegroundWindow myself successfully with 2007. How are
you using it?

Patrick Schmid [OneNote MVP]
--------------http://pschmid.net
***
Outlook 2007 Performance Update:http://pschmid.net/blog/2007/04/13/105
Office 2007 RTM Issues:http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007:http://pschmid.net/office2007/customize
RibbonCustomizer Add-In:http://pschmid.net/office2007/ribboncustomizer
OneNote 2007:http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog:http://pschmid.net/blog/feed


I have an office COM add-in that I designed for 2003 that creates
controls which in turn create windows forms. I had a problem in 2003
where clicking a button would create the appropriate form, but the
form would be created behind the Outlook main window (i.e. in the
background). I managed to solve this by using the Win32
SetForegroundWindow method in the form's OnLoad, and this solved the
problem for Office 2003. In 2007 though, the problem has resurfaced,
and the SetForegroundWindow command doesn't seem to be working. Is
there something that has changed in 2007 that could be causing this
behaviour? I've installed the latest VSTO on my build machine, and
the 2007 PIAs on the target, but still no luck.
Any ideas?

Chris
 

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