473,378 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Sendkeys in VB6

mafaisal
142 100+
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
7 9050
QVeen72
1,445 Expert 1GB
Hi,

Find the proper code and send them continuosly..

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

Regards
Veena
Jan 22 '08 #2
mafaisal
142 100+
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
1,445 Expert 1GB
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
142 100+
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
8,127 Expert 4TB
You can't handle the window key.
Jan 22 '08 #6
QVeen72
1,445 Expert 1GB
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
142 100+
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

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

Similar topics

0
by: Mr. Bungle | last post by:
I would like to send email automatically via a command button. I have accomplished this just fine through the following code: (Outlook should already be open for reliable results) Private Sub...
2
by: RBohannon | last post by:
I need to create a report in MS Word populated with data from A2K. I have been asked to create the report in Word so that parts of it can be edited as necessary later. The data in the report are...
1
by: George | last post by:
Every time I used the Sendkeys command in my application the "Numlock" turned off and I couldn't use the keypad to hit numbers...... The old code was: Private Sub Command1_Click() SendKeys...
5
by: Wayne Gibson | last post by:
Hi, Was wondering if somebody could help.. I'm trying to use Sendkeys on a Windows forms. I have entered the following command to simulate a CTRL+ALT+1.. ...
1
by: Bryan | last post by:
I am writing a C# Windows App that updates out Excel reports' modules. The app is complete, but has a problem. The only way MS allows you to unprotect the VBA code in Excel is to do it by hand or...
1
by: GrantS | last post by:
I need to use a sendkeys key combination to automate the "accept files" that a remote user wants to send to me via Windows messenger. I am using automation to work with Windows Messenger client in...
6
by: Gary | last post by:
Hi, I am trying to use the "System.Windows.Forms.SendKeys" class for triggering the Ctrl+P key. Syntax: System.Windows.Forms.SendKeys.Send("^(P)") This is not working ..what could be the...
6
by: Michael Maes | last post by:
Hello, I'm invoking successive SendKeys.SendWait("{BACKSPACE}") SendKeys.SendWait("{DELETE}") in a loop. The issue is that it causes a Beep on every Pass. Setting the 'Handled = True' on...
2
by: MLH | last post by:
I have the following code with a SendKeys statement in it. 100 If Me.Dirty Then MsgBox "Form is Dirty!" 120 Dim MyQ As String, MyTitle As String, Response As Boolean 140 MyQ =...
0
by: dtshedd | last post by:
I have a database with hundreds of embedded photos (Microsoft Photo 3.0) Many are larger than 1 MB. I tried Stephen Lebans macro but it did not work probably for the aforementioned reasons Now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.