Warung Bebas

Tuesday, August 7, 2012

Tutor Cara Bikin Task Manager Di VB 6::Enaknya Download Gratis::

Langkah-langkahnya :
1. Buka VB 6
2. Bikin 2 buah Command (Kill & Refresh) Jangan tanya masangnya gimana ya?
3. Copas Code Ini di Form..... Caranya Klick Kanan => View Code
Const TH32CS_SNAPPROCESS = &H2
Const TH32CS_SNAPTHREAD = &H4
Const TH32CS_SNAPMODULE = &H8
Const TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST Or TH32CS_SNAPPROCESS Or TH32CS_SNAPTHREAD Or TH32CS_SNAPMODULE)
Const TH32CS_INHERIT = &H80000000
Const MAX_PATH As Integer = 260
Private Type PROCESSENTRY32
    dwSize As Long
    cntUsage As Long
    th32ProcessID As Long
    th32DefaultHeapID As Long
    th32ModuleID As Long
    cntThreads As Long
    th32ParentProcessID As Long
    pcPriClassBase As Long
    dwFlags As Long
    szExeFile As String * MAX_PATH
End Type
Private Declare Function CreateToolhelp32Snapshot Lib "Kernel32" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function Process32First Lib "Kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "Kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32.dll" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hHandle As Long) As Long
Private Const PROCESS_ALL_ACCESS = &H1F0FFF
'Enum the path
Private Const PROCESS_QUERY_INFORMATION As Long = &H400
Private Const PROCESS_VM_READ = &H10
Private Declare Function EnumProcessModules Lib "psapi.dll" ( _
    ByVal hProcess As Long, _
    ByRef lphModule As Long, _
    ByVal cb As Long, _
    ByRef cbNeeded As Long) As Long
Private Declare Function GetModuleFileNameExA Lib "psapi.dll" ( _
    ByVal hProcess As Long, _
    ByVal hModule As Long, _
    ByVal ModuleName As String, _
    ByVal nSize As Long) As Long
   
Public Function PathByPID(pid As Long) As String
    'Fungsi ini berfungsi untuk mendapatkan informasi tentang aplikasi yang sedang
    'berjalan dengan menggunakan Process ID masing-masing aplikasi
    '----
    'Kode ini dapat dilihat di :
    'http://support.microsoft.com/default.aspx?scid=kb;en-us;187913
    Dim cbNeeded As Long
    Dim Modules(1 To 200) As Long
    Dim ret As Long
    Dim ModuleName As String
    Dim nSize As Long
    Dim hProcess As Long
   
    hProcess = OpenProcess(PROCESS_QUERY_INFORMATION _
        Or PROCESS_VM_READ, 0, pid)
   
    If hProcess <> 0 Then
       
        ret = EnumProcessModules(hProcess, Modules(1), _
            200, cbNeeded)
       
        If ret <> 0 Then
            ModuleName = Space(MAX_PATH)
            nSize = 500
            ret = GetModuleFileNameExA(hProcess, _
                Modules(1), ModuleName, nSize)
            PathByPID = Left(ModuleName, ret)
        End If
    End If
   
    ret = CloseHandle(hProcess)
   
    If PathByPID = "" Then
        PathByPID = ""
    End If
   
    If Left(PathByPID, 4) = "\??\" Then
        PathByPID = ""
    End If
   

    If Left(PathByPID, 12) = "\SystemRoot\" Then
        PathByPID = ""
    End If
End Function
   
Private Sub List_Process()
    Dim lItem As ListItem
    Dim path As String
   
    Dim hSnapShot As Long, uProcess As PROCESSENTRY32

    'Memastikan agar semua List Box dalam keadaan kosong agar tidak terjadi penumpukan /duplikasi
    ListView1.ListItems.Clear
   
    hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0&)
        'Mendapatkan informasi tentang semua proses yang sedang dijalankan
    uProcess.dwSize = Len(uProcess)
    r = Process32First(hSnapShot, uProcess)
        'Mendapatkan informasi tentang proses yang pertama
    Do While r
        'perulangan selama r <> 0
        Set lItem = ListView1.ListItems.Add
        With lItem.ListSubItems
            .Add , , Left$(uProcess.szExeFile, InStr(1, uProcess.szExeFile, Chr$(0), vbTextCompare) - 1)
            .Add , , uProcess.th32ProcessID
            path = PathByPID(uProcess.th32ProcessID)
            .Add , , IIf(path <> "", path, "[Protected]")
        End With
        r = Process32Next(hSnapShot, uProcess)
            'Mendapatkan informasi dari proses selanjutnya pada windows
    Loop
    CloseHandle hSnapShot
End Sub


Private Sub cmdMatikan_Click()
    Dim processID As Long
    processID = CLng(ListView1.SelectedItem.ListSubItems(2).Text)
    TerminateProcess OpenProcess(PROCESS_ALL_ACCESS, 1, processID), 0
    Call List_Process
End Sub

Private Sub cmdRefresh_Click()
    List_Process
End Sub

Private Sub cmdTutup_Click()
    Unload Me
End Sub
Private Sub Form_Load()
Dim Wellcome As String
Wellcome = MsgBox("Task Manager Sederhana By Hackedbyme")
Wellcome = MsgBox("DC Is Our Forum ^^")
    List_Process
End Sub

Private Sub Form_Unload(Cancel As Integer)
MsgBox "Om Yakin Mau keluar?", vbQuestion + vbYesNo, "Exit Ah..!!!"
If (vbNo = True) Then
Call Form_Load
End If
End Sub

'maaf kalo tutor agak ribet :suram

Klick file => Make taskmanager.exe
5. Selesai

Belum punya VB 6 Nya?

Visual Basic 6 Portable
Visual Basic Full Version

Ini Projectnya => Project

0 comments em “Tutor Cara Bikin Task Manager Di VB 6::Enaknya Download Gratis::”

Post a Comment

 

Indahnya Berbagi Copyright © 2012 Fast Loading -- Powered by Blogger