473,909 Members | 2,200 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 1968
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
9552
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
12175
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
6390
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
3228
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
1670
by: nTn | last post by:
I'd like show in my status bar, status of NumLock, CapsLock and ScrollLock. How I do? Thx
10
7810
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 to tell if the state is on/off, etc. TIA Lee
0
1250
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
2217
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() + "|" + e.Alt.ToString() + "|" + e.KeyValue.ToString() + "|" +
3
3957
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
10037
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9879
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11348
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9727
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8099
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5938
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6140
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4776
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
2
4336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.