Sendkeys in VB6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mafaisal
    New Member
    • Sep 2007
    • 142

    Sendkeys in VB6

    Hello Experts

    I am Using VB6,
    My doubt is how to send keys in more than one keys
    i mean
    Windowbutton + D ,Alt+Ctrl+Delet e,Windowbutton + R etc

    ie For one Key eg : To tab sendkeys (vbtab) or sendkeys("{Tab} ")
    This is only tab button

    so this how to work for morethan one button...?

    Thanks in Advance

    Faisal
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Find the proper code and send them continuosly..

    say this will send Alt+ F4:
    SendKeys "%{F4}"

    Regards
    Veena

    Comment

    • mafaisal
      New Member
      • Sep 2007
      • 142

      #3
      Thanx For reply
      I want for Windowbutton + D: How to send

      Originally posted by QVeen72
      Hi,

      Find the proper code and send them continuosly..

      say this will send Alt+ F4:
      SendKeys "%{F4}"

      Regards
      Veena

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #4
        Hi,

        Not sure if you can send keys for that..
        Another possible solution is Add this Reference to your project:
        "Microsoft Shell Controls And Automation"
        and use this code :

        [code=vb]
        Private Sub Command1_Click( )
        Dim Mysh As New Shell32.Shell
        Mysh.MinimizeAl l
        End Sub
        [/code]

        Regards
        Veena

        Comment

        • mafaisal
          New Member
          • Sep 2007
          • 142

          #5
          Hi
          Thanx For that
          My Usage is When a keypress on command button
          We can lock the computer for that key is Windowbutton + L how to do in VB6

          for that i ask for send keys

          Faisal

          Originally posted by QVeen72
          Hi,

          Not sure if you can send keys for that..
          Another possible solution is Add this Reference to your project:
          "Microsoft Shell Controls And Automation"
          and use this code :

          [code=vb]
          Private Sub Command1_Click( )
          Dim Mysh As New Shell32.Shell
          Mysh.MinimizeAl l
          End Sub
          [/code]

          Regards
          Veena

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            You can't handle the window key.

            Comment

            • QVeen72
              Recognized Expert Top Contributor
              • Oct 2006
              • 1445

              #7
              Hi,

              Yes, it is not possible through SendKeys, You have to use API..

              declare this on top of form :
              [code=vb]
              Private Declare Function LockWorkStation Lib "user32.dll " () As Long

              Private Sub cmdLock_Click()
              LockWorkStation
              End Sub
              [/code]


              Regards
              Veena

              Comment

              • mafaisal
                New Member
                • Sep 2007
                • 142

                #8
                Hi Veena
                Sorry for the delay
                Thanx For Replying
                It is Working

                Faisal

                Originally posted by QVeen72
                Hi,

                Yes, it is not possible through SendKeys, You have to use API..

                declare this on top of form :
                [code=vb]
                Private Declare Function LockWorkStation Lib "user32.dll " () As Long

                Private Sub cmdLock_Click()
                LockWorkStation
                End Sub
                [/code]


                Regards
                Veena

                Comment

                Working...