Home > Software engineering >  How to use vb to monitor process is busy
How to use vb to monitor process is busy

Time:09-28

I said my needs, which may be in the title didn't clear,
I want to use vb operating PDF file, using the adobe reader, movement is converted into a TXT,
Other all do not have what problem
The question now is, at the time of conversion, some of the file is big, long conversion time; Some small files, the conversion time is short, I want to monitor the conversion process, when after the conversion, vb automatically know, I think a lot of ways, all useless, I before the idea is to monitor the adobe process is busy, but not be completed, ask ace to give a solution,

CodePudding user response:

Fyi:
 Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long 
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Const the SYNCHRONIZE=& amp; H100000
Private Sub ShellWait (CMD As String)
Dim pId As Long, pHnd As Long, r As Long
Form1. Refresh
PId=Shell (CMD, vbHide)
PHnd=OpenProcess (the SYNCHRONIZE, 0, pId)
If pHnd & lt;> 0 Then
Do
R=WaitForSingleObject (pHnd, 1000) ', etc.
1 SECDoEvents
Loop While r & lt;> 0 And terminateFlag=False
Call the CloseHandle (pHnd)
End the If
End Sub
  • Related