I am trying to embed Google Chrome in panel1 using Process.Start funciton in Csharp Winform project.
I come across some weired behavour using SetWindowPos.
The code works perfectly in Windows 8.1 but it works with error in Windows 10.
In windows 10 and laptop, the embedded chrome is covered with some black backround in right and bottom sides.
I tried with some different parameters with hWndInsertAfter and uFlags in SetWindowPos.
However, they do not work.
Does anyone know what causes this black coverage over the embedded process and possible fix for this issue ?
Please have a look at the screenshot uploaded for better understanding of the problem.
SetWindowPos Error Image[
^]
Depending on the monitor size, it works sometimes and it does not work sometimes. I need to see the vertical scroll bar from chrome. Black coverage like above is hiding the vertical scroll bar, I guess.
How to see the vertical scroll bar again regardless of the monitor screen size ?
What I have tried:
var rect = new User32.Rect();
foreach (Process proc in procs)
{
User32.GetWindowRect(proc.MainWindowHandle, ref rect);
width = rect.right - rect.left;
height = rect.bottom - rect.top;
if (width != 0 && height != 0)
{
SetParent(process.MainWindowHandle, panel1.Handle);
process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
SetForegroundWindow(process.MainWindowHandle);
SetWindowPos(process.MainWindowHandle, 0, 0, 0, panel1.Width, panel1.Height, 0);
break;
}
}