473,394 Members | 1,726 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,394 software developers and data experts.

Holding down keys II

In my never ending search I found code that might help me to simulate
holding down keys:

http://www.developerfusion.co.uk/show/68/2/

However, when I copy and paste, I get the errors;

KeyCodeConstants is not defined

and

vbKeyShift is not declared

Would I put the HEX equivalents? I am new to vb.net and unsure of what to
do.
Jul 20 '06 #1
3 2821
Daniel,

I am sure that you got at least 2 solutions to your problem in this
newsgroup. Why are you than trying to get help for a solution which comes
from another board?

Cor

"Daniel N" <sa***********@yahoo.comschreef in bericht
news:%i***************@fe10.lga...
In my never ending search I found code that might help me to simulate
holding down keys:

http://www.developerfusion.co.uk/show/68/2/

However, when I copy and paste, I get the errors;

KeyCodeConstants is not defined

and

vbKeyShift is not declared

Would I put the HEX equivalents? I am new to vb.net and unsure of what to
do.


Jul 20 '06 #2
"Daniel N" <sa***********@yahoo.comschrieb:
In my never ending search I found code that might help me to simulate
holding down keys:

http://www.developerfusion.co.uk/show/68/2/

However, when I copy and paste, I get the errors;

KeyCodeConstants is not defined
First, the declarations in the article above are written for VB6. The key
codes can be extracted from the according header file (check out the MSDN
documentation on 'keybd_event' to determine the header file.

\\
Private Declare Sub keybd_event Lib "user32.dll" ( _
ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Int32, _
ByVal dwExtraInfo As Int32 _
)

Private Const KEYEVENTF_KEYUP As Int32= &H2
Private Const VK_LWIN As Byte = &H5B
Private Const VK_APPS As Byte = &H5D
Private Const VK_CONTROL As Byte = &H11
Private Const VK_ESCAPE As Byte = &H1B

Public Sub PopUp()
keybd_event(VK_LWIN, 0, 0, 0)
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0)
End Sub

Public Sub PopUpCtrlEsc()
keybd_event(VK_CONTROL, 0, 0, 0)
keybd_event(VK_ESCAPE, 0, 0, 0)
keybd_event(VK_ESCAPE, 0, KEYEVENTF_KEYUP, 0)
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0)
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jul 20 '06 #3
Herfried,

Does that mean that your previous answer was wrong?

Maybe it is wise to set that in that message for others who are searching on
that?

Cor

"Herfried K. Wagner [MVP]" <hi***************@gmx.atschreef in bericht
news:OL****************@TK2MSFTNGP04.phx.gbl...
"Daniel N" <sa***********@yahoo.comschrieb:
>In my never ending search I found code that might help me to simulate
holding down keys:

http://www.developerfusion.co.uk/show/68/2/

However, when I copy and paste, I get the errors;

KeyCodeConstants is not defined

First, the declarations in the article above are written for VB6. The key
codes can be extracted from the according header file (check out the MSDN
documentation on 'keybd_event' to determine the header file.

\\
Private Declare Sub keybd_event Lib "user32.dll" ( _
ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Int32, _
ByVal dwExtraInfo As Int32 _
)

Private Const KEYEVENTF_KEYUP As Int32= &H2
Private Const VK_LWIN As Byte = &H5B
Private Const VK_APPS As Byte = &H5D
Private Const VK_CONTROL As Byte = &H11
Private Const VK_ESCAPE As Byte = &H1B

Public Sub PopUp()
keybd_event(VK_LWIN, 0, 0, 0)
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0)
End Sub

Public Sub PopUpCtrlEsc()
keybd_event(VK_CONTROL, 0, 0, 0)
keybd_event(VK_ESCAPE, 0, 0, 0)
keybd_event(VK_ESCAPE, 0, KEYEVENTF_KEYUP, 0)
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0)
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jul 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Richard Coutts | last post by:
I have a Continous Form with 5 or so fields for each record, in a line from left to right. Because the Contuous Form lists several records at once, the form looks pretty much like a Datasheet. ...
2
by: Darren Oakey | last post by:
ok - the problem - I made a simple breakout game out of a form, just painting the background - and using keydown for left and right arrow keys to control the bat - worked fine. I then moved all...
2
by: foo | last post by:
Hello, I can trap alphanumeric keys wih this code but the event doesn't even fire when a page down, page up, home, end is pressed. I've overloaded the OnKeyPress event for the form. The event...
10
by: Bob | last post by:
Hello: I'm tring to make the down arrow act as a tab key and the up arrow act as like (-TAB.). I have this for the down arrow but nothing happens. Protected Overrides Function...
16
by: Ben | last post by:
I'm doing a bunch of data mining against a postgres database and have run into an interesting problem with deadlocks. The problem is, postgres is detecting them and then wacking the offending...
2
by: Daniel N | last post by:
Is there a way to hold down keys in vb.net? In the program I am writing I can simulate a MOUSE button hold down: Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx...
0
by: Andrus | last post by:
I have combobox column in DataGridView. Up and down error keys should be used to navigate previous and next row in grid. For this I override them in ProcessCmdKey() event. When combobox...
16
by: ImpactMan | last post by:
Need help to create an windows mobile application with a few buttons that when they are pressed/clicked they assign keys, like up, down, left, right. It is just like to create a "virtual d-pad",...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.