TaskPanes Instances on different word documents - word 2010/2007

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

TaskPanes Instances on different word documents - word 2010/2007
 
Igor Govorov




Posts: 83
Joined: 2014-02-12
Hi,

I am trying to do something similar to this ticket :

https://www.add-in-express.com/forum/read.php?FID=5&TID=11720

On word, I see that the given workaround works well for word 2013, but my problem that word 2010/2007 does not support window.Hwnd property.

any idea how can I do this?

Thanks.
Posted 11 Oct, 2015 09:07:22 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Igor,

Check the ADXWordTaskPane.WindowObj property:

Returns a Word.Window object (a COM object) representing the window in which the specified pane instance is shown. You must release this object after use (via Marshal.ReleaseComObject).



Andrei Smolin
Add-in Express Team Leader
Posted 12 Oct, 2015 02:01:23 Top
Igor Govorov




Posts: 83
Joined: 2014-02-12
Hi Andrei,

I am trying to do this at ADXWordTaskPane_ADXBeforeTaskPaneShow. and when using ADXWordTaskPane.WindowObj it is null there.

I see that my situation is similar to the workaround of the ticket above,and it works fine on 2013, my problem still at 2007/2010 :)

can you help please ?

Thanks,
Posted 12 Oct, 2015 03:41:16 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Igor,

ADXTaskPaneBeforeShow occurs when the pane isn't yet embedded in the Word window. Try using ADXTaskPaneAfterShow instead.


Andrei Smolin
Add-in Express Team Leader
Posted 12 Oct, 2015 07:42:20 Top
Igor Govorov




Posts: 83
Joined: 2014-02-12
Hey Andrei,

Thanks for you answer.

actually we are working on ADXTaskPaneBeforeShow event more than half of a year and it works fine for us,but our problem that we was working on the active window always, and we want to get rid from the false positive problems.

when I tried to change this I see that in ADXTaskPaneAfterShow event:

*) word 2010/2013 + excel 2010 - taskPane.WindowObj has a valid value and works fine.
*) excel 2013 + powerpoint 2010 - have null value in the taskPane.WindowObj.

do you have any idea how to get the correct value always?

Thank you very much.
Posted 12 Oct, 2015 09:31:52 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Igor,

Add-in Express panes heavily depend on inner details of the windowing of the corresponding Office application. For that reason, there's no universal solution that would apply to all versions of all host applications. To suggest a solution for you, I would need to know the goal: do you need to control the visibility of the form depending on the document? Or you only need to change the state of the controls shown on the form depending on the document?


Andrei Smolin
Add-in Express Team Leader
Posted 12 Oct, 2015 10:13:45 Top
Igor Govorov




Posts: 83
Joined: 2014-02-12
Hi Andrei,

What we do is show a classification taskpane per document
If the document is not classified we do not show the taskpane.
So yes, we must work in the ADXTaskPaneBeforeShow event.

All what we need is to be able to get or find the corresponding document to the taskpane of that ADXTaskPaneBeforeShow event.

We have implemented the approach you've recommended in this thread:
https://www.add-in-express.com/forum/read.php?FID=5&TID=11720
This approach tries to "match" a document by comparing the window handle.
But it is not applicable to Office 2010 and 2007.

If you can advise an approach that will work it'll be great!
Thanks!
Posted 12 Oct, 2015 12:37:36 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Igor,

We will prepare and send you a project demonstrating a way to achieve this.


Andrei Smolin
Add-in Express Team Leader
Posted 13 Oct, 2015 10:55:07 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Actually, the project is ready and I've just sent you an email with a download link for it. Please let me know if it works for you.


Andrei Smolin
Add-in Express Team Leader
Posted 13 Oct, 2015 11:11:25 Top