|
-
Oct 31st, 2003, 01:08 AM
#1
Thread Starter
Member
How to call Win32Shutdown method in a proper way
Does anyone know how to call Win32Shutdown method of Win32_OperatingSystem class.
Here is what I have got so far:
VB Code:
Dim OSClass As New ManagementClass("Win32_OperatingSystem")
' Get an input parameters object for this method
Dim inParams As ManagementBaseObject = processClass.GetMethodParameters("Win32Shutdown")
' Fill in input parameter values
inParams("Flags") = 2
' Execute the method
Dim outParams As ManagementBaseObject = processClass.InvokeMethod("Win32Shutdown", inParams, Nothing)
I got an error 'invalid method Parameter(s)' when it reached the last line InvokeMethod. What I want to do is just to shutdown the machine using VB.NET.
-
Nov 2nd, 2003, 08:23 PM
#2
Thread Starter
Member
-
Nov 3rd, 2003, 03:30 AM
#3
if you want to use Management object , here's a link ( in C# but easy to understand )
ShutDown Windows with System.Management
although i prefer to use ExitWindowsEx , an example in vb6 ( but easy to translate to .net can be found here...ExitWindowsEx to shutdown windows
if i get chance sometime i'll throw an example together ( but not sure when cuz of feeding duties etc... )
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Nov 3rd, 2003, 05:13 PM
#4
Thread Starter
Member
Thx a lot, thats solved the problem.
-
Nov 3rd, 2003, 05:16 PM
#5
no problem
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|