By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 971 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

Sendkeys in VB6

mafaisal
100+
P: 142
Hello Experts

I am Using VB6,
My doubt is how to send keys in more than one keys
i mean
Windowbutton + D ,Alt+Ctrl+Delete,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
Jan 22 '08 #1
Share this Question
Share on Google+
7 Replies


QVeen72
Expert 100+
P: 1,445
Hi,

Find the proper code and send them continuosly..

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

Regards
Veena
Jan 22 '08 #2

mafaisal
100+
P: 142
Thanx For reply
I want for Windowbutton + D: How to send

Hi,

Find the proper code and send them continuosly..

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

Regards
Veena
Jan 22 '08 #3

QVeen72
Expert 100+
P: 1,445
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 :

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.     Dim Mysh As New Shell32.Shell
  3.     Mysh.MinimizeAll
  4. End Sub
  5.  
Regards
Veena
Jan 22 '08 #4

mafaisal
100+
P: 142
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

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 :

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.     Dim Mysh As New Shell32.Shell
  3.     Mysh.MinimizeAll
  4. End Sub
  5.  
Regards
Veena
Jan 22 '08 #5

debasisdas
Expert 5K+
P: 8,127
You can't handle the window key.
Jan 22 '08 #6

QVeen72
Expert 100+
P: 1,445
Hi,

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

declare this on top of form :
Expand|Select|Wrap|Line Numbers
  1. Private Declare Function LockWorkStation Lib "user32.dll" () As Long
  2.  
  3. Private Sub cmdLock_Click()
  4.     LockWorkStation
  5. End Sub
  6.  

Regards
Veena
Jan 22 '08 #7

mafaisal
100+
P: 142
Hi Veena
Sorry for the delay
Thanx For Replying
It is Working

Faisal

Hi,

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

declare this on top of form :
Expand|Select|Wrap|Line Numbers
  1. Private Declare Function LockWorkStation Lib "user32.dll" () As Long
  2.  
  3. Private Sub cmdLock_Click()
  4.     LockWorkStation
  5. End Sub
  6.  

Regards
Veena
Jan 28 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.