_IECreateEmbedded函数使用问题【已解决】
本帖最后由 mikezunya 于 2019-9-22 17:05 编辑请教,为什么_IECreateEmbedded函数、GUICtrlCreateObj函数使用后,用_IENavigate打开浏览器,然后在该浏览器下发现Del、←删除键,Ctrl+C 用不了?这是为什么?有没有人遇到过
版主可以把这个帖子删除掉了,已经解决了。其实用一楼的那个办法也可以。
看看这个示例
#include <ie.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiEdit.au3>
#include <ScrollBarConstants.au3>
#include <WinAPI.au3>
$WinMain = GUICreate("hello", 510, 510)
$MainMsgBoardInput = _GUICtrlEdit_Create($WinMain, "", 5, 450, 498, 21, BitOR($ES_MULTILINE, $ES_WANTRETURN,$ES_AUTOVSCROLL))
$oMainIE = _IECreateEmbedded()
GUICtrlCreateObj($oMainIE, 1, 1, 498, 435)
$backspace = GUICtrlCreateDummy()
Dim $AccelKeys = [["{BACKSPACE}", $backspace]]
GUISetAccelerators($AccelKeys, $WinMain)
_IENavigate($oMainIE, "about:blank")
GUISetState(@SW_SHOW)
While 1
$mMsg = GUIGetMsg()
Switch $mMsg
Case $backspace
If _WinAPI_GetFocus() = $MainMsgBoardInput Then
$out = _GUICtrlEdit_GetText($MainMsgBoardInput)
_GUICtrlEdit_SetText($MainMsgBoardInput, StringTrimRight($out, 1))
_GUICtrlEdit_SetPos($MainMsgBoardInput, -1, -1)
EndIf
Case -3
Exit
EndSwitch
WEnd
Func _GUICtrlEdit_SetPos($hWnd, $iLine, $iColumn = 0)
If Not IsHWnd($hWnd) Then
$hWnd = GUICtrlGetHandle($hWnd)
If $hWnd = 0 Then
Return SetError(1, 0, 0)
EndIf
EndIf
Local $Lenght, $Num = 0, $Count = _GUICtrlEdit_GetLineCount($hWnd)
If $iLine > $Count - 1 Then
$Num = _GUICtrlEdit_GetTextLen($hWnd)
Else
If $iLine < 0 Then
$iLine = $Count - 1
EndIf
For $i = 0 To $iLine - 1
$Num += _GUICtrlEdit_LineLength($hWnd, $i) + 2 ; + @CR + @LF
Next
$Lenght = _GUICtrlEdit_LineLength($hWnd, $iLine)
If ($iColumn < 0) Or ($iColumn > $Lenght) Then
$iColumn = $Lenght
EndIf
$Num += $iColumn
EndIf
_GUICtrlEdit_SetSel($hWnd, $Num, $Num)
_GUICtrlEdit_Scroll($hWnd, $SB_SCROLLCARET)
Return 1
EndFunc ;==>_GUICtrlEdit_SetPos
本帖最后由 mikezunya 于 2019-9-22 17:04 编辑
zghwelcome 发表于 2019-9-21 17:55
看看这个示例
非常感谢这位大神热心回帖,是我自己代码写的有问题
本帖最后由 mikezunya 于 2019-9-22 17:04 编辑
是我自己代码写的问题
页:
[1]