Win32.SetParent( hWndChild, hWndNewParent ) not working as expected after office update


  • After updating Office 365 to Build 1808, one of my office add-in control doesn't sit on outlook window. Rather it sits on the desktop. I did some research, looks like Win32 call SetParent(   HWND hWndChild,   HWND hWndNewParent ) is not working as expected. Any help would be really appreciated
    Jumat, 14 September 2018 11.22

Semua Balasan

  • Or probably the "target window" name/caption has changed during the update, so your FindWindow()/FindWindowEx() can't find a matching window and returns NULL.

    Try setting parent with NULL handle ends on Desktop instead.

    • Diedit oleh cheong00 Senin, 17 September 2018 02.20
    Senin, 17 September 2018 02.20
  • Hi agarwal.harsh3,

    Thank you for posting here.

    For your question, does the office add-in control sit on outlook well before update? If yes, maybe the update conflict with your office add-in control. Try to uninstall the update and use the old version.

    You could get further help from Outlook for development forum.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Senin, 17 September 2018 06.38
  • Thanks cheong00, Actually it does return a not null value. below is the code that I use to get the target window

     this.mainwnd = Win32.FindWindow("rctrl_renwnd32", _caption);

    _outlookMainSytemWindow = new SystemWindow(mainwnd);

    var hWndParentNavPaneSystemWindow = _outlookMainSytemWindow.FilterDescendantWindows(true, w => w.Title == "NUIDocumentWindow").First();

    this.navbarwnd  = hWndParentNavPaneSystemWindow.HWnd;

    var hWndWunderBarsystemWindow = hWndParentNavPaneSystemWindow.FilterDescendantWindows(true, w => w.ClassName == "NetUIHWND").First();

    this.navbarchildwnd = hWndWunderBarsystemWindow.HWnd;

    where _caption is the name of my outlook window.

    Senin, 17 September 2018 10.18
  • Try test whether this.navbarchildwnd is null then. "NetUIHWND" is not a published API contract and can be changed at any time they like.
    Senin, 17 September 2018 14.24