Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Visual Basic 6 - Error RunTime 2147217406 ( 80041002 )
Forum - Visual Basic 6 - Error RunTime 2147217406 ( 80041002 )

Avatar
fusebyte (Normal User)
Expert


Messaggi: 332
Iscritto: 24/12/2008

Segnala al moderatore
Postato alle 16:13
Venerdė, 21/08/2009
Usando questa funzione ottengo questo "error runtime" .
Codice sorgente - presumibilmente VB.NET

  1. Private Sub Form_Load()
  2. TerminateProcess ("Icon.exe")
  3. End Sub


Codice sorgente - presumibilmente VB.NET

  1. Public Sub TerminateProcess(ByVal ProcessName As String)
  2.  
  3. Dim oLoc
  4. Dim oServ
  5. Dim oObjectSet
  6. Dim oProc
  7. Dim sWQL As String
  8. Yes = True
  9. ' genera la query WQL
  10. sWQL = "SELECT * FROM Win32_Process WHERE Name = '" & ProcessName & "'"
  11.  
  12. ' oggetto locator
  13. Set oLoc = CreateObject("WbemScripting.sWbemLocator")
  14. Set oServ = oLoc.ConnectServer(".", "root\cimv2")
  15. Set oObjectSet = oServ.ExecQuery(sWQL)
  16.  
  17. For Each oProc In oObjectSet
  18. If Yes = True Then oProc.Terminate <---error runtime 2147217406
  19. Next
  20.  
  21. Set oProc = Nothing
  22. Set oObjectSet = Nothing
  23. Set oServ = Nothing
  24. Set oLoc = Nothing
  25. End Sub




Il codice funziona,killa l'applicazone anche se ha pių instanze,ma in chiusura se ne esce con questo errore,del quale non riesco ad trovare niente al riguardo.
Sapreste dirmi dove agire per sistemare le cose?

Grazie

Ultima modifica effettuata da fusebyte il 21/08/2009 alle 16:18
PM Quote
Avatar
fusebyte (Normal User)
Expert


Messaggi: 332
Iscritto: 24/12/2008

Segnala al moderatore
Postato alle 20:32
Venerdė, 21/08/2009
ad trovare = a trovare
chiedo venia per l'errore grammaticale.

Ciao

PM Quote
Avatar
fusebyte (Normal User)
Expert


Messaggi: 332
Iscritto: 24/12/2008

Segnala al moderatore
Postato alle 11:08
Martedė, 01/09/2009
RISOLTO problema oProc.Terminate error runtime!
Codice sorgente - presumibilmente VB.NET

  1. For Each oProc In oObjectSet
  2. If Yes = True Then oProc.Terminate '<--- error runtime
  3. Next



Primo  non dichiaravo come Boolean la var YES
Secondo non riportavo la condizione a FALSE

Codice sorgente - presumibilmente VB.NET

  1. Dim Yes as Boolean
  2.  
  3. For Each oProc In oObjectSet
  4. If Yes = True Then oProc.Terminate
  5. Yes = False
  6. Next



Error RunTime 2147217406 sparito !  :-))

Ciao

Ultima modifica effettuata da fusebyte il 01/09/2009 alle 11:10
PM Quote