I'm trying to create a magnification program for accessibility purposes. I want this magnification program to magnify the desktop but also display a docked application that doesn't get magnified.
To achieve this I create a TopMost Form set to Maximized and Transparent. In this form i have a FlowLayoutPanel containing two Panels I've named DockedWindowPanel and MagnificationPanel.
The MagnificationPanel will be hosting the MagnificationWindow and the DockedWindowPanel will host the application I would like to dock. In this example I want to dock Notepad.exe.
private void DockApplication()
var dockedProcess = Process.Start("notepad.exe");
NativeMethods.GetWindowLong(dockedProcess.MainWindowHandle, (int)GWL.GWL_STYLE) & (int)~WindowStyles.WS_CAPTION & (int)~WindowStyles.WS_THICKFRAME);
NativeMethods.SetWindowPos(dockedProcess.MainWindowHandle, IntPtr.Zero, 0, 0, DockedWindowPanel.Width, DockedWindowPanel.Height, (int)SetWindowPosFlags.SWP_NOZORDER | (int)SetWindowPosFlags.SWP_NOACTIVATE);
and this process goes very smoothly and docks the application correctly.
However, when i set the requestedExecutionLevel to requireAdministrator and uiAccess to true and place the executable in C:\Program Files and sign it, it will not dock correctly anymore. It will instead dock it to the desktop and not my application.
Below is a screenshot taken with UiAccess=false
Below is a screnshot with UiAccess=true
As you can see, with UiAccess=true, SetParent will not dock onto my application anymore. Is there a workaround or fix for this?
I've added the solution to GitHub.
Thank you for taking your time to read this.