Listado de procesos en win32
Rolando José Torres Sánchez
rolandojtorres en gmail.com
Sab Nov 11 01:17:24 CET 2006
Excelente
Donde lo encontraste, quisiera saber que mas se puede hacer con esa win32com.
Por cierto faltaba una linea, pero la pude construir en base a las otras.
> print "PeakVirtualSize:" + ` objItem.PeakVirtualSize`
> if objItem.PeakWorkingSetSize != None:
faltaba esta
> print "PeakWorkingSetSize:" + ` objItem.WorkingSetSize`
2006/11/9, Josu Rodriguez Vilda <jrvilda en gmail.com>:
> Bueno, por si a alguien le interesa, he encontrado lo siguiente que
> puede ser de gran ayuda:
>
>
> import win32com.client
> def WMIDateStringToDate(dtmDate):
> strDateTime = ""
> if (dtmDate[4] == 0):
> strDateTime = dtmDate[5] + '/'
> else:
> strDateTime = dtmDate[4] + dtmDate[5] + '/'
> if (dtmDate[6] == 0):
> strDateTime = strDateTime + dtmDate[7] + '/'
> else:
> strDateTime = strDateTime + dtmDate[6] + dtmDate[7] + '/'
> strDateTime = strDateTime + dtmDate[0] + dtmDate[1] + dtmDate[2]
> + dtmDate[3] + " " + dtmDate[8] + dtmDate[9] + ":" + dtmDate[10] +
> dtmDate[11] +':' + dtmDate[12] + dtmDate[13]
> return strDateTime
>
> strComputer = "."
> objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
> objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2")
> colItems = objSWbemServices.ExecQuery("SELECT * FROM Win32_Process")
> for objItem in colItems:
> if objItem.Caption != None:
> print "Caption:" + ` objItem.Caption`
> if objItem.CreationClassName != None:
> print "CreationClassName:" + ` objItem.CreationClassName`
> if objItem.CreationDate != None:
> print "CreationDate:" + WMIDateStringToDate(objItem.CreationDate)
> if objItem.CSCreationClassName != None:
> print "CSCreationClassName:" + ` objItem.CSCreationClassName`
> if objItem.CSName != None:
> print "CSName:" + ` objItem.CSName`
> if objItem.Description != None:
> print "Description:" + ` objItem.Description`
> if objItem.ExecutablePath != None:
> print "ExecutablePath:" + ` objItem.ExecutablePath`
> if objItem.ExecutionState != None:
> print "ExecutionState:" + ` objItem.ExecutionState`
> if objItem.Handle != None:
> print "Handle:" + ` objItem.Handle`
> if objItem.HandleCount != None:
> print "HandleCount:" + ` objItem.HandleCount`
> if objItem.InstallDate != None:
> print "InstallDate:" + WMIDateStringToDate(objItem.InstallDate)
> if objItem.KernelModeTime != None:
> print "KernelModeTime:" + ` objItem.KernelModeTime`
> if objItem.MaximumWorkingSetSize != None:
> print "MaximumWorkingSetSize:" + ` objItem.MaximumWorkingSetSize`
> if objItem.MinimumWorkingSetSize != None:
> print "MinimumWorkingSetSize:" + ` objItem.MinimumWorkingSetSize`
> if objItem.Name != None:
> print "Name:" + ` objItem.Name`
> if objItem.OSCreationClassName != None:
> print "OSCreationClassName:" + ` objItem.OSCreationClassName`
> if objItem.OSName != None:
> print "OSName:" + ` objItem.OSName`
> if objItem.OtherOperationCount != None:
> print "OtherOperationCount:" + ` objItem.OtherOperationCount`
> if objItem.OtherTransferCount != None:
> print "OtherTransferCount:" + ` objItem.OtherTransferCount`
> if objItem.PageFaults != None:
> print "PageFaults:" + ` objItem.PageFaults`
> if objItem.PageFileUsage != None:
> print "PageFileUsage:" + ` objItem.PageFileUsage`
> if objItem.ParentProcessId != None:
> print "ParentProcessId:" + ` objItem.ParentProcessId`
> if objItem.PeakPageFileUsage != None:
> print "PeakPageFileUsage:" + ` objItem.PeakPageFileUsage`
> if objItem.PeakVirtualSize != None:
> print "PeakVirtualSize:" + ` objItem.PeakVirtualSize`
> if objItem.PeakWorkingSetSize != None:
> _______________________________________________
> Python-es mailing list
> Python-es en aditel.org
> http://listas.aditel.org/listinfo/python-es
>
--
Rolando José Torres Sánchez
TCL/TK inside Python
rolandojtorres en hotmail.com
------------ próxima parte ------------
_______________________________________________
Python-es mailing list
Python-es en aditel.org
http://listas.aditel.org/listinfo/python-es
Más información sobre la lista de distribución Python-es