[2.0-a130] Drag And Resize Gui WebView2 Control

Post your working scripts, libraries and tools.
xroot
Posts: 40
Joined: 21 Jun 2019, 08:45

[2.0-a130] Drag And Resize Gui WebView2 Control

05 Apr 2021, 12:23

With -Caption and +Resize Gui Object Options, how would I drag or resize the window?

Here are 3 ways.
1. Use the Gui itself. (OnMessage WM_LBUTTONDOWN and OnMessage WM_SIZE)
2. Use a Gui control. (text box with OnEvent Click and OnMessage WM_SIZE)
3. Use Javascript. (onmousedown, onmouseup, onmousemove, and onresize)

To make WebView2.ahk easy to use, "WebView2_Init" is all you need in a project to setup the WebView2 Control.
The WebView2.ahk "Globals", and "Run_JS" combinations are the things that make a project function.

The first example use these globals "NavStr,wvTop,wvRight,wvBottom".
NavStr is the basic WebView2 Control and is an HTML string.
wvTop brings the WebView2 Control down 20 leaving the Gui exposed.
wvRight and wvBottom are the width and height of the WebView2 Control you want.
If these globals "wvLeft,wvTop,wvRight,wvBottom" are not used the WebView2 Control is the size of Gui.Show options

The second example is a Gui control on WebView2 control and uses "NavStr" global.
The aqua drag ball sometimes distortes when resizing.(no biggy)

The third example use globals "NavUri,Event_Name".
NavUri is the basic WebView2 Control using a web site ("https www.google.com "). Broken Link for safety
Or You can create an HTML file, like this example which makes the url cursor on over work.
Event_Name is the connection from AHK to Javascript.

Tested with these:
Window 7 Professional Service Pack 1 64bit
AHK version = 2.0-a130-c7408b6b 64bit
Edge WebView2 Runtime version = 89.0.774.68
Edge WebView2Loader.dll version = 1.0.824.0 64bit

Please, Check it out.
WebView2.zip
(71.25 KiB) Downloaded 131 times

Return to “Scripts and Functions (v2)”

Who is online

Users browsing this forum: jiming0516, MrDoge and 16 guests