I was up till 5am writing a program...

XionTawa

New Member
...and it is my first "official" program... I mean, I have written programs before, but mostly just because I was doing a tutorial or something to learn a language...this one I wrote, because it was something I needed, and couldn't find exactly what I needed... I feel special...LOL... Check it out: http://www.xiontawa.com/projects/shutdown-timer I am going to bed now...hehe...
 
Okay...I only have 1 bug...it stopped working in Vista...well...the timer stopped working in Vista, still works in 7 and XP just fine...here is the code:

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Shell("shutdown /s /f /t 900")
    End Sub

Here's the funny thing though...if I make a batch file with just shutdown /s /f /t 900, it works...or if I type in shutdown /s /f /t 900 in the cmd it works...but when running that through the shell command (in Vista), nothing happens...yet it works on XP and 7... And another funny thing...this code works fine though:

Code:
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        Shell("shutdown /a")
    End Sub

Any ideas what is going wrong here...? Thanks for your time :)

EDIT: Opps...forgot to say this is VB... :D
 
Last edited:
In vista, chances are it's an issue with permissions. Need to force permissions. Might work if you run your program as an admin, dunno.

Love shell commands, wrote my own version of DOS 6.2 with those. Did your DOS have blinking text? Yeah, didn't think so... :D
 
Last edited:
In vista, chances are it's an issue with permissions. Need to force permissions. Might work if you run your program as an admin, dunno.

That was my first thought...but I checked all those issues...no dice...then I remembered how annoying Basic can be...so I am changing over to C++ for version 0.5...

EDIT: nevermind...C++ is being a pain... :p
 
Last edited:
Okay...I only have 1 bug...it stopped working in Vista...well...the timer stopped working in Vista, still works in 7 and XP just fine...here is the code:

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Shell("shutdown /s /f /t 900")
    End Sub

Here's the funny thing though...if I make a batch file with just shutdown /s /f /t 900, it works...or if I type in shutdown /s /f /t 900 in the cmd it works...but when running that through the shell command (in Vista), nothing happens...yet it works on XP and 7... And another funny thing...this code works fine though:

Code:
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        Shell("shutdown /a")
    End Sub

Any ideas what is going wrong here...? Thanks for your time :)

EDIT: Opps...forgot to say this is VB... :D

But anyways...still having the issue... :( ...I mean, I don't use Vista...well...no one should use Vista, but that is beside the point...
 
Okay...I only have 1 bug...it stopped working in Vista...well...the timer stopped working in Vista, still works in 7 and XP just fine...here is the code:

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Shell("shutdown /s /f /t 900")
    End Sub

Here's the funny thing though...if I make a batch file with just shutdown /s /f /t 900, it works...or if I type in shutdown /s /f /t 900 in the cmd it works...but when running that through the shell command (in Vista), nothing happens...yet it works on XP and 7...
Not sure if it is the issue or not, but I'm reading here that the maximum time value that can be entered is 600 seconds.
 
Not sure if it is the issue or not, but I'm reading here that the maximum time value that can be entered is 600 seconds.

Nope, because a batch file, or putting it in manually makes it work...and the limit is 94608000 as of NT... The only thing I can think of is it being a permissions issue...but even running it as admin doesn't make it work...
 
Have you tried passing the sender object by reference instead of by value?

I haven't done a whole lot of this kind of development (I'm mostly a web developer... Java, C#.NET, VB.NET) but what is that sender object? Does it represent the user/entity that carries the appropriate permissions? If so, then perhaps Vista only allows one instance of that object, such that passing it as a parameter may work if you're only passing a handle to the original object, as opposed to trying to pass a copy...
 
Have you tried fully qualifying the SHUTDOWN command's path? It's located in "C:\windows\system32\shutdown.exe" I know that SHELL when processed through vb.net can occasionally have issues (which is why it's suggested to use system.diagnostics.process.start) when you don't fully qualify the name.

Another thing is have you tried to run it with UAC turned off? You might be surprised at what will pop up if you do that.
 
Have you tried fully qualifying the SHUTDOWN command's path? It's located in "C:\windows\system32\shutdown.exe"

Running the .exe does not allow me to run cmd commands with it such as the time delay...which is one of the major things needed for my program to perform as I need it to...

I know that SHELL when processed through vb.net can occasionally have issues (which is why it's suggested to use system.diagnostics.process.start) when you don't fully qualify the name.

I will try this if the below option doesn't work...

Another thing is have you tried to run it with UAC turned off? You might be surprised at what will pop up if you do that.

Okay, tested...and no luck...but I did discover what the issue seems to be...I am not sure why this is only happening in Vista, but for some reason the ending commands are not going through...it is sending the command shutdown, but not getting to the /s /f /t ###...weird...
 
Last edited:
Back
Top