Hooking into CustomTaskPane window RRS feed

  • Question

  • Hi,

    I have trouble with controlling the size of CustomTaskPane control. It would be better to have at least MinHeight and MinWidth properties, but, unfortunately, we haven't them. Is there any possibility to hook into that window (at least get the HWND)?

    Thanks in advance.

    Friday, July 10, 2015 3:29 PM

All replies

  • Hello Hamlet,

    There is no need to use Windows API functions.

    You can handle the Resize  or SizeChanged events of the Control class, see the corresponding property of the CustomTaskPane class. And in the event handler you can set the Height/Width or Size properties back preventing the task pane from resizing.

    Friday, July 10, 2015 4:45 PM
  • Hi Eugene, 

    Thanks for reply. This can make sense, but accessing the window necessary for more customizations like removing menu.

    Friday, July 10, 2015 7:07 PM
  • Take a look at the Any way to get an HWND of a UserControl? forum thread.
    Friday, July 10, 2015 7:52 PM
  • How this thread related to my question?
    Friday, July 10, 2015 11:54 PM
  • I have already answered to your question how to implement the min height or width properties with task panes. Please see my first reply to you above.

    at least get the HWND

    I think you need to get the HWND of the task pane to use Windows API functions. Task panes are based on user controls where you can extract the required information.

    Saturday, July 11, 2015 8:38 AM
  • Hi Hamlet Hakobyan,

    As far as I know, there is a Window property in the CustomTaskPane object. And we can get the HWND from custom pane via the code below:

       CustomTaskPane ctp = this.CustomTaskPanes.Add(us1, "Hello");
                dynamic oWindow = ctp.Window;
                int a = (int)oWindow.Hwnd;
    Regards & Fei

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, July 24, 2015 6:21 AM
  • Hi Fei Xue,

    As you can see in documentation the Window property Gets the document window that the custom task pane is associated with.



    Saturday, August 8, 2015 11:37 PM