ActiveSync problem

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

ActiveSync problem
 
Guest


Guest


I have an Explorer Bar with 1 button. When Active Sysnc starts before the outlook UI is loaded I get an error - "Object refrence not set to an instance of an object"

I guess the my BAr is trying to load into a non existent Active Explorer.

I tried changing the load behaviour to onDemand but then my Bars dont appear.

Is there a solution for this?

Thanks

Adam
Posted 11 Mar, 2005 10:07:46 Top
Eugene Starostin


ADX Team
Add-in Express team


Posts: 430
Joined: 2004-04-05
Could you please send us your source code. Or list the initialize handler code here.
Posted 11 Mar, 2005 10:10:44 Top
Adam Toth




Posts: 24
Joined: 2005-03-08
Sure - code below.


public class AddinModule : AddinExpress.MSO.ADXAddinModule
    {
        public AddinModule(System.ComponentModel.IContainer container)
        {
            // This call is required by the Component Designer
            container.Add(this);
            InitializeComponent();
 
            // TODO: Add any initialization after the InitializeComponent call
        }

		private AddinExpress.MSO.ADXOlExplorerCommandBar rdbProExplorerBar;
		private AddinExpress.MSO.ADXCommandBarButton toCVReaderBTN;
		private System.Windows.Forms.ImageList imageList1;
 
        public AddinModule()
        {
            InitializeComponent();
			toCVReaderBTN.Click += new AddinExpress.MSO.ADXClick_EventHandler(DoClick);
        }
 
        // Add-in Module Implementation
 
        #region Component Designer generated code
        /// <summary>
        /// Required by designer
        /// </summary>
        private System.ComponentModel.IContainer components;
 
        /// <summary>
        /// Required by designer support - do not modify
        /// the following method
        /// </summary>
        private void InitializeComponent()
        {
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(AddinModule));
			this.rdbProExplorerBar = new AddinExpress.MSO.ADXOlExplorerCommandBar(this.components);
			this.toCVReaderBTN = new AddinExpress.MSO.ADXCommandBarButton(this.components);
			this.imageList1 = new System.Windows.Forms.ImageList(this.components);
			// 
			// rdbProExplorerBar
			// 
			this.rdbProExplorerBar.CommandBarName = "RDB Pro Bar";
			this.rdbProExplorerBar.CommandBarTag = "be88c7d6-f435-40f3-8dc4-17e690204f8c";
			this.rdbProExplorerBar.Controls.Add(this.toCVReaderBTN);
			this.rdbProExplorerBar.Position = AddinExpress.MSO.ADXMsoBarPosition.adxMsoBarTop;
			this.rdbProExplorerBar.Temporary = true;
			this.rdbProExplorerBar.UpdateCounter = 7;
			// 
			// toCVReaderBTN
			// 
			this.toCVReaderBTN.Caption = "Send To CV Reader";
			this.toCVReaderBTN.ControlTag = "24b137fe-2761-4635-b7ba-a5030a275342";
			this.toCVReaderBTN.Image = 0;
			this.toCVReaderBTN.ImageTransparentColor = System.Drawing.Color.Transparent;
			this.toCVReaderBTN.Style = AddinExpress.MSO.ADXMsoButtonStyle.adxMsoButtonIconAndCaption;
			this.toCVReaderBTN.Tag = "toCVReaderBTN";
			this.toCVReaderBTN.Temporary = true;
			this.toCVReaderBTN.TooltipText = "Send To CV Reader";
			this.toCVReaderBTN.UpdateCounter = 13;
			// 
			// imageList1
			// 
			this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
			this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
			this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// AddinModule
			// 
			this.AddinName = "RDBProOutlookAddIn";
			this.Images = this.imageList1;
			this.ShimProgID = "RDBProOutlookAddInShim.Proxy";
			this.SupportedApps = AddinExpress.MSO.ADXOfficeHostApp.ohaOutlook;

		}
        #endregion
 
        #region ADX automatic code
 
        // Required by Add-in Express - do not modify
        // the methods within this region
 
        public override System.ComponentModel.IContainer GetContainer()
        {
            return components;
        }
 
        [ComRegisterFunctionAttribute]
        public static void AddinRegister(Type t)
        {
            AddinExpress.MSO.ADXAddinModule.ADXRegister(t);
        }
 
        [ComUnregisterFunctionAttribute]
        public static void AddinUnregister(Type t)
        {
            AddinExpress.MSO.ADXAddinModule.ADXUnregister(t);
        }
 
        public override void UninstallControls()
        {
            base.UninstallControls();
        }

        #endregion

		public object GetCurrentItem()
		{
			object currentItem = null;
			object ActiveEditor = null;
			object Selection = null;
			object[] args = new Object[1];
			args[0] = 1;
			try
			{
				ActiveEditor = HostApplication.GetType().InvokeMember("ActiveExplorer",System.Reflection.BindingFlags.GetProperty, null, HostApplication, null);
				Selection = ActiveEditor.GetType().InvokeMember("Selection",System.Reflection.BindingFlags.GetProperty,null,ActiveEditor,null);
				currentItem = Selection.GetType().InvokeMember("Item",BindingFlags.InvokeMethod, null,Selection,args );
				return currentItem;
			}
			catch (Exception ex)
			{
				MessageBox.Show("Error in GetCurrentItem():" + ex.Message);
				return null;
			}
			finally
			{
				if((ActiveEditor != null) && (ActiveEditor.GetType().IsCOMObject)) Marshal.ReleaseComObject(ActiveEditor);
				ActiveEditor=null;
				if((Selection != null) && (Selection.GetType().IsCOMObject)) Marshal.ReleaseComObject(Selection);
				Selection=null;
			}
		}

		private void DoClick(object sender)
		{
			object myItem = null;
			myItem=GetCurrentItem();
			try
			{
				CVReaderHandler myCVR = new CVReaderHandler();
				myCVR.CurrentItemToCVReader(myItem);
				
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
			finally
			{
				if((myItem != null) && (myItem.GetType().IsCOMObject)) Marshal.ReleaseComObject(myItem);
				myItem=null;
			}
		}
 
    }
Posted 11 Mar, 2005 10:16:15 Top
Adam Toth




Posts: 24
Joined: 2005-03-08
Just a nudge - any thoughts on this please?
Posted 15 Mar, 2005 04:26:02 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Adam.

Could you send me the whole project? I would like to test it on my PC.
Posted 15 Mar, 2005 05:44:13 Top
Adam Toth




Posts: 24
Joined: 2005-03-08
Will do, thanks.
Posted 15 Mar, 2005 12:38:15 Top
Adam Toth




Posts: 24
Joined: 2005-03-08
The problem was not Add-In Express but a previous add-in I had tried to build without AIX!

Thanks to Sergey for help, I must say the support provided here is outstanding!
Posted 24 Mar, 2005 07:39:36 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Adam.

I am glag for you. Thanks a lot for good words.
Posted 24 Mar, 2005 08:05:34 Top
Oliver Degnan




Posts: 54
Joined: 2005-02-03
Diddo! The support these guys deliver is amazing!
Posted 28 Mar, 2005 15:45:11 Top