This is a multi-part message in MIME format.
------=_NextPart_000_000C_01C84D66.5AFB22F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
I'm executing this example, but when I execute Outlook minimized, the =
application doesn't work.
Somebody have idea that is happening?
Thanks!
Sergio
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Outlook =3D Microsoft.Office.Interop.Outlook;
using Office =3D Microsoft.Office.Core;
using System.Windows.Forms;
namespace OutlookAddIn
{
public partial class ThisAddIn
{
Office.CommandBar fooAddInToolBar;
Outlook.Explorers selectExplorers;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
selectExplorers =3D this.Application.Explorers;
selectExplorers.NewExplorer +=3D new =
Outlook.ExplorersEvents_NewExplorerEventHandler(newExplorer_Event);
AddToolbar();
}
private void newExplorer_Event(Outlook.Explorer new_Explorer)
{
((Outlook._Explorer)new_Explorer).Activate();
fooAddInToolBar =3D null;
AddToolbar();
}
private void AddToolbar()
{
try
{
if (fooAddInToolBar =3D=3D null)
{
Office.CommandBars cmdBars =3D =
this.Application.ActiveExplorer().CommandBars;
fooAddInToolBar =3D cmdBars.Add("fooAddInToolBarName", =
Office.MsoBarPosition.msoBarTop, false, true);
fooAddInToolBar.Visible =3D true;
}
}
catch (Exception Ex)
{=20
MessageBox.Show("Error: " + Ex.Message.ToString());
}
}
private void ButtonClick(Office.CommandBarButton ctrl, ref bool =
cancel)
{
MessageBox.Show("You clicked: " + ctrl.Caption);
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs =
e)
{
}
#region VSTO generated code
/// <summary>
/// Required method for Designer sup****t - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Startup +=3D new =
System.EventHandler(ThisAddIn_Startup);
this.Shutdown +=3D new =
System.EventHandler(ThisAddIn_Shutdown);
}
=20
#endregion
}
}
------=_NextPart_000_000C_01C84D66.5AFB22F0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16587" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I'm executing this example, but when I =
execute=20
Outlook minimized, the application doesn't work.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Somebody have idea that is =
happening?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Sergio</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D1>using System;<BR>using=20
System.Collections.Generic;<BR>using System.Linq;<BR>using =
System.Text;<BR>using=20
System.Xml.Linq;<BR>using Outlook =3D =
Microsoft.Office.Interop.Outlook;<BR>using=20
Office =3D Microsoft.Office.Core;<BR>using =
System.Windows.Forms;</FONT></DIV>
<DIV><FONT face=3DArial size=3D1></FONT> </DIV>
<DIV><FONT face=3DArial size=3D1>namespace =
OutlookAddIn<BR>{<BR> =20
public partial class ThisAddIn<BR> =20
{<BR> Office.CommandBar=20
fooAddInToolBar;<BR> Outlook.Explorers=20
selectExplorers;</FONT></DIV>
<DIV><FONT face=3DArial size=3D1></FONT> </DIV>
<DIV><FONT face=3DArial size=3D1> private =
void=20
ThisAddIn_Startup(object sender, System.EventArgs=20
e)<BR> =20
{<BR> =
selectExplorers =3D=20
this.Application.Explorers;<BR> =
=20
selectExplorers.NewExplorer +=3D new=20
Outlook.ExplorersEvents_NewExplorerEventHandler(newExplorer_Event);<BR>&n=
bsp; =20
AddToolbar();<BR> =20
}<BR> private void=20
newExplorer_Event(Outlook.Explorer=20
new_Explorer)<BR> =20
{<BR> =20
((Outlook._Explorer)new_Explorer).Activate();<BR> =
=20
fooAddInToolBar =3D null;<BR> =20
AddToolbar();<BR> }</FONT></DIV>
<DIV><FONT face=3DArial size=3D1></FONT> </DIV>
<DIV><FONT face=3DArial size=3D1> private =
void=20
AddToolbar()<BR> =20
{<BR> =20
try<BR> =20
{<BR> if =
(fooAddInToolBar=20
=3D=3D null)<BR> =20
{<BR> =20
Office.CommandBars cmdBars =3D=20
this.Application.ActiveExplorer().CommandBars;<BR>  =
; =20
fooAddInToolBar =3D cmdBars.Add("fooAddInToolBarName",=20
Office.MsoBarPosition.msoBarTop, false,=20
true);<BR> &nb=
sp;=20
fooAddInToolBar.Visible =3D=20
true;<BR> =20
}<BR> =20
}<BR> catch (Exception=20
Ex)<BR> {=20
<BR> =20
MessageBox.Show("Error: " +=20
Ex.Message.ToString());<BR> =20
}<BR> }</FONT></DIV>
<DIV><FONT face=3DArial size=3D1></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT><BR><FONT face=3DArial=20
size=3D1> private void=20
ButtonClick(Office.CommandBarButton ctrl, ref bool=20
cancel)<BR> =20
{<BR> MessageBox.Show("You =
clicked: "=20
+ ctrl.Caption);<BR> }</FONT></DIV>
<DIV><FONT face=3DArial size=3D1></FONT> </DIV>
<DIV><FONT face=3DArial =
size=3D1> private=20
void ThisAddIn_Shutdown(object sender, System.EventArgs=20
e)<BR> =20
{<BR> }</FONT></DIV>
<DIV><FONT face=3DArial size=3D1></FONT> </DIV>
<DIV><FONT face=3DArial =
size=3D1> #region=20
VSTO generated code</FONT></DIV>
<DIV><FONT face=3DArial size=3D1></FONT> </DIV>
<DIV><FONT face=3DArial =
size=3D1> ///=20
<summary><BR> /// =
Required=20
method for Designer sup****t - do not=20
modify<BR> /// the contents of =
this=20
method with the code =
editor.<BR> ///=20
</summary><BR> private =
void=20
InternalStartup()<BR> =20
{<BR> =20
this.Startup +=3D new=20
System.EventHandler(ThisAddIn_Startup);<BR> =
=20
this.Shutdown +=3D new=20
System.EventHandler(ThisAddIn_Shutdown);<BR>  =
; =20
}<BR> =20
<BR> =
#endregion<BR> =20
}<BR>}<BR></FONT></DIV></BODY></HTML>
------=_NextPart_000_000C_01C84D66.5AFB22F0--


|