如何用vb检测某程序是否在运行?

如何用vb检测某程序是否在运行?,第1张

检测某程序是需要检测进程吧,FindWindow是查找窗口...别人把窗口隐藏了你找什么去~~~~~

先把找进程的贴出来,再贴查版本的....

进程查找:(我是把代码全搬出来了,有些其他你不要的函数自己清理下)

(模块)

声明:

'进程-查找

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

Private Const TH32CS_SNAPHEAPLIST = &H1

Private Const TH32CS_SNAPPROCESS = &H2

Private Const TH32CS_SNAPTHREAD = &H4

Private Const TH32CS_SNAPMODULE = &H8

Private Const TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST Or TH32CS_SNAPPROCESS Or TH32CS_SNAPTHREAD Or TH32CS_SNAPMODULE)

Private Const TH32CS_INHERIT = &H80000000

Private Declare Function RegisterWindowMessage Lib "user32" Alias "RegisterWindowMessageA" (ByVal lpString As String) As Long

Private WM_TASKBARCREATED As Long

'------------------------------------------------------------------------------

'进程 *** 作部分:--------此部分只作为主程序的专有部分,其他子程序暂无 *** 作进程功能-------------------------

'查找函数

Public Function FindPro(ByVal sExePro As String, ByRef lProID As Long) As Integer '1找到该进程,0没找到

Dim my As PROCESSENTRY32

Dim l As Long

Dim l1 As Long

Dim mName As String

Dim i As Integer

Dim PID

FindPro = 0

sExePro = LCase(sExePro)

l = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)

If l Then

my.dwSize = 1060

If (Process32First(l, my)) Then '遍历开始

Do

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

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

If mName = sExePro Then

PID = my.th32ProcessID

'pname = mName

Dim mProcID As Long

mProcID = OpenProcess(1&, -1&, PID)

lProID = mProcID

'MsgBox pname

'TerminateProcess mProcID, 0&

FindPro = 1 '找到进程

Exit Function

End If

Loop Until (Process32Next(l, my) <1)

End If

l1 = CloseHandle(l)

End If

End Function

'结束进程(查找进程,如存在则结束,不存在则无 *** 作)

Public Function SetEndPro(ByVal sExePro As String) As Integer '1成功结束,-1无此进程,0结束进程失败

Dim lProID As Long

Dim tmBack As Long

lProID = -1

If FindPro(sExePro, lProID) = 1 Then

tmBack = TerminateProcess(lProID, 0&)

If tmBack <>0 Then

SetEndPro = 1 '成功结束进程

Else

SetEndPro = 0 '失败

End If

CloseHandle lProID

Exit Function

Else

SetEndPro = -1 '不存在

End If

End Function

'--------------------------------------------------------

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'(完了再贴检测版本,你自己组合下函数就好了.仍然有很多你不要的函数声明,自己清理下)

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

