如何来改变ie界面位置~用vb的
如何得到应用程序在屏幕窗口的位置(用VB来实现)如我在操作系统98/2000中打开IE,就会弹出IE界面。我如何知道IE界面在屏幕的位置?并且如何改变IE界面在屏幕的位置?
如用API函数 最好有实例
谢谢! --------------------编程问答-------------------- 用BHO不错呀,配合 GetWindowRect MoveWindow 就可以了 --------------------编程问答-------------------- 帮顶. --------------------编程问答-------------------- 我现在用的是SetWindowPlacement 可是没什么效果??
“SupermanKing”
最好是有实际的例子来看看~~ --------------------编程问答-------------------- 你自己查一下BHO的资料,先搞懂BHO就知道怎么弄了
用BHO技术可以得到整个IE窗口的对象,
有了对象就有hwnd属性,
有了hwnd属性不就可以MoveWindow了吗 --------------------编程问答-------------------- 实在是 不知道 BHO插件怎么用,
看不太明白,,
有没有具体的 例子让我看看吗?
我对这些window编程不是太行。
--------------------编程问答-------------------- 看来BHO对于你来说可能复杂点了,
那么你用遍历的方式遍历出所有的IE窗口对象
再用API取得当前活动窗口句柄
再与遍历出的IE对象的窗口句柄作比较
判断出当前IE对象后再用API来控制把,这样可能容易点 --------------------编程问答-------------------- 1 LABEL1, 4 LABEL2,4 LABEL3,4 TEXT1,1 Command,1 TIMER
Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Dim hIEFrame As Long
Private Sub Command1_Click()
Dim IEX As Long, IEY As Long, IEW As Long, IEH As Long
'查找IE句柄
hIEFrame = FindWindow("IEFrame", "about:blank - Microsoft Internet Explorer") '
On Error Resume Next
IEX = Text1(0).Text
IEY = Text1(1).Text
IEW = Text1(3).Text
IEH = Text1(4).Text
MoveWindow hIEFrame, IEX, IEY, IEW, IEW, 1 '移动IE
End If
End Sub
Private Sub Form_Load()
Timer1.Enabled = True
Command1.Caption = "移动窗口"
Label3(0).Caption = "左:" '对应text1(0),下面类推
Label3(1).Caption = "上:"
Label3(2).Caption = "新高度:"
Label3(3).Caption = "新宽度:"
End Sub
Private Sub Timer1_Timer()
Dim IErect As RECT
hIEFrame = FindWindow("IEFrame", "about:blank - Microsoft Internet Explorer") '查找IE句柄
If hIEFrame = 0 Then
Label1.Caption = "未打开IE窗口"
Else
Label1.Caption = "IE窗口已打开"
GetWindowRect hIEFrame, IErect '取得IE窗口RECT
Label2(0).Caption = "上:" & IErect.Top
Label2(1).Caption = "下:" & IErect.Bottom
Label2(2).Caption = "左:" & IErect.Left
Label2(3).Caption = "右:" & IErect.Right
End If
End Sub
--------------------编程问答-------------------- 上面API申明少了~
'查找句柄
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
'获得整个窗口的范围矩形
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
补充:VB , API