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

  • Question

  • 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
    Friday, September 14, 2018 11:22 AM

All replies

  • 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.

    • Edited by cheong00 Monday, September 17, 2018 2:20 AM
    Monday, September 17, 2018 2:20 AM
  • 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

    Monday, September 17, 2018 6:38 AM
  • 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.

    Monday, September 17, 2018 10:18 AM
  • Try test whether this.navbarchildwnd is null then. "NetUIHWND" is not a published API contract and can be changed at any time they like.
    Monday, September 17, 2018 2:24 PM