i saw WMI Sample which use Function WMIService()
x:\fwh\samples\pcinfo.prg
Question : how to "destroy" WMI Connection ?
Code: Select all
oLocator := CreateObject( "wbemScripting.SwbemLocator" )
oWMI := oLocator:ConnectServer()
Code: Select all
oLocator := CreateObject( "wbemScripting.SwbemLocator" )
oWMI := oLocator:ConnectServer()
Thx for Answer.Antonio Linares wrote:Try with:
oWMI := nil
Code: Select all
function WMIService()
// It would be useful to keep this function in the library
static oWMI
local oLocator
if oWMI == nil
oLocator := CREATEOBJECT( "wbemScripting.SwbemLocator" )
oWMI := oLocator:ConnectServer()
endif
return oWMI