Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. KeyBoard event when form is not active?

KeyBoard event when form is not active?

Scheduled Pinned Locked Moved C#
tutorialquestion
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Frozzeg
    wrote on last edited by
    #1

    How to do? or in somewise make form always active P.S. sorry for my bad english

    S S M 3 Replies Last reply
    0
    • F Frozzeg

      How to do? or in somewise make form always active P.S. sorry for my bad english

      S Offline
      S Offline
      Shyam K Pananghat
      wrote on last edited by
      #2

      Try the form's Deactivate event. Or setting forms Top most property ot true.. But i believe that this works only among .Net apps

      Shyam.. My Blog dotnetscoups.blogspot.com

      1 Reply Last reply
      0
      • F Frozzeg

        How to do? or in somewise make form always active P.S. sorry for my bad english

        S Offline
        S Offline
        sanforjackass
        wrote on last edited by
        #3

        //this code from codeproject.com i could give you the keyward //but i forget it so... //this code in main form and the other in new class.....have fun UserActivityHook u; string s = ""; private void Form1_Load(object sender, EventArgs e) { u = new UserActivityHook(); u.KeyPress += new KeyPressEventHandler(Form1_KeyPress); } private void Form1_KeyPress(object sender, KeyPressEventArgs e) { s += e.KeyChar.ToString(); } ------------------------------------ using System; using System.Runtime.InteropServices; using System.Reflection; using System.Threading; using System.Windows.Forms; using System.ComponentModel; namespace gma.System.Windows { /// <summary> /// This class allows you to tap keyboard and mouse and / or to detect their activity even when an /// application runes in background or does not have any user interface at all. This class raises /// common .NET events with KeyEventArgs and MouseEventArgs so you can easily retrive any information you need. /// </summary> public class UserActivityHook { #region Windows structure definitions /// <summary> /// The POINT structure defines the x- and y- coordinates of a point. /// </summary> /// <remarks> /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/rectangl\_0tiq.asp /// </remarks> [StructLayout(LayoutKind.Sequential)] private class POINT { /// <summary> /// Specifies the x-coordinate of the point. /// </summary> public int x; /// <summary> /// Specifies the y-coordinate of the point. /// </summary> public int y; } /// <summary> /// The MOUSEHOOKSTRUCT structure contains information about a mouse event passed to a WH_MOUSE hook procedure, MouseProc. /// </summary> /// <remarks> /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookstructures/cwpstruct.asp /// </remarks> [StructLayout(LayoutKind.Sequential)] private class MouseHookStruct { /// <summary> /// Specifies a POINT structure that contains the x- and y-coordinates of the cursor,

        X 1 Reply Last reply
        0
        • S sanforjackass

          //this code from codeproject.com i could give you the keyward //but i forget it so... //this code in main form and the other in new class.....have fun UserActivityHook u; string s = ""; private void Form1_Load(object sender, EventArgs e) { u = new UserActivityHook(); u.KeyPress += new KeyPressEventHandler(Form1_KeyPress); } private void Form1_KeyPress(object sender, KeyPressEventArgs e) { s += e.KeyChar.ToString(); } ------------------------------------ using System; using System.Runtime.InteropServices; using System.Reflection; using System.Threading; using System.Windows.Forms; using System.ComponentModel; namespace gma.System.Windows { /// <summary> /// This class allows you to tap keyboard and mouse and / or to detect their activity even when an /// application runes in background or does not have any user interface at all. This class raises /// common .NET events with KeyEventArgs and MouseEventArgs so you can easily retrive any information you need. /// </summary> public class UserActivityHook { #region Windows structure definitions /// <summary> /// The POINT structure defines the x- and y- coordinates of a point. /// </summary> /// <remarks> /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/rectangl\_0tiq.asp /// </remarks> [StructLayout(LayoutKind.Sequential)] private class POINT { /// <summary> /// Specifies the x-coordinate of the point. /// </summary> public int x; /// <summary> /// Specifies the y-coordinate of the point. /// </summary> public int y; } /// <summary> /// The MOUSEHOOKSTRUCT structure contains information about a mouse event passed to a WH_MOUSE hook procedure, MouseProc. /// </summary> /// <remarks> /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookstructures/cwpstruct.asp /// </remarks> [StructLayout(LayoutKind.Sequential)] private class MouseHookStruct { /// <summary> /// Specifies a POINT structure that contains the x- and y-coordinates of the cursor,

          X Offline
          X Offline
          Xmen Real
          wrote on last edited by
          #4

          nice :wtf:

          TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can

          1 Reply Last reply
          0
          • F Frozzeg

            How to do? or in somewise make form always active P.S. sorry for my bad english

            M Offline
            M Offline
            Muammar
            wrote on last edited by
            #5

            this.KeyPreview = true; should do it perfectly!


            All generalizations are wrong, including this one! (\ /) (O.o) (><)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups