• Welcome to Valhalla Legends Archive.
 

Quick Question

Started by Reaper~, November 16, 2004, 10:08 PM

Previous topic - Next topic

Reaper~

Hey, I'm making a type of 'prank' program to use on some unlucky sap in school. I have everything going good so far and one of the pieces of coding is:

Private Sub Form_Click()
Unload Me
Form1.Show vbModal
End Sub

So that way if they try clicking on the form, it will only close and bring itself back up again. (I set the cursor icon to nothing to there's no mouse pointer either :P)
But what is a way that I could have the same kind of reaction by say pressing any key on the keyboard?
Take my advice, I'm not using it.

Dyndrilliac

Private Sub Form_KeyPress(KeyAscii as Integer)
If KeyAscii <> 0 Then
Unload Me
Form1.Show vbmodal
End If
End Sub
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

Reaper~

Quote from: Dyndrilliac on November 16, 2004, 10:55 PM
Private Sub Form_KeyPress(KeyAscii as Integer)
If KeyAscii <> 0 Then
Unload Me
Form1.Show vbmodal
End If
End Sub


Didn't do anything.  :-\
Take my advice, I'm not using it.

drivehappy

Why would you want to hide the window then show it again?

Reaper~

Quote from: drivehappy on November 17, 2004, 12:24 AM
Why would you want to hide the window then show it again?
Basically just to screw with the person, isn't it annoying when you close something out and it pops right back up? Esp. when music starts playing everytime the window pops up...
Take my advice, I'm not using it.

MyndFyre

Quote from: Reaper~ on November 17, 2004, 12:53 AM
Quote from: drivehappy on November 17, 2004, 12:24 AM
Why would you want to hide the window then show it again?
Basically just to screw with the person, isn't it annoying when you close something out and it pops right back up? Esp. when music starts playing everytime the window pops up...

So basically.....  You're a sociopath?
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

LivedKrad

Sociopath? Nah. Come on MyndFyre, where's your sense of humor! Obviously this is a very funny prank that will get even the teachers laughing, hahaha. Good joke man, keep it up!

The-FooL

Ctrl+Alt+Delete= end of prank.

Reaper~

Quote from: The-FooL on November 17, 2004, 04:30 PM
Ctrl+Alt+Delete= end of prank.

Wouldn't disabling any keypress stop that?
Take my advice, I'm not using it.

Dyndrilliac

No, and for my answer Form1 the form needs to be in focus.
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

UserLoser.

Quote from: Reaper~ on November 17, 2004, 04:41 PM
Quote from: The-FooL on November 17, 2004, 04:30 PM
Ctrl+Alt+Delete= end of prank.

Wouldn't disabling any keypress stop that?

See SystemParametersInfo and SPI_SETSCREENSAVERRUNNING

LivedKrad

If the application only incoporates a Form, wouldn't the closing of the Form end the application?

MyndFyre

Quote from: UserLoser on November 17, 2004, 06:29 PM
Quote from: Reaper~ on November 17, 2004, 04:41 PM
Quote from: The-FooL on November 17, 2004, 04:30 PM
Ctrl+Alt+Delete= end of prank.

Wouldn't disabling any keypress stop that?

See SystemParametersInfo and SPI_SETSCREENSAVERRUNNING

All it says is that it is used internally for Win95/98.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

UserLoser.

#13
Quote from: MyndFyre on November 18, 2004, 08:01 AM
Quote from: UserLoser on November 17, 2004, 06:29 PM
Quote from: Reaper~ on November 17, 2004, 04:41 PM
Quote from: The-FooL on November 17, 2004, 04:30 PM
Ctrl+Alt+Delete= end of prank.

Wouldn't disabling any keypress stop that?

See SystemParametersInfo and SPI_SETSCREENSAVERRUNNING

All it says is that it is used internally for Win95/98.

Right, but correct me if I'm wrong: when a screensaver is running, Windows key, Alt+Tab, Ctrl+Alt+Del, [possibly more] ..., combinations are disabled (I wrote a similiar application at school last year, except it had no control bar at the top of the window, was unmoveable, and was always on top, I challenged the whole class to try and close it; and if someone did I'd pay them a dollar).  Btw, on Form_Unload, just do:


Cancel = 1 'Won't close when 'X' button is pressed


Note: This was on Windows 98 at school.  MSDN does not say if it'll work on any systems newer than 98, though

Reaper~

#14
UserLoser, this is probably a lot like yours. No controlbar, won't move, etc.. that's all I'm trying to do is make it uncloseable unless computer is shut off or something. Also,
Quote

Cancel = 1 'Won't close when 'X' button is pressed


Doesn't work..
"Compile Error:
Procedure declaration does not match description of event or procedure having the same name"
Take my advice, I'm not using it.