|
-
Mar 6th, 2002, 09:23 PM
#1
Thread Starter
Frenzied Member
Help! How can you close or minimize any windows containing "Internet Explorer"
-
Mar 6th, 2002, 10:36 PM
#2
Thread Starter
Frenzied Member
-
Mar 6th, 2002, 11:00 PM
#3
Hyperactive Member
Re: Help! How can you close or minimize any windows containing "Internet Explorer"
Originally posted by qpabani
anyone know?
is this window in u'r application?
Or is it any external window apart from u'r application?
anita
Can't imagine life without VB
(Various Boyfriends)
-
Mar 9th, 2002, 12:08 AM
#4
Thread Starter
Frenzied Member
the windows are outside my program..
im sure there was some code that would close or minimize programs based on its text..
-
Mar 9th, 2002, 12:09 AM
#5
Frenzied Member
yes, you can use the sendmessage api to change the windowstate...
Government is another way to say better…than…you.
It’s like ice but no pick, a murder charge that won’t stick,
it’s like a whole other world where you can smell the food,
but you can’t touch the silverware.
Huh, what luck. Fascism you can vote for.
Humph, isn’t that sweet?
And we’re all gonna die some day, because that’s the American way
-Stone Sour
-
Mar 9th, 2002, 04:38 PM
#6
Thread Starter
Frenzied Member
does anyone have the code?
-
Mar 9th, 2002, 04:46 PM
#7
-
Mar 9th, 2002, 05:59 PM
#8
Thread Starter
Frenzied Member
is it possible to do that without timers? that is, when a command button is click, it closes (or minimizes - depending on the button clicked) all windows if their title contains certain text?
-
Mar 9th, 2002, 07:18 PM
#9
Thread Starter
Frenzied Member
is it possible to do that without timers? that is, when a command button is click, it closes (or minimizes - depending on the button clicked) all windows if their title contains certain text?
-
Mar 9th, 2002, 07:35 PM
#10
In a Module
VB Code:
Option Explicit
Private Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function CloseWindow Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Public Sub MinimizeAllIE()
Call EnumWindows(AddressOf EnumWindowProc, 0)
End Sub
Private Function EnumWindowProc(ByVal hWnd As Long, ByVal lParam As Long) As Long
Dim sBuffer As String
sBuffer = Space(256)
sBuffer = Left(sBuffer, GetClassName(hWnd, ByVal sBuffer, 256))
If InStr(LCase(sBuffer), "ieframe") > 0 Then
Call CloseWindow(hWnd)
End If
EnumWindowProc = hWnd
End Function
In a Form
VB Code:
Option Explicit
Private Sub Command1_Click()
MinimizeAllIE
End Sub
You can alter the code to check the Windows "Caption" if you want to just target Windows with certain text in the Caption.
-
Mar 9th, 2002, 08:31 PM
#11
Thread Starter
Frenzied Member
how about other programs?
is there no way to close all windows with a certain text in their title?
-
Mar 9th, 2002, 08:34 PM
#12
You know the best way to learn is to Try some things:
VB Code:
Option Explicit
Private Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function CloseWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Sub MinimizeAllIE()
Call EnumWindows(AddressOf EnumWindowProc, 0)
End Sub
Private Function EnumWindowProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim sBuffer As String
sBuffer = Space(256)
sBuffer = Left(sBuffer, GetWindowText(hwnd, ByVal sBuffer, 256))
If InStr(LCase(sBuffer), "internet explorer") > 0 Then
Call CloseWindow(hwnd)
End If
EnumWindowProc = hwnd
End Function
-
Mar 9th, 2002, 09:55 PM
#13
Thread Starter
Frenzied Member
so far so good.. i get the hwnds of all the IE windows, however it wont close em..
call closewindow hwnd does nothing.. the window still exists 
anyone know how to close this window?
-
Jan 19th, 2003, 07:33 PM
#14
Frenzied Member
: I Know this is quite an old thread but:
I get the following error
---------------------------
Microsoft Visual Basic
---------------------------
Compile error:
Invalid use of AddressOf operator
---------------------------
OK Help
---------------------------
when i come to this with my code
VB Code:
Public Sub MinimizeAllIE()
Call EnumWindows(AddressOf EnumWindowProc, 0)
End Sub
I dont know Y Tho, i added the code above, and it dont work or dat....
-
Jan 19th, 2003, 07:39 PM
#15
-
Jan 20th, 2003, 08:10 PM
#16
Frenzied Member
yeah, it was... & I tried it in the form too [just in case] and it's the same error.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|