chore(browser): sync current working implementation
Rollback tag: pre-current-browser-sync-20260818
This commit is contained in:
@@ -42,7 +42,7 @@ namespace Lskj.Control.BrowserSetting
|
||||
}
|
||||
if (BsClient != null && BsClient.frmWebBrowser != null && BsClient.frmWebBrowser.Parent != null && BsClient.frmWebBrowser.Parent.Name.Equals("previewFrm"))
|
||||
{
|
||||
BsClient.frmWebBrowser.CloseBrowser();
|
||||
browser.GetHost().CloseBrowser();
|
||||
}
|
||||
else if (BsClient != null && BsClient.frmWebBrowser != null)
|
||||
{
|
||||
@@ -196,24 +196,11 @@ namespace Lskj.Control.BrowserSetting
|
||||
try
|
||||
{
|
||||
if (browser == null) return null;
|
||||
IntPtr browserHandle;
|
||||
using (var browserHost = browser.GetHost())
|
||||
{
|
||||
browserHandle = browserHost.GetWindowHandle();
|
||||
}
|
||||
IntPtr browserHandle = browser.GetHost().GetWindowHandle();
|
||||
if (browserHandle == IntPtr.Zero) return null;
|
||||
IntPtr parentHandle = GetParent(browserHandle);
|
||||
System.Windows.Forms.Control control = null;
|
||||
while (parentHandle != IntPtr.Zero && control == null)
|
||||
{
|
||||
// The CEF child now sits inside an application-owned native
|
||||
// host. Walk through that host to preserve the original
|
||||
// FrmWebBrowser-based module lookup.
|
||||
control = System.Windows.Forms.Control.FromHandle(parentHandle);
|
||||
parentHandle = GetParent(parentHandle);
|
||||
}
|
||||
|
||||
if (control == null) return null;
|
||||
if (parentHandle == IntPtr.Zero) return null;
|
||||
System.Windows.Forms.Control control = System.Windows.Forms.Control.FromHandle(parentHandle);
|
||||
|
||||
if (control != null && control.Parent != null && control.Parent.Parent != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user