sancarn/stdVBA

stdProcess - massive slow downs due to deprecated code

sancarn opened this issue · 0 comments

stdProcess.CreateAll() method is incredibly slow. The root cause of the slow down comes from getModuleIDByPid function, which always returns 0 anyway... Comment out the line in protInitFromProcessId:

Friend Sub protInitFromProcessId(ByVal argID As Long, Optional ByVal argName As String = "", Optional ByVal argPath As String = "", Optional ByVal argModuleID As Long = 0)
  pProcessId = argID
  pName = argName
  pPath = argPath
  'If argModuleID = 0 Then pModuleID = getModuleIDByPid(argID)   '<------ commented
  If Len(argName) = 0 Then pName = getProcessNameById(argID)
  If Len(argPath) = 0 Then pPath = getProcessImageName(argID)
  pQueryInfoHandle = OpenProcess(PROCESS_QUERY_INFORMATION, False, argID)
End Sub