Thank you I wasn't aware about know this one.
Injected C LR dialog needs to position and resize itself properly on the screen just where the native MSI UI dialog was before proceeding to the CLR dialog by clicking
Making the default algorithm more sophisticated can be a difficult time consuming exercise. However making it work for a specific scenario like yours is relatively simple. You will need to implement your own algorithm of finding the window. For that you need to overwrite the GetMsiForegroundWindow method of WixCLRDialog:
In this case I assumed that your main msi (setup) window has title "natka setup";
Injected C LR dialog needs to position and resize itself properly on the screen just where the native MSI UI dialog was before proceeding to the CLR dialog by clicking
Next
button. The vital part of this positioning is to find the handle of the main Window of the msi process. The default algorithm works well but I guess it fails when the msi process is elevated because of the InstallScope.perMachine. Making the default algorithm more sophisticated can be a difficult time consuming exercise. However making it work for a specific scenario like yours is relatively simple. You will need to implement your own algorithm of finding the window. For that you need to overwrite the GetMsiForegroundWindow method of WixCLRDialog:
protectedoverride IntPtr GetMsiForegroundWindow() { var handle = base.GetMsiForegroundWindow(); if (handle == IntPtr.Zero) handle = Win32.FindWindow(null, "natka setup"); return handle; }