Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Killing a DOS FTP window
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows XP
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00969520
Message ID:
00969802
Views:
24
>Hugo,
>
>I tried both the [GetObject("winmgmts:")] and the [loWBEMLocator = Createobject("wbemScripting.SwbemLocator")] methods, and the process failed on both tries. You were correct that Fox 7 was unable to utilize the first, but it was likewise unable to create the "SwbemLocator" object as well. Do I need to load drivers? Am I doing something else wrong?
>
>My code so far (virtually a cut-and-paste from yours):
>
>
>loWBEMLocator = Createobject("wbemScripting.SwbemLocator")
>loWMIService = loWBEMLocator.ConnectServer()
>db_proc = lo_WMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name='FTP.EXE'")
>FOR EACH objProcess in db_proc
> objProcess.Terminate(0)
>NEXT
>
>The "CreateObject" returns a zero.


It returns a 0 without any error raised?

I am not sure why that would be happening. (Do you have an Error manager in effect?)

The requirements for WMI are, other than OS, but I see you are using XP/2000:

Internet Explorer 5.0 or better
Windows Scripting Host, this one might has been disabled, and I am not sure how CreateObject behaves in that case, I would guess that it should raise an error if it is the case, but I am not sure if applies to CreateObject, I think this requirement is for running windows scripts only, so it wouldn't matter in this case, but I could be wrong, it won't be an exception <g>.

I see you are using Windows XP, so WMI should be installed, just to be sure, You can:

Open "Control Panel" -> "Administrative Tools" -> "Computer Management" From the Tree select:
"Services and Applications" -> "WMI Control" then Right Click on "WMI Control" and open the "Properties sheet"

If the connection succeds, then WMI is working properly (I think <g>) so, the next step would be to check the default namespace, selecting the "Advanced" tab the default namespace for scripting should be "root\cimv2", if it is not, then you need to pass parameters to ConnectServer, like:
loWMIService = loWBEMLocator.ConnectServer('.', 'root\cimv2')
There you should replace 'root\cimv2' with whatever is your default namespace.

The next thing to check it security, so check in the "Security" tab that you or the group you are in has rights (I think you only need to allow "Enable Account")
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform