vb6 - How to open/switch to a process in task manager -
i tried google-ing results ending process... want switch vb application process...
i'm using appactivate program title name not unique i'm getting error... can use * sign?
appactivate statement
activates application window.
syntax
appactivate title[, wait]
the appactivate statement syntax has these named arguments:
part description title required. string expression specifying title in title bar of application window want activate. the task id returned shell function can used in place of title activate application.
use wmi pid or toolhelper library.
private declare function process32next lib "kernel32" (byval hsnapshot long, lppe processentry32) long private declare function closehandle lib "kernel32.dll" (byval handle long) long private declare function process32first lib "kernel32" (byval hsnapshot long, lppe processentry32) long private declare function createtoolhelp32snapshot lib "kernel32" (byval dwflags long, byval th32processid long) long private declare function getversionexa lib "kernel32" _ (lpversioninformation osversioninfo) integer private type processentry32 dwsize long cntusage long th32processid long ' process th32defaultheapid long th32moduleid long ' associated exe cntthreads long th32parentprocessid long ' process's parent process pcpriclassbase long ' base priority of process threads dwflags long szexefile string * 260 ' max_path end type private type osversioninfo dwosversioninfosize long dwmajorversion long dwminorversion long dwbuildnumber long dwplatformid long '1 = windows 95 2 = windows nt szcsdversion string * 128 end type private const process_query_information = 1024 private const process_vm_read = 16 private const max_path = 260 private const standard_rights_required = &hf0000 private const synchronize = &h100000 'standard_rights_required or synchronize or &hfff private const process_all_access = &h1f0fff private const th32cs_snapprocess = &h2& private const hnull = 0 private const gw_child = 5 private const gw_hwndnext = 2 sub mnuinsertprocesslist_click() dim f long, sname string, plist string, ret long dim hsnap long, proc processentry32 hsnap = createtoolhelp32snapshot(th32cs_snapprocess, 0) if hsnap = hnull exit sub proc.dwsize = lenb(proc) ' iterate through processes txtnote.seltext = "pid:int" & vbtab & "parentpid:int" & vbtab & "exename:string" & vbcrlf f = process32first(hsnap, proc) sname = strztostr(proc.szexefile) txtnote.seltext = proc.th32processid txtnote.seltext = vbtab txtnote.seltext = proc.th32parentprocessid txtnote.seltext = vbtab txtnote.seltext = sname txtnote.seltext = vbcrlf f = process32next(hsnap, proc) loop while f = 1 ret = closehandle(hsnap) if ret = 0 msgbox err.lastdllerror end sub
Comments
Post a Comment