如何控制用SHELL.EXPLORER.2控件在表单上显示的页面上的链接被点击后弹出新的IE窗口的一些属性?比如窗口最大化还是最小化等
现在点击表单上网页上的链接新弹出的新的IE窗口,不知道如何对新IE窗口进行一些控制,比如现在新窗口默认不是最大化,还得客户点击最大化按钮,这个不方便。
那如何实现点击表单上网页上的链接时打开一个新的表单用于显示链接所对应的网页呢?
是在PROCEDURE WB.NewWindow3中鼓捣吗?
我试了试,会在新的表单中打开一个网页,但是,不是显示书本的内容网页,是一个其它网页,不知道哪里问题。
全部代码如下:
PUBLIC of
of = CREATEOBJECT("webForm","https://tjebook.)
of.visible=.t.
READ events
RETURN
DEFINE CLASS webForm AS Form
alwaysontop=.f.
ShowWindow = 2
WindowState = 2
WindowType=1
autocenter=.t.
borderstyle=0
maxbutton=.f.
minbutton=.f.
width=8000
height=6000
LwebLoaded=.f.
caption='互动式同步课本'
ADD OBJECT WB AS Olecontrol WITH Width=this.width,Height=this.height,Anchor=15,OleClass="Shell.Explorer.2",Visible=.T.
ADD OBJECT tmrlogin as timer with interval=100,enabled=.t.
PROCEDURE tmrlogin.timer
IF this.Parent.lWebLoaded
this.Enabled=.f.
this.Parent.wb.width=this.Parent.width
this.Parent.wb.height=this.Parent.height
this.Parent.mLogin
endif
ENDPROC
PROCEDURE Init
PARAMETERS cUrl,lOnTop
this.WB.Silent = .T.
this.WB.Navigate(cUrl)
ENDPROC
PROCEDURE unload
CLEAR EVENTS
ENDPROC
PROCEDURE mLogin
mykeybd(0x09)
mykeybd(0x09)
mykeybd(0x09)
mykeybd(0x09)
_cliptext=''
IF FILE('点读账号.txt')
_cliptext=FILETOSTR('点读账号.txt')
IF ';'$_cliptext
_cliptext=LEFT(_cliptext,AT(';',_cliptext)-1)
ENDIF
ENDIF
IF EMPTY(_cliptext)
_cliptext='Feimengjie847@'
ENDIF
DO ctrlV
mykeybd(0x09)
mykeybd(0x09)
DO ctrlV
mykeybd(13)
ENDPROC
PROCEDURE tmrlogin.init
this.interval=this.Parent.idelay()
ENDPROC
PROCEDURE WB.documentComplete(pdisp, url)
IF (SYS(3095, pdisp) == SYS(3095, this))
this.parent.lWebLoaded=.t.
ENDIF
ENDPROC
PROCEDURE wb.NewWindow3(ppdisp, cancel, dwflags, bstrurlcontext, bstrurl)
CANCEL =.f.
PUBLIC oNewWeb
oNewWeb = CREATEOBJECT("webForm",bstrurl)
ppdisp=oNewWeb
oNewWeb.visible=.t.
ENDPROC
*!* PROCEDURE WB.NewWindow3(ppdisp, cancel, dwflags, bstrurlcontext, bstrurl) &&吹版奉献代码,防止点击WEB页面上链接时打开IE窗口,使内容依旧显示在表单的WEB界面上。
*!* cancel = .T. && 禁止新窗口
*!* ppdisp = this && 在当前窗口打开
*!* **IF (dwFlags == 6)
*!* this.Navigate(bstrurl)
*!* this.SetFocus
*!* **ENDIF
*!* ENDPROC
PROCEDURE iDelay
LOCAL cLogMsg
IF FILE('点读账号.txt')
cLogMsg=FILETOSTR('点读账号.txt')
IF ';'$cLogMsg
RETURN VAL(SUBSTR(cLogMsg,AT(';',cLogMsg)+1))*1000
ELSE
RETURN 1000
ENDIF
ELSE
RETURN 1000
ENDIF
ENDPROC
ENDDEFINE
FUNCTION mykeybd(Virtual_Key as Integer)
PRIVATE Virtual_Key &&键盘虚拟值,请参阅列表。
DECLARE keybd_event IN user32; &&键盘模拟API
SHORT bVk,; &&表示虚拟键值,其取值范围为1-254。
SHORT bScan,; &&该值为0
INTEGER dwFlags,; &&0按下,2弹起
INTEGER dwExtraInfo &&关于操作的附加说明,一般为0
DECLARE INTEGER MapVirtualKey IN user32;
INTEGER VK,;
INTEGER VI
DECLARE Sleep IN kernel32 INTEGER dwMilliseconds
= keybd_event(Virtual_Key, MapVirtualKey(Virtual_Key,0), 0, 0)
sleep(100)&&按键延时
= keybd_event(Virtual_Key, MapVirtualKey(Virtual_Key,0), 2, 0)
ENDFUNC
PROCEDURE ctrlV
Declare keybd_event In Win32API Short bVk,Short bScan,Integer dwFlags, Integer deExtraInfo
keybd_event(17, 0, 0, 0)
keybd_event(Asc('V'), 0, 0, 0)
keybd_event(Asc('V'), 0, 2, 0)
keybd_event(17, 0, 2, 0)
ENDPROC