İstediğini kapat!
Aşağıdaki kodları kullanarak seçilen pencereyi kapatan bir program yapabilirsiniz.
Form kodları
---------------------
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5340
ClientLeft = 60
ClientTop = 345
ClientWidth = 10470
LinkTopic = "Form1"
ScaleHeight = 5340
ScaleWidth = 10470
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "Seçileni kapat"
Height = 615
Left = 4388
TabIndex = 1
Top = 4560
Width = 1695
End
Begin VB.Timer Timer1
Interval = 15000
Left = 8160
Top = 1680
End
Begin MSComctlLib.ListView lvItems
Height = 4215
Left = 360
TabIndex = 0
Top = 120
Width = 9855
_ExtentX = 17383
_ExtentY = 7435
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = 0 'False
FullRowSelect = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 2
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "Pencere kodu"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "Pencere adı"
Object.Width = 8819
EndProperty
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
CloseWindow (lvItems.SelectedItem.Text)
Timer1_Timer
End Sub
Private Sub Form_Load()
Timer1_Timer
End Sub
Private Sub Timer1_Timer()
Dim lCount As Long
Dim lVal As Long
Dim wText As String * 255
Dim lvItem As ListItem
lvItems.ListItems.Clear
For lCount = 0 To 65535
lVal = GetWindowText(lCount, wText, 255)
If lVal <> 0 Then
Set lvItem = lvItems.ListItems.Add
lvItem.Text = lCount
lvItem.SubItems(1) = wText
End If
Next
End Sub
Yukarıdaki kodları not defterine kayıt edip form1.frm olarak kayıt edin.
Modül kodları
--------------------------
Attribute VB_Name = "Module1"
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function CloseWindow Lib "user32" (ByVal hwnd As Long) As Long
Yukarıdaki kodları Module1.bas olarak kayıt edin.
Proje kodları
----------------------------
Type=Exe
Form=Form1.frm
Reference=*G{00020430-0000-0000-C000-000000000046}#2.0#0#........WINDOWSsystem32stdole2.tlb#OLE Automation
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; mscomctl.ocx
Module=Module1; Module1.bas
IconForm="Form1"
Startup="Form1"
ExeName32="Project1.exe"
Command32=""
Name="Project1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="Hus©2004"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
[MS Transaction Server]
AutoRefresh=1
Yukarıdaki kodları note defterine yapıştırıp Project1.vbp olarak kayıt edin.