|
-
Nov 15th, 1999, 01:35 PM
#1
Thread Starter
Hyperactive Member
Hi Friends,
I have been asking this doubt for the 10th time i suppose. I got some replied but that was not sufficient for me.
I am in an NT Environment and my computer name is W3. I need to shutdown the computer W5 from my systems i.e. from W3. This should be made possible without loading the client software on W5.
Please someone help me out. I am in the dead end of my project without this.
Thanx in advance..
Venkat.
-
Nov 15th, 1999, 06:01 PM
#2
Lively Member
I've been after something similar too.
I have tried messing about with the InitiateSytemShutdown API, but I can't seem to get it working.
Maybe if someone could show us some sample code that will hopefully point us in the right direction.
Any help would be grately appreciated.
-
Nov 15th, 1999, 07:19 PM
#3
InitiateSytemShutdown API works fine only on WinNT.
Regards,
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819
-
Nov 15th, 1999, 07:34 PM
#4
Lively Member
Serge,
Do you have some sample code for using the InitiateSystemShutdown API??
Thanks in advance.
-
Nov 15th, 1999, 08:00 PM
#5
Thread Starter
Hyperactive Member
Hi Serge,
Pls. give us the codes. It would ne of great use..i am using NT.
Venkat.
-
Nov 15th, 1999, 08:07 PM
#6
Hyperactive Member
InitiateSystemShutdown
The InitiateSystemShutdown function initiates a shutdown and optional restart of the specified computer.
BOOL InitiateSystemShutdown( LPTSTR lpMachineName,
// address of name of computer to shut down
LPTSTR lpMessage,
// address of message to display in dialog box
DWORD dwTimeout,
// time to display dialog box
BOOL bForceAppsClosed,
// force applications with unsaved changes flag
BOOL bRebootAfterShutdown
// reboot flag
);
Parameters
lpMachineName
Points to the null-terminated string that specifies the network name of the computer to shut down. If lpMachineName is NULL or points to an empty string, the function shuts down the local computer.
lpMessage
Points to a null-terminated string that specifies a message to display in the shutdown dialog box. This parameter can be NULL if no message is required.
dwTimeout
Specifies the time (in seconds) that the dialog box should be displayed. While this dialog box is displayed, the shutdown can be stopped by the AbortSystemShutdown function.
If dwTimeout is not zero, InitiateSystemShutdown displays a dialog box on the specified computer. The dialog box displays the name of the user who called the function, displays the message specified by the lpMessage parameter, and prompts the user to log off. The dialog box beeps when it is created and remains on top of other windows in the system. The dialog box can be moved but not closed. A timer counts down the remaining time before a forced shutdown. If the user logs off, the system shuts down immediately. Otherwise, the computer is shut down when the timer expires.
If dwTimeout is zero, the computer shuts down without displaying the dialog box, and the shutdown cannot be stopped by AbortSystemShutdown.
bForceAppsClosed
Specifies whether applications with unsaved changes are to be forcibly closed. If this parameter is TRUE, such applications are closed. If this parameter is FALSE, a dialog box is displayed prompting the user to close the applications.
bRebootAfterShutdown
Specifies whether the computer is to restart immediately after shutting down. If this parameter is TRUE, the computer is to restart. If this parameter is FALSE, the system flushes all caches to disk, clears the screen, and displays a message indicating that it is safe to power down.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
To shut down the local computer, the calling process must have the SE_SHUTDOWN_NAME privilege. To shut down a remote computer, the calling process must have the SE_REMOTE_SHUTDOWN_NAME privilege on the remote computer. By default, users can enable the SE_SHUTDOWN_NAME privilege on the computer they are logged onto, and administrators can enable the SE_REMOTE_SHUTDOWN_NAME privilege on remote computers.
Common failures include an invalid or inaccessible computer name or insufficient privilege.
-
Nov 15th, 1999, 08:13 PM
#7
Lively Member
Cheers Inhumanoid - thats exactly what I was after.
Where did you get that info? Is there a file/web site that gives this sort of help using all API's???
-
Nov 15th, 1999, 08:21 PM
#8
Hyperactive Member
Don't no of any web site with all API's
-
Nov 15th, 1999, 08:23 PM
#9
Addicted Member
Try it:
------------
Private Declare Function InitiateSystemShutdown Lib "advapi32.dll" Alias "InitiateSystemShutdownA" (ByVal lpMachineName As String, lpMessage As String, dwTimeout As Long, bForceAppsClosed As Boolean, bRebootAfterShutdown As Boolean) As Boolean
Private Sub Command1_Click()
Dim x&
x = InitiateSystemShutdown("pc_name", "Shutdown...", 0, True, False)
End Sub
------------------
smalig
[email protected]
smalig.tripod.com
-
Nov 15th, 1999, 08:36 PM
#10
Hyperactive Member
Hi
MartinLiss("Marty") posted this site as answer to another topic about API,
I don't know if it kontain ALL API's but there is alot of them and you can download the entire site in a zip file if you want. http://skyscraper.fortunecity.com/tr...api/index.html
------------------
******
on error goto bed ;0)
[email protected]
*******
-
Nov 16th, 1999, 11:56 AM
#11
Thread Starter
Hyperactive Member
-
Nov 16th, 1999, 07:10 PM
#12
All this explanation came from MSDN. If you have VB6 then you should have it installed. If you don't have it installed then try the MSDN Library Online
Regards,
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819
[This message has been edited by Serge (edited 11-17-1999).]
-
Nov 17th, 1999, 02:15 PM
#13
Lively Member
Hi
This code is fine when I need to shutdown a remote machine on Windows NT. any idea if i want to shutdown Windows 95/98 workstation????
Thanx Manish
-
Nov 17th, 1999, 11:33 PM
#14
Lively Member
Use this to shutdown win 95 / 98
In a module:
Declare Function ExitWindowsEx Lib "user32" _
(ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Public Const EWX_LOGOFF = &H0
Public Const EWX_SHUTDOWN = &H1
Public Const EWX_REBOOT = &H2
Public Const EWX_FORCE = &H4
In the form to call the function:
ExitWindowsEx EWX_LOGOFF, 0 'To log off
ExitWindowsEx EWX_REBOOT, 0 'To Reboot
ExitWindowsEx EWX_SHUTDOWN, 0 'To Shutdown
-
Nov 18th, 1999, 12:12 PM
#15
Lively Member
I want to shutdown windows 95/98 workstations remotely from network server.
-
Nov 18th, 1999, 01:27 PM
#16
Fanatic Member
Dear All,
I've read all the message...
Now, continue on Manish question, I'd like to ask :
Can I shutdown a PC with Win 95/98, from my PC (also Win 95/98, not NT Station) ???
Thx...
Wille
Junior VB Programmer
-
Nov 18th, 1999, 04:41 PM
#17
New Member
I have been looking for a remote shutdown method for win 95/98 for a while now, and i've gotten used to the idea that the only way is to use a client-server program, as most people have told me. Personally, i believe that to gain the full effect from a true remote shutdown system, you should be able to use IP addresses and select a single/collection/or all PC's on a network.
Thinking about my initial question "Can i shut down remote computers WITHOUT a client server..." If possible, that would mean anybody could shut down anyone elses computer as long as they had their IP address (which are quite easily obtained).
If anyone wopuld like to see if they can find a way through this maze with me, e-mail me. I have code to obtain all network stations and their IP address. But i'm stuck on actually sending the shutdown command.
Stay Happy, e-mail me.
Gazz q:->
[email protected]
------------------
Don't let your fears stand in the way of your dreams.
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
|