Computer Science Canada

password

Author:  scorpion1087 [ Fri Nov 21, 2003 8:37 pm ]
Post subject:  password

i want to make a program so that if you enter a password word right it goes to the desktop or something but if the password is wrong then the computer shuts down.some help would be great thanks.

[/code]

Author:  Tony [ Fri Nov 21, 2003 8:43 pm ]
Post subject: 

you'd have to use Sys.Exec

to shutdown, just execute shutdown.exe. It is located somewhere in Windows folder. I think Thinking

As for going to desktop, you can execute a shortcut, pointing to the desktop.

Author:  Andy [ Fri Nov 21, 2003 8:45 pm ]
Post subject: 

i think he wanted it as a security thing like locking up the comp

Author:  Mazer [ Fri Nov 21, 2003 10:47 pm ]
Post subject: 

that's a pretty cool idea. but you have to make sure the user doesn't just ignore the window to avoid having the computer shut down. check this out:

code:

var win : int := Window.Open ("graphics:600;400")

loop
    % do your get the password stuff here

    if Window.GetActive = -1 then % the turing run window isn't selected
        % do your shutdown stuff here, because they are trying to avoid entering the password!
    end if
    delay (150)
    cls
end loop

and it works! if they click outside the run window, (or do anything that would cause the run window to no longer be the active window) you'll know about it. meaning: no ctrl+alt+del and end task on the turing program. gee, that's pretty evil....

EDIT:
oh yeah, when the user enters the correct password, have
code:

Window.Close (win)
return %<- just in case you are in a loop or something, that'll exit the program completely

Author:  Andy [ Sun Nov 23, 2003 3:39 pm ]
Post subject: 

nooo... nick you still have to end the program using return...

Author:  Mazer [ Sun Nov 23, 2003 10:59 pm ]
Post subject: 

dodge_tomahawk wrote:
nooo... nick you still have to end the program using return...

did that make any sense at all to you?

Author:  scorpion1087 [ Tue Nov 25, 2003 6:04 pm ]
Post subject: 

Thanks for the code but i cant find the path for shutdown!

Author:  Andy [ Tue Nov 25, 2003 6:58 pm ]
Post subject: 

i meant, if you just close the window, the program doesnt shut down... you have to close the window, and then stop the program with the return command

Author:  Mazer [ Tue Nov 25, 2003 9:26 pm ]
Post subject: 

but i did use return. check the edit... in fact, this time i'm pretty sure i actually added the edit before someone noticed the mistake. but anyways, while incorrectly reading your post, i noticed something... you can just click on the X and close the run window... that'd make all this other stuff pretty useless.

EDIT: oh... is that what you meant? if the user closes the window? that's one of those things that bug me about turing.

code:

var win : int := Window.Open ("graphics:600;400")
var mx, my, btn : int

loop
    mousewhere (mx, my, btn)
    % do your get the password stuff here

    if Window.GetActive = -1 or my > maxy then % the turing run window isn't selected
        % do your shutdown stuff here, because they are trying to avoid entering the password!
    end if
    delay (50)
    cls
end loop


i added the or my > maxy part in case the user tries to click X. but upon further cotemplation, i think this would be one of those times when it's somewhat useful to switch back to turing 3.1 in order to use it's fullscreen capability. that way the user can't click X and you don't need to worry about using mousewhere (i mean, what if the mouse starts up higher than the top of the window... that'd kinda suck). plus, it probably looks cooler to have a fullscreen window open than to have some stupid turing window. real spiffy. but i'm not sure if Window.GetActive works in turing 3.1 and i don't have a copy of it to check myself.

but anyways...
code:

Sys.Exec ("c:/windows/system32/shutdown.exe")

i believe that's what you were looking for?

Author:  Andy [ Tue Nov 25, 2003 9:33 pm ]
Post subject: 

actually nick, you can just make the exe uncolseable... turing has that option... and sry, i didnt see that part of your code

Author:  Mazer [ Tue Nov 25, 2003 9:39 pm ]
Post subject: 

dodge_tomahawk wrote:
actually nick, you can just make the exe uncolseable... turing has that option... and sry, i didnt see that part of your code

ah yes... that's right.

Author:  Andy [ Tue Nov 25, 2003 9:40 pm ]
Post subject: 

ya, do this in turing 3, everything is the same, except editor and minor commands like view.update

Author:  scorpion1087 [ Wed Nov 26, 2003 5:31 pm ]
Post subject: 

Very Happy hey thanks to all, my program is a A O K now!!!!!!!!!! Very Happy

Author:  Andy [ Wed Nov 26, 2003 6:32 pm ]
Post subject: 

too bad the samething cant work on our comps at school... stupid security

Author:  thoughtful [ Wed Nov 26, 2003 6:40 pm ]
Post subject: 

LOL, I hate the securtiy, not only does it mindle with the educational stuff, it also doesnt let us Download important stuff like shockwave player to play games. But we keep pissing the teachers off by downloading pocket tanks on the student drive.Twisted Evil Twisted Evil Twisted Evil (thats the only game those computers can run without hanging up)

Author:  AsianSensation [ Wed Nov 26, 2003 11:54 pm ]
Post subject: 

lol, I remember dodge bringing Command and Conquer: Generals to our compsci lab and was trying to play it, the entire thing froze as soon as we get into the game.

Maybe you should try Worms on those computer, they run great, and you can network them and play 6 player games, it's great! We did that all last year.

Author:  Andy [ Thu Nov 27, 2003 11:52 am ]
Post subject: 

o we can download, just not access the c drive and control panel and stuff or install msn messenger...
o yea cc generals needed at least 128 mb of ram and 800 mhz of processor to run... recommended 256 mb of ram and 1.6 ghz of clock speed, our school had 800 mhz but only 64 mb and no video card... o well sc, sc and armageddon is cool enuff


: