Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Shutting Down Computer With VB Code

do anybody know the function to shutting down the CPU with vb code, plz reply.
thanks anyway, Creator looks after u all.
hasan. ---{{@

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Shutting Down Computer
Is that posseble to shut down, restart and so on, in vb?

Shutting And Restarting The Computer
Please, quick, can u help me? : How can I shut down or restart the computer when the user clicks on form button?

Shutting Down A Program On Another Computer
I have the code to shut down a program on my own computer, but how do you remotely shut down a program running on another computer on a network

Code For IP And Computer Name
Hay, can you tell me how to know my computer ip and computer name in VB Code? I want to record what IP login in my database

What Code Contains The Computer Name On A Network?
I have a program that saves to a textfile the user's name and the type of error that has occurred. I also want this program to save to this textfile the Computer Name

What code contains the computer name? The computer name would be under Control Panel - Network - Client for Microsoft Networks - Identification.

What would I need to type in order to find the information on the current posts listed?


Vb Code To Find A Computer On Or Off
Guyz, iam using access as backend which is in another system, juz like client server application.While logging in ,i will check the user from the table in the server.If server is switched off,i want to give user friendly message, so i need to trap whether the server is on or off.I tried with isdestinationreachable,the sad part is that it will tell whether a system is found in network or not.It returns true if a system is found in network even when the system is off.What to do to find out whether that system is on or off?
Thanks in advance

Need Code To Get Computer Name And User Name
Is there an API call to get the computer name and user name for a user?


Turning On A Computer With Code
Is it possible to have your computer turn on by itself at a specific time of day via computer code? How does this have to be coded and where? How do i get started?

Thanks to all that reply.

Any Code 2 Shut Down A Computer?
is there any code you can put in like a command button sub and it would shut the computer down.
also is there code to open/close a cd-rom disk drive and see if a floppy disk has been removed?

Lock My Computer When I Run The Code?
If I wanna lock my computer when I run my Sub, how do I write the code?

Open My Computer Through Code
I am trying to open the My Computer folder (you know, the one with all the drives etc) from my VB app. I have a feeling this is done using the special folder values, or a command line switch to explorer. Can anyone point me in the right place to find the values etc? I will also need to be able to open network neighborhood and other special folders as well.



How Can I Detect My Computer With Code? (please Tell Me)
I want to identify my computer with a const number or every other things?
like hard drive serial number(not change in format)
or sapce of ram or ... for recognition my computer in several cpmputers.

please if you can to help me,please send for me:


How Do I Code A Program For Single Computer Use?
I want to put a code into my program so that Only my computer would be able to use it. THe reason I ask this is because I have a program I want to give to a few friends but incase they wanted to exploit it I would want this code in there so no one could steal it.

How Do I Open A Folder In My Computer With Code.
I need to open a folder just like you do when you go to start run and type in the path.

I have the paths loaded into a list box and when I double click on one I want My Computer to open the folder.

What type of command or code do I need to do this.


What Is The Code To Find Out Computer Identification Number
What is the code for getting computer identification number and getting it displayed in a textbox ?

Amit Bhaduri

[URGENT] Create A Folder In Vb Code And Detect The Computer Name!
Hi masters,

anybody can help me on how to auto create folder using vb code?? and detect also what is the computer name (local): not network computer name... tnx n advance...

i knew this s possible, but i don't knw how... hehe... jst help so that i'll knw...

Remote Logon With Other Computer On LAN With Visual Basic Code(API Fun.)

I want to logon with a computer named "dev2" on LAN and my computer name is "DevMain". If it is possible in visual basic 6.0 to connect with other computer on LAN using any API function.? If it is possible Please guide me with visual basic 6.0 code example.

Note: Both computers are Primary Domain Controler.

Please help me... I need ur help urgently.

Code To Make My .exe File(VB6.0) Automatically Run In Desktop When I Turn On My Computer
hi, i got a problem having the code to make my .exe file(VB6.0) automatically run in my desktop when i start my computer. can you please give me that code thanks

Shutting Off PC
This isnt a Trojan at all before any one thinks. Its for a net cafe so that when your time ends, the PC is shut down. Could any one give me a code to shut off the PC...

I have attempted with a lil code my mate gave me...This was:

If intMinutes = 0 & intSeconds = 0 Then
Const EWX_LOGOFF = 0
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
End If


Shutting Down HDD

I have done some research and found out that it is possible to perform several shut down actions, including hibernate or turning off the monitor. I was wondering if any of you know a way how to send the suspend command to the HDD.

Sebastian Mares

Shutting Down, Etc.
I can't seem to find the commands for shutting down, restarting, or logging off a computer.

Also, is it possible to do a quick user-switch with a predefined username/pass?(like switching to a different user using two variables)

Any help would be appreciated.

Shutting Down A PC??
Is there a way, through VB, that I can add functionality to shut down a PC when the user clicks the "ShutDown" button on the app?

Shutting Down
I'm trying an application that will play audio cd on "sleep mode" which means that as soon the last music ends, so is the program and the PC shuts down. Any help on the last one (Shutdown)?

Shutting Down
Hi. i have a button that shuts down the PC..but am getting an error:

VB Code:
Private Sub Command1_Click()Shell ("Shutdown -s")End Sub Private Sub Command2_Click()Shell ("Shutdown -l")End Sub Private Sub Command3_Click()Shell ("Shutdown -r")End Sub


Procedure declaration does not match description of event or procedure having the same name.

Does anyone know what is causing that?

Shutting Down
I was wondering how I would go about shutting down Windows if I click a button in my program. Thanks for the help
- anti_hero

VB Is Shutting Down My PC !?!!!
Hey guys.
I know it sounds crazy.

But the PC at my office, I have installed XP and a ton of dev tools, apps, other stuff.

When I'm in VB, if I double-click a form in the project window, or rightclick and select 'view form', about half the time the computer will directly shut down. There is no hang, no response problem, no error, just immediate shutdown, like somebody pulled the power plug.

It only happens in VB and it only happens when I click on view form or double click the form from the project window. I have VB and XP installed at home from the same install discs (yeah, I know) and I've never had this problem. I thought it might be fluke, but it has been happening for several months. And, since I have not been working in VB for several weeks, and just tried today, I found the problem still happens

Has anybody ever heard of anything like that before??
I'm puzzled.

Shutting Down PC
How would i make a program shutdown the computer?

My program starts up when the computer does and i want it to shut down the computer when you exit it. Its for a business computer and I need it to be this way so people can use only it and nothing else.


Shutting Down W98
Sorry guys, I know this has been posted before, but the searches i'm running are coming up blank.

Simple request. When my app closes I want to Shut down the machine. It will always be on W98SE. Anyone got some simple code (or API call) as necessary.



Shutting Down In NT?
Sounds like MS made win2000 somehow not to work with anything!
I want to restart/shotdown win2000. I used ExitWindowsEx, but only LogOff will work.
Any way to do a compelete shot down in win2000?

Shutting Down NT / 2K
The subject was just to get your attention...i dont mean it. my question is:

I know this has been brought up before, but i dont think anyone has mentioned this exact thing. I would appreciate an example of the ExitWindowsEx API used in conjunction with the AdjustTokenPriviliges API to give my program the SE_SHUTDOWN_NAME priviliege. Im new to APIs and all and i tried to do this...but i ended up with a mess of code that didnt do anything. HELP??

PS - In Windows NT / 2K you cant just call the WindowsExitEx API, you have to guve your proggie the priviliege to shut down the computer. Yes i know i should have posted this in the API forum...but i didnt feel like it

Shutting Down Nt?
does anyone have some code for shutting down nt/2000?

Upon Shutting Down
Does anyone know how to run a certain program, when SHUTTING down from WINDOWS?

Can you do it through the registry or with codes?


Shutting Down An App
Hi there,

Could someone tell me how to shutdown a window application by name using Visual Basic?

Thanks in advance.

Shutting Down
I want the user in my program to be able to shut his/her computer down by clicking a button and not getting the 'do you really want to shut down?' dialogue screen
Can You help?


You just have to accept that some days your the pigeon and some days your the statue


'If a man ask you a question just reply 42, if he asks you what you mean, give him a calculater'


Longhorn is just like Labour, All promises and no show

Edited by - Neomie on 5/10/2004 4:13:44 AM

Sending A Files From Client Computer To Host Computer, Via LAN/internet
Hi everyone:

Please help me..I need to finish my project..

Below is my explanation:

Execute program=>click a button=>program seek for certain folder (c:myfolder)=>sending all files (2kB) to host

Always looking for incoming files=>save in a folder
(host could be a desktop-webserver, installed tomcat/apache, assumed with static ip)

Please help...Thanks in advance.

Shutting Down A Program
I've almost completed my first, fully functional VB program (LOTS of thanks to everyone here!), but have a nagging problem in my code. I have 4 forms in the program with one form as the "main" launchpad for the other forms. If I close or exit the other forms, they unload and take me back to the main form. However, if I "X-out" (close) the main window with the windows exit icon, the program still runs. The window disappears, but in the VB program I have to click "end" or after compilation I have to "ctrl-alt-del" and shut the program down that way. I've even tried to "unload" the window with a command button and code, and that just gives me an error. I know it must be something stupid on my part, but does anyone have any suggestions on what I"m doing wrong?

MS Word Not Shutting Down...

I can't seem to get word to shut down after calling it's check spelling function.

I create a word object and then close it several times. This works fine and each one opens up and shuts down.

but if you uncomment the msgbox line in the middle, word opens up and stays open. and I get 6 copies of winword.exe and have to goto task mgr to close the winword.exe's

here's the test code...

' you'll need to add Microsoft Word X.X as a reference...
Dim objWordApp As Word.Application
Dim i As Integer

For i = 0 To 5
Set objWordApp = New Word.Application

' MsgBox objWordApp.CheckSpelling("helo")

objWordApp.Quit (False)
Set objWordApp = Nothing
Next i

Any ideas?

Excel Shutting Down...
I have a VBA application that grabs data from a network analyzer. The data is formatted on a sheet, then a graph is created and set on another sheet. Sometimes our tests must grab data 100+ times and make 100+ charts.

Every time I run the application, when going from test number 56 to test 57, Excel just shuts down with no error or warning. I have run the program in debug mode and the same thing happens.

I have no idea what is causing this b/c of the lack of error message. Does anyone have any ideas?


Shutting Down The Pc From A Vb Application
can someone help me with a problem. i have put a command button in my splash screen, and i want it to safely shutdown the pc when you click on it, by closing all applications, then automatically doing the whole "start menu, shut down, shut down, ok button" method of turning off the pc. but if there is another way of doing this without all that faffing about i would appreciate it.



all good things come to those who pay

Shutting Down Windows
I'm trying to build a program that will automatically reboot, logoff, or shutdown a user's computer at a certain time. The only problem that I am hitting is with the shutting down. It works, but instead of automatically shutting off my computer (like it should), it gives me the screen that says, "It is now safe to turn of your computer." Is there any way to fix this? Here is the code that I am using to turn off the users computer:

Private Declare Function ExitWindowsEx Lib "user32" (ByVal _
dwOptions As Long, ByVal dwReserved As Long) As Boolean

Global Const EWX_SHUTDOWN = 1
Global Const EWX_FORCE = 4
Global Const EWX_REBOOT = 2
Global Const EWX_LOGOFF = 0

Dim blnReturn As Boolean
blnReturn = ExitWindowsEx(EWX_SHUTDOWN, 0)

Thanks for the help everyone!

Oracle Shutting Down.
Hi there,
My Oracle shutdown when I shutdown my computer so when I want to use Oracle I must start it manually. Pls show me the way to keep the Oracle service run all the time and start automaticlly when I start my computer.
Thanks for help.

Shutting Off A Timer.
How can i turn a timer off, ill call timer1. with another timer, timer3. If timer1 was activated with timer2.

So this is what it looks like

Timer1.Enabled = True

Now how can i shut timer1 off with timer3? but not having it stay on...

HELP-VB6 IDE Shutting Down On Trying To Compile
My VB6.0 app has just started closing itself each time I hit the "Run" button. I can open the IDE without a problem and edit my code, but I can't test my changes because each time I click the "Run" button it shuts down the IDE altogether.

I'm suspecting one of the dependent files may have been corrupted, but I can't tell which one. It's quite a big application.

Is this a familiar problem, or has anyone come accross a similar problem? If so, please help.


Shutting Down WinXP
I want my new app to shutdown WinXP when I exit out of the app. Is there a easy way to do this??

Remotely Shutting Down A PC
Hi Everyone,

I need a full proof way way to force a remote XP or 2000 machine to shut down OR restart OR logoff.

Below is my code for shutting down and logging off, but when a computer is locked, it will not inniate inniate the request.

This link shows a command line style of doing it, but how do I integrate my code into it?

Also, does anyone know how to force a logged on user to log off?

VB Code:
'------ Code for remotely rebooting ------strComputer = txtLookup        Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\" & strComputer & "
ootcimv2")     Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")         For Each objOperatingSystem In colOperatingSystems                   objOperatingSystem.Reboot

VB Code:
'------ Code for remotely shutting down ------strComputer = txtLookup        Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\" & strComputer & "
ootcimv2")     Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")         For Each objOperatingSystem In colOperatingSystems              objOperatingSystem.Shutdown

Shutting Down And Restarting
does anybody know how to shutdown or restart the pc with code.


Shutting Down Networked XP Pro
On normal Windows XP (home) i know you can shutdown the pc by using

VB Code:
Private Sub cmdShutdown_Click() shutdown.exe -r -s -t 0 End sub

But on Windows XP pro that is on a network this doesn't work.

I think its because it has

Log off [username]
Stand By

does anybody know the exe that is run instead of shutdown.exe

Thanks in advance.

Copyright 2005-08, All rights reserved