Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/03/2024 in all areas

  1. Anybody could help with using QueryInterface in AutoIt to embed Microsoft Edge using WebView2 Interface ? Here are links to information/documentation: Image comes from: https://docs.microsoft.com/en-us/microsoft-edge/webview2/media/webview2/whatwebview.png Introduction to Microsoft Edge WebView2 https://docs.microsoft.com/en-us/microsoft-edge/webview2/ Understand WebView2 SDK versions https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/versioning Download: https://developer.microsoft.com/en-US/microsoft-edge/webview2/ https://developer.microsoft.com/en-US/microsoft-edge/webview2/#download-section https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution API Reference: https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/?view=webview2-1.0.622.22 HowTo/Concepts: https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/versioning https://docs.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/win32 https://docs.microsoft.com/en-us/microsoft-edge/webview2/howto/debug?tabs=devtools https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/security https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/userdatafolder https://mybuild.microsoft.com/sessions/9198aeac-0c8e-4d32-96d1-cbb99a390aa6 Example: https://github.com/MicrosoftEdge/WebView2Samples Related: https://www.essentialobjects.com/Products/WebBrowser/Default.aspx?gclid=CjwKCAiA17P9BRB2EiwAMvwNyMe6UI9VHej-JYDBUoyGDFz40KaaJ_RidY-75Fhr-PHz65sSVC0XlxoC5loQAvD_BwE https://docs.microsoft.com/en-us/microsoft-edge/webview2/howto/webdriver btw. I'm not WindowsApi expert (QueryInterface, C++, DllCall). What I trying to say is: It means that I do not done anything in this regards .... as so far. TIMELINE/ChangeLog: 2020-11-12 - Project propsed by @mLipok 2021-02-03 - First version provided by @LarsJ
    1 point
  2. Sven, I would like to thank you for your support, It worked and I started (slowly) to get the basic, pls, keep this thread alive because I will need help for sure. See you soon Marco
    1 point
  3. Vacation mode. Till monday trying to be offline.
    1 point
  4. Try it: #include <Clipboard.au3> #include <IE.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> ;Coded by UEZ 2011 - beta version If @OSBuild < 6000 Then Exit MsgBox(16, "Error!", "Script is running only on Vista+ os properly!", 10) ;https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/general-info/ee330730(v=vs.85) RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", @ScriptName) If @error Then RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", @ScriptName, "REG_DWORD", 11001) Global Const $hDwmApiDll = DllOpen("dwmapi.dll") Global $sChkAero = DllStructCreate("int;") DllCall($hDwmApiDll, "int", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($sChkAero)) Global $aero = DllStructGetData($sChkAero, 1) DllClose($hDwmApiDll) If Not $aero Then Exit MsgBox(16, "Error", "Aero must be enabled to grab web sites properly!", 20) $sChkAero = 0 Global $URL, $btn, $msg, $hWnd, $input, $i $hWnd = GUICreate("Save Web Page as an image", 320, 120) $input = GUICtrlCreateInput("https://focus.de", 10, 5, 300, 20) $btn = GUICtrlCreateButton("Ok", 40, 35, 240, 70) ControlFocus($hWnd, "", $btn) GUISetState() While $msg <> -3 $msg = GUIGetMsg() Select Case $msg = $btn Start() Case $msg = -3 GUIDelete($hWnd) Exit EndSelect WEnd Func Start() $URL = GUICtrlRead($input) SplashTextOn("Screenshooting Web Site", "Please wait while taking screenshot", 300, 40, -1, -1, 1 + 2 + 4 + 32, "") AdlibRegister("Wait", 300) Web_Screenshot($URL) AdlibUnRegister("Wait") SplashOff() MsgBox(0, "Information", "Web Site Image copied to clipboard!", 10) EndFunc Func Web_Screenshot($url, $IEwidth = 1045) Local $oIE, $GUIActiveX, $oDocument, $oBody, $BodyWidth, $BodyHeight, $oHtml Local $hGUI_WebGrab, $hWin, $aWin, $aMP Local Const $BrowserNavConstant = 2 + 256 + 2048 ;BrowserNavConstant -> http://msdn.microsoft.com/en-us/library/dd565688(v=vs.85).aspx $oIE = ObjCreate("Shell.Explorer.2") ;http://msdn.microsoft.com/en-us/library/aa752084(v=vs.85).aspx $hWin = WinGetHandle("Program Manager") $aWin = WinGetPos($hWin) #region render web site to get height $hGUI_WebGrab = GUICreate("", 0, 0, $aWin[0] - $BodyWidth + 1, $aWin[1] - $BodyHeight + 1, BitOR($WS_CLIPSIBLINGS, $WS_CLIPCHILDREN, $WS_POPUP),Default, WinGetHandle(AutoItWinGetTitle())) ;~ $hGUI_WebGrab = GUICreate("", 1024, 768, 0, 0, BitOR($WS_CLIPSIBLINGS, $WS_CLIPCHILDREN, $WS_POPUP),Default, WinGetHandle(AutoItWinGetTitle())) $GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, $IEwidth, 256) GUISetState(@SW_MINIMIZE, $hGUI_WebGrab) ;~ GUISetState(@SW_SHOW, $hGUI_WebGrab) Local $timeout = 30 * 1000 Local $timer = TimerInit() With $oIE .Silent = True .FullScreen = True .Resizable = False .Visible = False .StatusBar = False .AddressBar = False .Navigate($URL, $BrowserNavConstant, "_top") Do If TimerDiff($timer) > $timeout Then ExitLoop Sleep(100) Until $oIE.ReadyState = 4 .Stop Sleep(500) EndWith $oDocument = $oIE.document $oBody = $oDocument.body $oBody.scroll = "no" $oBody.style.borderStyle = "none" $BodyWidth = $oBody.scrollWidth ;Min($oBody.scrollWidth, 4096) $BodyHeight = $oBody.scrollHeight ;Min($oBody.scrollHeight, 8192) GUIDelete($hGUI_WebGrab) $GUIActiveX = 0 #endregion Local $IE_Ver = RegRead("HKLM\SOFTWARE\Microsoft\Internet Explorer", "Version"), $height ;~ If $IE_Ver > 8 Then $BodyHeight = Min($BodyHeight, 8192) ;~ ConsoleWrite($oIE.Path & @CRLF) ;~ $hGUI_WebGrab = GUICreate("", $BodyWidth, $BodyHeight, $aWin[0] - $BodyWidth + 10, $aWin[1] - $BodyHeight + 10, BitOR($WS_CLIPSIBLINGS, $WS_CLIPCHILDREN, $WS_POPUP), Default, WinGetHandle(AutoItWinGetTitle())) $hGUI_WebGrab = GUICreate("", $BodyWidth, $BodyHeight, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) GUISetState(@SW_SHOW, $hGUI_WebGrab) ;Show GUI for some milli seconds to make a screenshot $GUIActiveX = GUICtrlCreateObj ($oIE, 0, 0, $BodyWidth, $BodyHeight) $timer = TimerInit() With $oIE .Silent = True .FullScreen = True .Resizable = False .Visible = False .StatusBar = False .AddressBar = False .Navigate($URL, $BrowserNavConstant, "_top") Do If TimerDiff($timer) > $timeout Then ExitLoop Sleep(100) Until $oIE.ReadyState = 4 .Stop Sleep(1000) EndWith $oDocument = $oIE.document $oBody =$oDocument.body $oHtml = $oDocument.documentElement $oBody.scroll = "no" $oBody.style.borderStyle = "none" $oBody.style.border = "0px" $oHtml.style.overflow = 'hidden' GUISetState(@SW_SHOW, $hGUI_WebGrab) ;Show GUI Local $hDC = _WinAPI_GetWindowDC($hGUI_WebGrab) Local $hDC_Dummy = _WinAPI_GetWindowDC(0) Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC_Dummy) Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC_Dummy, $BodyWidth, $BodyHeight) ;~ Local $tBIV5HDR = DllStructCreate($tagBITMAPINFOHEADER) ;~ DllStructSetData($tBIV5HDR, 'biSize', DllStructGetSize($tBIV5HDR)) ;~ DllStructSetData($tBIV5HDR, 'biWidth', $BodyWidth) ;~ DllStructSetData($tBIV5HDR, 'biHeight', -$BodyHeight) ;~ DllStructSetData($tBIV5HDR, 'biPlanes', 1) ;~ DllStructSetData($tBIV5HDR, 'biBitCount', 32) ;~ DllStructSetData($tBIV5HDR, 'biCompression', $BI_RGB) ;~ Local $pBits ;~ Local $hBitmap = _WinAPI_CreateDIBSection(0, $tBIV5HDR, $DIB_RGB_COLORS, $pBits) _WinAPI_SelectObject($hMemDC, $hBitmap) _WinAPI_BitBlt($hMemDC, 0, 0, $BodyWidth, $BodyHeight, $hDC, 0, 0, $SRCCOPY) ;ConsoleWrite(_WinAPI_StretchDIBits($hMemDC, 0, 0, $BodyWidth, $BodyHeight, 0, 0, $BodyWidth, $BodyHeight, $tBIV5HDR, $DIB_RGB_COLORS, $pBits, $SRCCOPY) & @CRLF) _WinAPI_DeleteDC($hMemDC) _WinAPI_ReleaseDC($hGUI_WebGrab, $hDC) _WinAPI_ReleaseDC(0, $hDC_Dummy) _WinAPI_ReleaseDC(0, $hDC) _ClipBoard_Open(0) _ClipBoard_Empty() _ClipBoard_SetDataEx($hBitmap, $CF_BITMAP) _ClipBoard_Close() _WinAPI_DeleteObject ($hBitmap) $GUIActiveX = 0 $oIE = 0 GUIDelete($hGUI_WebGrab) _ReduceMemory() EndFunc Func Min($a, $b) If $a < $b Then Return $a Return $b EndFunc Func Wait() Switch Mod($i, 4) Case 0 ControlSetText("Screenshooting Web Site", "", "Static1", "Please wait while taking screenshot") Case 1 ControlSetText("Screenshooting Web Site", "", "Static1", "Please wait while taking screenshot .") Case 2 ControlSetText("Screenshooting Web Site", "", "Static1", "Please wait while taking screenshot ..") Case 3 ControlSetText("Screenshooting Web Site", "", "Static1", "Please wait while taking screenshot ...") EndSwitch $i += 1 EndFunc Func _ReduceMemory($ProcID = 0) If $ProcID = 0 or ProcessExists($ProcID) = 0 Then ; No process id specified or process doesn't exist - use current process instead. Local $ai_GetCurrentProcess = DllCall('kernel32.dll', 'ptr', 'GetCurrentProcess') Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'ptr', $ai_GetCurrentProcess[0]) Return $ai_Return[0] EndIf Local $ai_Handle = DllCall("kernel32.dll", 'ptr', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $ProcID) Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'ptr', $ai_Handle[0]) DllCall('kernel32.dll', 'int', 'CloseHandle', 'ptr', $ai_Handle[0]) Return $ai_Return[0] EndFunc It works but result is not good because based on IE engine.
    1 point
  5. Summary of the Getting started examplesThe 7z-file at bottom of this post has been updated again. All examples have been updated to make the code a little more uniform. The Getting started version of the Scripting example has been added as WebView2-5.au3. The Communication example has been added as WebView2-6.au3. The example still doesn't work because CoreWebView2WebMessageReceivedEventHandler_Invoke() isn't called. But the example no longer crashes. The crash was caused by the CoreWebView2WebMessageReceivedEventHandlerDelete() function in the cleanup section immediately after the main loop. This code line has been deleted.
    1 point
×
×
  • Create New...