Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 password
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
scorpion1087




PostPosted: 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]
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Nov 21, 2003 8:43 pm   Post subject: (No 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Andy




PostPosted: Fri Nov 21, 2003 8:45 pm   Post subject: (No subject)

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




PostPosted: Fri Nov 21, 2003 10:47 pm   Post subject: (No 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
Andy




PostPosted: Sun Nov 23, 2003 3:39 pm   Post subject: (No subject)

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




PostPosted: Sun Nov 23, 2003 10:59 pm   Post subject: (No subject)

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

did that make any sense at all to you?
scorpion1087




PostPosted: Tue Nov 25, 2003 6:04 pm   Post subject: (No subject)

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




PostPosted: Tue Nov 25, 2003 6:58 pm   Post subject: (No 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
Mazer




PostPosted: Tue Nov 25, 2003 9:26 pm   Post subject: (No 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?
Andy




PostPosted: Tue Nov 25, 2003 9:33 pm   Post subject: (No subject)

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




PostPosted: Tue Nov 25, 2003 9:39 pm   Post subject: (No 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.
Andy




PostPosted: Tue Nov 25, 2003 9:40 pm   Post subject: (No subject)

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




PostPosted: Wed Nov 26, 2003 5:31 pm   Post subject: (No subject)

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




PostPosted: Wed Nov 26, 2003 6:32 pm   Post subject: (No subject)

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




PostPosted: Wed Nov 26, 2003 6:40 pm   Post subject: (No 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)
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: