Как на vbs или bat или cmd изменить размер окна браузера?
Формулировка задачи:
Здравствуйте.
Нужен скрипт vbs для изменения уже открытого окна мазилы размером 600х800.
Нашёл код 2014г. для мазилы,не работает.
Решение задачи: «Как на vbs или bat или cmd изменить размер окна браузера?»
textual
Листинг программы
Option Explicit
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExW" (ByVal hWndParent As Long, ByVal hWndChildAfter As Long, ByVal lpClassName As Long, ByVal lpWindowName As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthW" (ByVal hWnd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextW" (ByVal hWnd As Long, ByVal lpString As Long, ByVal cch As Long) As Long
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 Sub Form_Load()
Dim hWnd As Long
Dim cbCount As Long
Dim wszBuffer As String
Do
hWnd = FindWindowEx(0, hWnd, StrPtr("MozillaWindowClass"), 0)
If hWnd = 0 Then Exit Sub
cbCount = GetWindowTextLength(hWnd)
If cbCount > 0 Then
wszBuffer = Space$(cbCount)
GetWindowText hWnd, StrPtr(wszBuffer), cbCount + 1
If InStr(1, wszBuffer, "Mozilla Firefox", vbTextCompare) > 0 Then
Exit Do
End If
End If
Debug.Assert DoEvents >= 0
Loop
MoveWindow hWnd, 100, 100, 400, 400, 1
End Sub