Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 132,157 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,791 people online right now. Registration is fast and FREE... Join Now!




What's wrong with my Hot Key Function?

 
Reply to this topicStart new topic

What's wrong with my Hot Key Function?, It worked with this one test application but won't work with my pr

EvolutionMedia
post 7 Oct, 2008 - 08:00 PM
Post #1


D.I.C Head

**
Joined: 11 Aug, 2008
Posts: 83



Thanked 1 times
My Contributions


So, I'm able to hide the applicatin when you click on the close button. However, I want the users to be able to put the prgram in Stealth Mode with combination Key Pressed. I made a function that is able to regonize multiple key strokes and worked with this test program. However, I implemeded the same code to Prankzter and it won't work.

Here's the routine:

CODE


    Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal keyCode As Integer) As Short
    Public Sub HotKeyPressed(ByVal Action as String, ByVal key1 As Integer, ByVal key2 As Integer)
        If GetAsyncKeyState(key1) And GetAsyncKeyState(key2) Then
            If Action = "show" Then
                    form1.show()
            End If
            If Action = "hide" Then
                    form1.hide()
             End If

        End If

    End Sub



I had the function say label1.text = "F**k you" so i changed it to suite what I wanted it to do. So, it wasn't working so that's then changed the function to see if it was capturing key strokes. But appearently it hasn't.

I pujt it in the Form1_KeyDown and tried it in various ways in Form1_KeyUp then Form1_KeyPress but neither worked. I noticed that one of the Radio buttons on focus but I don't know if that has to do with anything detecting key strokes.

Any suggestions?

Thanks!

I don't understand why it worked in the example test and won't work in this app. Also inside the Form1_KeyDown:

CODE


  HotKeyPressed(Keys.ControlKey, Keys.S)



Thanks again!

-Paul
User is offlineProfile CardPM

Go to the top of the page

EvolutionMedia
post 7 Oct, 2008 - 08:37 PM
Post #2


D.I.C Head

**
Joined: 11 Aug, 2008
Posts: 83



Thanked 1 times
My Contributions


Okay, what I collect is that there's something wrong with the funciton because if you do the getasynckeypress it will register so it has to be the routine.


Fixed it! Thanks - ha ha!

I should try it out first then post huh? LOL! smile.gif

-Evolution
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/21/08 01:58PM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month