真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb.net遍歷進(jìn)程 vb遍歷文件夾的所有文件

vb.net中如何遍歷程序窗體中的控件?并讀寫(xiě)控件的數(shù)據(jù)。

Public?Sub?GetAllControls(ByVal?InContainer?As?Control,?ByRef?RecieveList?As?ListBox)

創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),江岸企業(yè)網(wǎng)站建設(shè),江岸品牌網(wǎng)站建設(shè),網(wǎng)站定制,江岸網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷(xiāo),網(wǎng)絡(luò)優(yōu)化,江岸網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力??沙浞譂M(mǎn)足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專(zhuān)業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶(hù)成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

For?i?As?Integer?=?0?To?InContainer.Controls.Count?-?1

If?InContainer.Controls.Item(i).Text??""?Then

GetList.Items.Add(InContainer.Controls.Item(i).Text??vbCrLf)

End?If

If?InContainer.Controls.Item(i).Controls.Count??0?Then

GetAllControls(InContainer.Controls.Item(i),?GetList)

End?If

Next

End?Sub

這段代碼可行,但不能遍歷菜單和工具欄,要按需要修改

VB關(guān)進(jìn)程

'你要關(guān)閉什么進(jìn)程

'就寫(xiě)

'Call taskkill("進(jìn)程名.exe")

'注意大小寫(xiě)啊

Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long

Private Declare Function Process32First Lib "kernel32" (ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long

Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long

Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal blnheritHandle As Long, ByVal dwAppProcessId As Long) As Long

Private Declare Function TerminateProcess Lib "kernel32" (ByVal ApphProcess As Long, ByVal uExitCode As Long) As Long

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 * 1024

End Type

Const TH32CS_SNAPHEAPLIST = H1

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

Dim pid As Long

Dim pname As String

'-------------結(jié)束進(jìn)程通用函數(shù) 注意進(jìn)程名要區(qū)分大小寫(xiě)

Private Sub taskkill(ByVal taskname As String)

Dim my As PROCESSENTRY32

Dim l As Long

Dim l1 As Long

Dim flag As Boolean

Dim mName As String

Dim i As Integer

l = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)

If l Then

my.dwSize = 1060

If (Process32First(l, my)) Then '遍歷第一個(gè)進(jìn)程

Do

i = InStr(1, my.szExeFile, Chr$(0))

mName = LCase$(Left$(my.szExeFile, i - 1))

If mName = LCase$(taskname) Then

pid = my.th32ProcessID

pname = mName

Dim mProcID As Long

mProcID = OpenProcess(1, -1, pid)

TerminateProcess mProcID, 0

flag = True

Exit Function

Else

flag = False

End If

Loop Until (Process32Next(l, my) 1) '遍歷所有進(jìn)程知道返回值為False

End If

l1 = CloseHandle(l)

End If

End Sub

Private Sub Command1_Click()

Call taskkill("NOTEPAD.EXE")

'這個(gè)是關(guān)閉記事本進(jìn)程的

End Sub

這是我回答的 復(fù)制自己回答的內(nèi)容不算復(fù)制吧?????

vb.net 遍歷正在運(yùn)行的雖有窗口和句柄

For Each i As System.Diagnostics.Process In System.Diagnostics.Process.GetProcesses

Next


分享文章:vb.net遍歷進(jìn)程 vb遍歷文件夾的所有文件
網(wǎng)頁(yè)網(wǎng)址:http://weahome.cn/article/dojjcss.html

其他資訊

在線(xiàn)咨詢(xún)

微信咨詢(xún)

電話(huà)咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部