''''''''''''''''Ver for AOS.exe'''''''''''''''''''

Type VS_FIXEDFILEINFO

dwSignature As Long

dwStrucVersionl As Integer ' e.g. = &h0000 = 0

dwStrucVersionh As Integer ' e.g. = &h0042 = .42

dwFileVersionMSl As Integer' e.g. = &h0003 = 3

dwFileVersionMSh As Integer' e.g. = &h0075 = .75

dwFileVersionLSl As Integer' e.g. = &h0000 = 0

dwFileVersionLSh As Integer' e.g. = &h0031 = .31

dwProductVersionMSl As Integer ' e.g. = &h0003 = 3

dwProductVersionMSh As Integer ' e.g. = &h0010 = .1

dwProductVersionLSl As Integer ' e.g. = &h0000 = 0

dwProductVersionLSh As Integer ' e.g. = &h0031 = .31

dwFileFlagsMask As Long' = &h3F for version "0.42"

dwFileFlags As Long' e.g. VFF_DEBUG Or VFF_PRERELEASE

dwFileOS As Long ' e.g. VOS_DOS_WINDOWS16

dwFileType As Long ' e.g. VFT_DRIVER

dwFileSubtype As Long ' e.g. VFT2_DRV_KEYBOARD

dwFileDateMS As Long ' e.g. 0

dwFileDateLS As Long ' e.g. 0

End Type

Declare Function GetFileVersionInfo Lib "Version.dll" Alias _

"GetFileVersionInfoA" (ByVal lptstrFilename As String, ByVal _

dwhandle As Long, ByVal dwlen As Long, lpData As Any) As Long

Declare Function GetFileVersionInfoSize Lib "Version.dll" Alias _

"GetFileVersionInfoSizeA" (ByVal lptstrFilename As String, _

lpdwHandle As Long) As Long

Declare Function VerQueryValue Lib "Version.dll" Alias _

"VerQueryValueA" (pBlock As Any, ByVal lpSubBlock As String, _

lplpBuffer As Any, puLen As Long) As Long

Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" _

(dest As Any, ByVal Source As Long, ByVal Length As Long)

Public Function GetVer(Optional ExePath) As String

'*** Get Version Info ****

If Not IsMissing(ExePath) Then

fullfilename = ExePath

Else

fullfilename = App.EXEName + ".exe"

End If

Dim FileVer As String

Dim rcAs Long

Dim lDummyAs Long

Dim sBuffer() As Byte

Dim lBufferLenAs Long

Dim lVerPointer As Long

Dim udtVerBuffer As VS_FIXEDFILEINFO

Dim lVerbufferLen As Long

'*** Get size ****

lBufferLen = GetFileVersionInfoSize(fullfilename, lDummy)

If lBufferLen <1 Then

'MsgBox "该文件没有版本信息!", vbInformation

Exit Function

End If

'**** Store info to udtVerBuffer struct ****

ReDim sBuffer(lBufferLen)

rc = GetFileVersionInfo(fullfilename, 0&, lBufferLen, sBuffer(0))

rc = VerQueryValue(sBuffer(0), "\", lVerPointer, lVerbufferLen)

MoveMemory udtVerBuffer, lVerPointer, Len(udtVerBuffer)

'**** Determine File Version number ****

FileVer = Format$(udtVerBuffer.dwFileVersionMSh) &"." &_

Format$(udtVerBuffer.dwFileVersionMSl) &"." &_

Format$(udtVerBuffer.dwFileVersionLSh) &"." &_

Format$(udtVerBuffer.dwFileVersionLSl) '倒数第二句Format$(udtVerBuffer.dwFileVersionLSh) &"."

GetVer = FileVer

End Function

小天鹅洗衣机常见故障的维修方法小天鹅自动洗衣机——进水未达到设定水位时停止进水。分析维修:此故障主要是水压开关性能不佳,使集气室气压未达到规定压力时,其触点会提前从断开状态切换到闭合状态,停止进水。具体原因及处理方法如下:(1)水压开关水位控制d簧预压缩量小,可通过拧入调节螺钉增加水位控制d簧预压缩量来解决。如果水位控制d簧的d性变小或失去d性,应更换水位控制d簧。(2)水压开关凸轮上的凹槽磨损或损坏,通常可以通过更换凸轮来解决。小天鹅自动洗衣机——排水速度慢分析与维修:此故障通常是由于排水阀未完全打开或排水管道不畅造成的。具体原因及处理方法如下:(1)排水阀内有杂物或排水软管弯曲变形。只要清除排水阀内的杂物或者更换排水软管就可以解决。(2)泄水杆与橡胶阀的间隙变大,只要适当减小泄水杆与橡胶阀的间隙即可。(3)排水阀中的d簧过长或失去d性。只需更换内d簧。(4)排水电磁阀动芯阻尼过大或吸力变小。清除电磁铁中的铁锈和污垢,或更换排水电磁阀。小天鹅自动洗衣机小天鹅全自动洗衣机-排污分析维修:此故障一般是水压开关性能不良或空气管道漏气,使集气室内气压降低。当盛水桶中的水位还没有下降到规定位置时,水压开关触点提前移动,缩短了总排水时间,导致排污失败。只要想办法找到气路漏洞,用401胶封住就行了。如果水压开关损坏,请更换。小天鹅自动洗衣机——脱水后,刹车时间过长。分析维修:此故障是由于制动带不能抱紧脱水轴的制动轮,降低了制动摩擦力。具体原因及处理方法有:(1)离合器上的制动带安装歪斜,衬片磨损或紧固螺钉松动。只需重新安装或更换制动带。(2)制动d簧松动、断裂或失去d性。只需重新安装或更换制动d簧。(3)制动杆被棘爪叉顶住不能回位,使制动带不能抱紧脱水轴的制动轮。只要棘爪叉的位置被调整、修理或更换。(4)电磁铁的动铁芯被杂物堵塞,不能完全伸出,使制动杆不能恢复原位。只要清除电磁铁动铁芯上的铁锈和污垢或更换电磁铁即可。总结一下,小天鹅全自动洗衣机常见的故障排除方法大概就这么多。如果你对这个内容感兴趣,可以仔细研究一下。当然,如果你对这方面不感兴趣,家里用的小天鹅自动洗衣机不幸坏了,你也可以拿到电器维修公司,他们会有专业的修理工来维修。天鹅QB30-8洗衣机维修技巧天鹅QB30-8洗衣机工作不正常。障碍现象:洗衣机通电后,显示开始正常。当按下开始键时,显示紊乱,洗涤电机保持旋转。检测判断:产生这种现象的原因是:(1)电源滤波不好,纹波过大;(2)系统的控制电路受到外界干扰;(3)IC性能不稳定。因为显示紊乱,判断故障是电源滤波不良引起的。维修方法:在调节管VT1底座与地之间并联一个100μF电解电容,焊接电容C4,更换一个300μF电解电容,加强电源滤波,排除故障。小天鹅XQB30-8洗衣机工作不正常。故障现象:开机后显示正常,但需要改变洗涤程序时蜂鸣器不响,洗衣机机械执行部件不工作。检测判断:从现象分析,故障可能发生在控制驱动电路的公共部分。14021WFW微处理器第19脚电压正常,然后测量晶体管BG12各极工作电压。发现基极电压为OV,因此确定问题出在BG12及其相关电路。断电,分别检查BG12、R26、R27等相关部件,发现R27有缺陷。维修方法:更换同型号R27后,对机器进行测试,排除故障。小天鹅XQB30-8洗衣机工序混乱(1)故障现象:开机后无显示,洗衣机不按 *** 作程序动作。检测判断:电脑板或电脑板电源部分故障,原因是开机后电脑板指示灯不显示。检查前先检查市电是否正常,电源插头是否接好,电源开关是否按下。如果电源正常,检查如下。先用万用表测量电脑板输入电路的黄色和橙色插孔没有220V交流电压,但电源开关端子有220V电压正常。然后检查电源开关和触点是否接触良好,连接器有无松动,判断电脑板有故障。维修方法:更换电脑板后,排除故障。检修经验:电脑板损坏很少见。检修此类故障时,一定要检查电源开关是否打开,接触是否良好,接插件是否松动或接触不良,以免造成经济损失。小天鹅XQB30-8洗衣机工序混乱(二)故障现象:工序紊乱,出现干洗现象。检测判断:其实衣物正在烘干时,滚筒并不旋转,只有波轮在旋转。这种故障的原因是:一是电脑板坏了,导致控制失灵。经检查,由于机器抱簧内孔太大,在甩干过程中抱簧无法与脱水轴紧紧抱紧离合套,导致洗衣机仍处于洗涤状态,所以衣服烘干后再洗。维修方法:更换d簧后,故障排除。大修经验:更换抱簧的拆卸步骤及拆卸时的注意事项:(1)拆卸步骤:(1)拆下V带;2)拆下驱动皮带轮和垫片;3)取出抱簧。一只手捏住外轴,另一只手移动棘轮释放d簧,慢慢取出。(2)拆装时的注意事项:1)首先在抱簧内注入黄油,然后将抱簧的一端朝下,放入棘轮内。d簧的末端要对准棘轮的内孔槽,末端要扣入棘轮壁上的小孔。2)将棘轮和抱簧顺时针拧到离合器套上,并紧靠外轴平面;3)调整棘爪的位置,使棘爪的头部对准离合器内轴的轴线,以保证顶丝与摆板之间的距离,使洗涤正转、反转和离心动作能正常进行。小天鹅XQB30-8洗衣机有异响。故障现象:电机轴承上油后,工作时有很大的噪音。检测判断:电机轴承润滑油添加量不当,或使用的润滑油质量不符合标准。太少不能达到有效润滑和降噪的目的,太多会增加电机的功耗,电机的温升,加速绝缘老化,同时增加噪音。该机轴承加油后有噪音,判断为过油。维修方法:拆下轴承重新加润滑油,在轴承空间加注三分之一润滑油,然后装上试验机,排除故障。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/11765525.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存