ADXIEHTMLDocEvents OnCopy Event fires before data is in clipboard

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

ADXIEHTMLDocEvents OnCopy Event fires before data is in clipboard
 
Robert Stanley




Posts: 9
Joined: 2012-05-24
I'm able to get the event onCopy to fire in ADXIEHTMLDocEvents when I copy something on the page but it shows the previous item that was entered in the clipboard, so its always one behind. Here is a snippet of my code:

 
var data = Clipboard.GetText();
(this.MyToolbar1.ToolBarObj as MyToolbarProject.MyBar1).SetToTextBox(data);


The text will go into my textbox so I have no problem there but its always the last item that was entered in the Clipboard. Is there some sort of work around for this?

Thanks,
Robert
Posted 24 May, 2012 15:46:43 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Robert,

Please try to access the clipboard in the OnSendMessage event handler as shown below:

 
        private const int WM_USER = 0x0400;
        private const int WM_AFTERCOPY = WM_USER + 100;

        private void adxiehtmlDocEvents1_OnCopy(object sender, object eventObject, ADXCancelEventArgs e)
        {
            this.SendMessage(WM_AFTERCOPY, IntPtr.Zero, IntPtr.Zero);
        }

        private void IEModule_OnSendMessage(ADXIESendMessageEventArgs e)
        {
            if (e.Message == WM_AFTERCOPY)
            {
                var data = Clipboard.GetText();
                if (!String.IsNullOrEmpty(data))
                    MessageBox.Show(this, data);
            }
        }
Posted 25 May, 2012 10:20:21 Top
Robert Stanley




Posts: 9
Joined: 2012-05-24
ADXIEHTMLDocEvents does not have an OnSendMessage Event. I'm using version 7.2.4104.

My ultimate goal is to have a fast and easy way for my Flex application to talk to my IE Toolbar so I can show some text. This way the user can still see the text when they go to another website. Is there a better way to do this because I was going to have my Flex application copy text to the clipboard and have my toolbar display it. I plan on having some prefix to go with the copied text so I know its coming from my Flex application. If you have a better way please let me know.
Posted 30 May, 2012 09:01:54 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Robert,

OnSendMessage is the event of the iemodule. You can find it in the toolbar too. Please let me know if you face any difficulties implementing the code.
Posted 30 May, 2012 09:54:33 Top
Robert Stanley




Posts: 9
Joined: 2012-05-24
Sorry, I found it. It all works! Thanks for your help.
Posted 30 May, 2012 10:42:00 Top