473,574 Members | 3,102 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Numlock Key

Hi

I saw a post about numlock but I can't not read it.

I would like to check the state of the numlock key
and if it's not active, set its status on active.
How can I accomplish that in vb ?

Stan
Nov 20 '05 #1
5 1955
Hi,

API Declare
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Integer) As
Integer

Const VK_CONTROL = 11

Const VK_NUMLOCK = 144

Const VK_CAPLOCK = 20

How to use

Dim strNum As String

If GetKeyState(VK_ NUMLOCK) Then

strNum = "Num"

Else

strNum = ""

End If

Ken

--------------------

"Stan Sainte-Rose" <st**@cyber972. com> wrote in message
news:uw******** *****@TK2MSFTNG P12.phx.gbl...
Hi

I saw a post about numlock but I can't not read it.

I would like to check the state of the numlock key
and if it's not active, set its status on active.
How can I accomplish that in vb ?

Stan

Nov 20 '05 #2
* "Ken Tucker [MVP]" <vb***@bellsout h.net> scripsit:
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Integer) As
Integer


Doesn't 'GetKeyState' return a 'Short' ('Int16')?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
Hi

I thank you for your reply.. :-)
and how can I force the numlock ?
Something like SetKeyState ?

Stan

"Ken Tucker [MVP]" <vb***@bellsout h.net> a écrit dans le message de
news:OC******** ******@TK2MSFTN GP11.phx.gbl...
Hi,
Yes it is a short. My bad.

Ken
--------------
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:ue******** ******@TK2MSFTN GP10.phx.gbl...
* "Ken Tucker [MVP]" <vb***@bellsout h.net> scripsit:
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Integer) As Integer


Doesn't 'GetKeyState' return a 'Short' ('Int16')?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


Nov 20 '05 #4
Hi,

Sorry I dont have an example but look at sendinput and keybd_event
api functions.

http://msdn.microsoft.com/library/de.../sendinput.asp

http://msdn.microsoft.com/library/de...eybd_event.asp
Ken
-------------------
"Stan Sainte-Rose" <st**@cyber972. com> wrote in message
news:OJ******** ******@TK2MSFTN GP10.phx.gbl...
Hi

I thank you for your reply.. :-)
and how can I force the numlock ?
Something like SetKeyState ?

Stan

"Ken Tucker [MVP]" <vb***@bellsout h.net> a écrit dans le message de
news:OC******** ******@TK2MSFTN GP11.phx.gbl...
Hi,
Yes it is a short. My bad.

Ken
--------------
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:ue******** ******@TK2MSFTN GP10.phx.gbl...
>* "Ken Tucker [MVP]" <vb***@bellsout h.net> scripsit:
>> Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Integer) As >> Integer
>
> Doesn't 'GetKeyState' return a 'Short' ('Int16')?
>
> --
> Herfried K. Wagner [MVP]
> <http://www.mvps.org/dotnet>



Nov 20 '05 #5
Ken,

* "Ken Tucker [MVP]" <vb***@bellsout h.net> scripsit:
Sorry I dont have an example but look at sendinput and keybd_event
api functions.

http://msdn.microsoft.com/library/de.../sendinput.asp

http://msdn.microsoft.com/library/de...eybd_event.asp


Maybe somebody wants to translate this VB6 sample:

<http://www.activevb.de/tipps/vb6tipps/tipp0181.html>

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6

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

Similar topics

1
9533
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 "{DOWN}" SendKeys "^{END}" SendKeys "{TAB}" End Sub
5
12128
by: James Kirkup | last post by:
Hello, Does anyone know in code how to turn the NumLock key on in C#? with regards James *** Sent via Developersdex http://www.developersdex.com ***
2
6379
by: Chris | last post by:
can anyone out there tell me how do u check the state of these keys in vb.net? or is there any components in the .NET Framework that supports doing so? any help is appreciated. Thanks.
2
3206
by: Woody Splawn | last post by:
Could someone tell me what code I run to determine if the user's numlock is on? Is there code I can run to set the numlock to on?
1
1661
by: nTn | last post by:
I'd like show in my status bar, status of NumLock, CapsLock and ScrollLock. How I do? Thx
10
7790
by: lgbjr | last post by:
Hi All, In VB.Net how do I determine if CapsLock is on/off (same for NumLock) and whether the input mode is set to Insert or Overwrite (Insert Key). I just added a status bar to my app, and I want to reflect the state of these three items (similar to Word, Excel, etc.) I've found the key enumerator value for each key, but I don't know how...
0
1241
by: =?Utf-8?B?Q29tcHV0ZXJfRW5naW5lZXJfU3R1ZGVudA==?= | last post by:
I'm locking for an C# equivalent to the VBS code On Error Resume Next Set objWord = CreateObject("Word.Application", "" & txtPCName.Value & "") strCapsLock = objWord.CapsLock strNumLock = objWord.Numlock objWord.Quit
0
2197
by: Yusuf Incekara | last post by:
I 've assigned a shortcut key for CTRL+SHIFT+1 key in my application. I can handle these keys in Form's keydown event. private void Form1_Load(object sender, EventArgs e) { this.KeyPreview = true; } private void Form1_KeyDown(object sender, KeyEventArgs e) { label1.Text = e.Control.ToString() + "|" + e.Shift.ToString() + "|" +...
3
3941
by: Z.K. | last post by:
I am trying to detect if the Numlock is pressed. I can do it okay with the CapsLock or the ScrLk, but not with NumLock. The code for all three checks is exactly the same, but for some reason numlock always thinks it is on. Z.K. code:
0
7841
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7758
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8270
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8137
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5335
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3793
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1099
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.