Solved

simulate alt, ctrl and shift-keys

Posted on 2007-03-31
2
958 Views
Last Modified: 2008-02-01
Hello

I have the following code, but when I use Alt = True, Ctrl = True and Key = Keys.Delete, I do not get the Taskmanager which you should get with ALT, CTRL and DELETE

What is wrong?

   Private Sub DoKeyBoard(ByVal Shift As Boolean, ByVal alt As Boolean, ByVal ctrl As Boolean, ByVal key As Keys)
        Dim KEYEVENTF_KEYUP As Byte = &H2
        If ctrl = True Then
            keybd_event(Keys.ControlKey, 0, 0, 0)              
        End If
        If alt = True Then
            keybd_event(18, 0, 0, 0)            
        End If
        If Shift = True Then
            keybd_event(Keys.ShiftKey, 0, 0, 0)              
        End If
        keybd_event(key, 0, 0, 0)            
        keybd_event(key, 0, KEYEVENTF_KEYUP, 0)
        If Shift = True Then
            keybd_event(Keys.ShiftKey, 0, KEYEVENTF_KEYUP, 0)
        End If
        If alt = True Then
            keybd_event(18, 0, KEYEVENTF_KEYUP, 0)
        End If
        If ctrl = True Then
            keybd_event(Keys.ControlKey, 0, KEYEVENTF_KEYUP, 0) ' Generates a KEY_UP
        End If
    End Sub
0
Comment
Question by:Ruttensoft
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 18830433
You can't generate a Ctrl-Alt-Del combination in this manner.

It is handled by the kernel at a much lower level.

If it was that easy to bring up the task manager it would be a snap to fool the user into typing in their password while your keyboard logger records everything!

To do this you would basically need to write your own GINA.DLL to handle SAS requests:
http://msdn2.microsoft.com/en-us/library/aa380543.aspx

What are you trying to do here?...
0
 

Author Comment

by:Ruttensoft
ID: 18830559
Ok thanks, thats ok.

Actually I am creating a remote control with my POcketPC, and I just wanted to test if the CTRL, ALT and SHIFT-Keys are working correctly. I have now simulated other keystrokes (Ctrl + Esc, Alt + F4) and that is working... Just thought that my code is not working for simulating keystrokes...

Thanks

Sven
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now