回复 19楼 shonken
其实对于windows桌面UI窗口的控件也是一个窗口,都具有窗口句柄,只是窗口样式不同。以下是引用吹水佬在2023-2-8 16:22:24的发言:
ASTACKINFO(ap)
cDefPath = ADDBS(JUSTPATH(ap[2]))
SET DEFAULT TO (cDefPath)
DECLARE long GetTopWindow IN user32 as apiGetTopWindow long
DECLARE long MoveWindow IN user32 as apiMoveWindow long,long,long,long,long,long
DECLARE long WebView_Create IN myWebViewDll long,long,long,long,long
DECLARE long WebView_Destroy IN myWebViewDll
DECLARE long WebView_Resize IN myWebViewDll
DECLARE long WebView_Navigate IN myWebViewDll string
DECLARE long WebView_GoBack IN myWebViewDll
DECLARE long WebView_GoForward IN myWebViewDll
PUBLIC hWebView
of = CREATEOBJECT("WebView2_Demo")
of.show
READ EVENTS
CLEAR ALL
RETURN
DEFINE CLASS WebView2_Demo as Form
ShowWindow = 2
WindowState = 2
ADD OBJECT cmd1 as commandbutton WITH left=10,top=10,width=20,height=22,caption="<"
ADD OBJECT cmd2 as commandbutton WITH left=30,top=10,width=20,height=22,caption=">"
ADD OBJECT txt1 as textbox WITH left=50,top=10,width=500,height=22,value="https://bbs.bccn.net/forum-22-1.html"
ADD OBJECT cmd3 as commandbutton WITH left=550,top=10,width=30,height=22,caption=">>"
PROCEDURE Destroy
WebView_Destroy()
CLEAR EVENTS
ENDPROC
PROCEDURE Activate
IF EMPTY(this.Tag)
this.Tag = "1"
hWebView = WebView_Create(apiGetTopWindow(this.hWnd), 0, 40, this.Width, this.Height-40)
ENDIF
ENDPROC
PROCEDURE Resize
apiMoveWindow(hWebView, 0, 40, this.Width, this.Height-40,1)
WebView_Resize()
ENDPROC
PROCEDURE cmd1.click
WebView_GoBack()
ENDPROC
PROCEDURE cmd2.click
WebView_GoForward()
ENDPROC
PROCEDURE cmd3.click
WebView_Navigate(STRCONV(ALLTRIM(thisform.txt1.value)+0h00,5))
ENDPROC
ENDDEFINE
ASTACKINFO(ap)
cDefPath = ADDBS(JUSTPATH(ap[2]))
SET DEFAULT TO (cDefPath)
DECLARE long GetTopWindow IN user32 as apiGetTopWindow long
DECLARE long MoveWindow IN user32 as apiMoveWindow long,long,long,long,long,long
DECLARE long WebView_Create IN myWebViewDll long,long,long,long,long
DECLARE long WebView_Destroy IN myWebViewDll
DECLARE long WebView_Resize IN myWebViewDll
DECLARE long WebView_Navigate IN myWebViewDll string
DECLARE long WebView_GoBack IN myWebViewDll
DECLARE long WebView_GoForward IN myWebViewDll
PUBLIC hWebView
of = CREATEOBJECT("WebView2_Demo")
of.show
READ EVENTS
CLEAR ALL
RETURN
DEFINE CLASS WebView2_Demo as Form
ShowWindow = 2
WindowState = 2
ADD OBJECT cmd1 as commandbutton WITH left=10,top=10,width=20,height=22,caption="<"
ADD OBJECT cmd2 as commandbutton WITH left=30,top=10,width=20,height=22,caption=">"
ADD OBJECT txt1 as textbox WITH left=50,top=10,width=500,height=22,value="https://bbs.bccn.net/forum-22-1.html"
ADD OBJECT cmd3 as commandbutton WITH left=550,top=10,width=30,height=22,caption=">>"
PROCEDURE Destroy
WebView_Destroy()
CLEAR EVENTS
ENDPROC
PROCEDURE Activate
IF EMPTY(this.Tag)
this.Tag = "1"
hWebView = WebView_Create(apiGetTopWindow(this.hWnd), 0, 40, this.Width, this.Height-40)
ENDIF
ENDPROC
PROCEDURE Resize
apiMoveWindow(hWebView, 0, 40, this.Width, this.Height-40,1)
WebView_Resize()
ENDPROC
PROCEDURE cmd1.click
WebView_GoBack()
ENDPROC
PROCEDURE cmd2.click
WebView_GoForward()
ENDPROC
PROCEDURE cmd3.click
WebView_Navigate(STRCONV(ALLTRIM(thisform.txt1.value)+0h00,5))
ENDPROC
ENDDEFINE
运行了上述程序,非常不错。请问这里如何自动填写并登录。