Results 1 to 7 of 7

Thread: [RESOLVED] Hidden Trick

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Location
    England
    Posts
    79

    Resolved [RESOLVED] Hidden Trick

    I'm nearing completion on a product for the company I work at and I want to add a little extra to it...

    The app loads up fine, im just adding a reporting feature at the moment, but what I want to add is this:

    When the app loads, if the user holds down - Ctrl + Alt + J + N

    Those four keys, a popup box will come up saying "Coded by Justin Nel" and possibly loads up an image file which would be embedded into the actual EXE.

    How could I do such a thing?

    Cheers

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Hidden Trick

    I don't think you'll be able to do it with Ctrl+Alt because you can't detect consecutive KeyDown events for different keys with the Alt key down. This works with Ctrl+Shift. Set the form's KeyPreview property to True and:
    VB Code:
    1. Private jDown As Boolean = False 'Whether the J key is depressed.
    2.     Private nDown As Boolean = False 'Whether the N key is depressed.
    3.  
    4.     Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
    5.         If e.KeyCode = Keys.J Then
    6.             Me.jDown = True
    7.         ElseIf e.KeyCode = Keys.N Then
    8.             Me.nDown = True
    9.         End If
    10.  
    11.         If e.Control AndAlso e.Shift AndAlso Me.jDown AndAlso Me.nDown Then
    12.             MessageBox.Show("Coded by Justin Nel")
    13.         End If
    14.     End Sub
    15.  
    16.     Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
    17.         If e.KeyCode = Keys.J Then
    18.             Me.jDown = False
    19.         ElseIf e.KeyCode = Keys.N Then
    20.             Me.nDown = False
    21.         End If
    22.     End Sub
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Location
    England
    Posts
    79

    Re: Hidden Trick

    Perfect!

  4. #4
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: [RESOLVED] Hidden Trick

    I did something similar where you clicked the form hit space 3 times and then let go of the mouse.
    I don't live here any more.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Location
    England
    Posts
    79

    Re: [RESOLVED] Hidden Trick

    Quote Originally Posted by wossname
    I did something similar where you clicked the form hit space 3 times and then let go of the mouse.
    Sounds interesting, care to share?

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] Hidden Trick

    By the way, this type of "hidden goodie" is called an Easter Egg.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    384

    Re: [RESOLVED] Hidden Trick

    Quote Originally Posted by wossname
    I did something similar where you clicked the form hit space 3 times and then let go of the mouse.
    How can I do something like that?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width