dot net equiv of key code constants?

M

mp

any clue how to translate this to dotnet, since vbkeycode constants
apparently dont exist there(that i can find)
Public Const VK_SPACEBAR = vbKeySpace
?

as in
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As
Integer
If GetAsyncKeyState(VK_SPACEBAR) Then
...


the closest thing i could find in help was in windows.forms keyeventarg or
such
couldn't figure out how to use that plus the project wasn't using winforms
for anything else

thanks
mark
 
A

Armin Zingler

mp said:
any clue how to translate this to dotnet, since vbkeycode constants
apparently dont exist there(that i can find)
Public Const VK_SPACEBAR = vbKeySpace
?

as in
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As
Integer
If GetAsyncKeyState(VK_SPACEBAR) Then
...


the closest thing i could find in help was in windows.forms keyeventarg or
such
couldn't figure out how to use that plus the project wasn't using winforms
for anything else

It's not mentioned here

http://msdn.microsoft.com/en-us/library/aa302340.aspx#win32map_keyboardinputfunctions

and I didn't find it in the Framework, so I guess you have to use the API function.
Don't forget to change Long to Integer and Integer to Short.
 
F

Family Tree Mike

any clue how to translate this to dotnet, since vbkeycode constants
apparently dont exist there(that i can find)
Public Const VK_SPACEBAR = vbKeySpace
?

as in
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As
Integer
If GetAsyncKeyState(VK_SPACEBAR) Then
...


the closest thing i could find in help was in windows.forms keyeventarg or
such
couldn't figure out how to use that plus the project wasn't using winforms
for anything else

thanks
mark

Sorry if this is not what you were asking for, as I have had a long
day... The Virtual Key definitions can be copied from
http://www.pinvoke.net/default.aspx/Enums/VirtualKeys.html, for use in a
VB.Net application.

That site is a good one to keep in your favorites.
 
C

Cor Ligthert[MVP]

I never use these so called constants, does remember me to much of the bad
old days.

I simply use the value what they represent.

Success

Cor
 
H

Herfried K. Wagner [MVP]

Am 22.12.2009 09:19, schrieb Cor Ligthert[MVP]:
I never use these so called constants, does remember me to much of the
bad old days.

I simply use the value what they represent.

How to transfer 'GetAsyncKeyState' to the .NET world then?
 
C

Cor Ligthert[MVP]

Herfried,

To be honest, I use them seldom, I never was a real VB6 developer you know.

The only way I know sometimes use them in Net is with that removing of the
minimize box you once showed.

(Probably some more, but I forget them forever)

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top