Setting Caps, Insert and Num Lock programmatically 
Author Message
 Setting Caps, Insert and Num Lock programmatically

Greetings,

Is there a way to turn the caps lock, the insert key, and the num lock key
on and off programmatically?

Shahin



Thu, 21 Jul 2005 17:09:31 GMT  
 Setting Caps, Insert and Num Lock programmatically
Hi Shahin,

It's pretty easy in vb .net:
SendKeys.Send("{INSERT}")

SendKeys.Send("{NUMLOCK}")

SendKeys.Send("{CAPSLOCK}")

I haven't actually tested these, but my guess is that they work like a
toggle - if on, this turns them off; if off, this turns them on.

HTH,

Bernie Yaeger


Quote:
> Greetings,

> Is there a way to turn the caps lock, the insert key, and the num lock key
> on and off programmatically?

> Shahin



Thu, 21 Jul 2005 19:05:24 GMT  
 Setting Caps, Insert and Num Lock programmatically
I tried to put this in the form load event to turn the NUMLOCK on but it did
not work. Any idea.

Shahin


Quote:
> Hi Shahin,

> It's pretty easy in vb .net:
> SendKeys.Send("{INSERT}")

> SendKeys.Send("{NUMLOCK}")

> SendKeys.Send("{CAPSLOCK}")

> I haven't actually tested these, but my guess is that they work like a
> toggle - if on, this turns them off; if off, this turns them on.

> HTH,

> Bernie Yaeger



> > Greetings,

> > Is there a way to turn the caps lock, the insert key, and the num lock
key
> > on and off programmatically?

> > Shahin



Fri, 22 Jul 2005 04:15:58 GMT  
 Setting Caps, Insert and Num Lock programmatically
Hi Shahin,

Very interesting.  I tried it and it failed as well, but then I tried
SendKeys.Send("{DOWN}")

and that correctly moved the cursor down one row (in a grid).

I will write to MS to see what they know; I will also try a few things with
the api and other things to see if we can solve this.

Regards,

Bernie Yaeger


Quote:
> I tried to put this in the form load event to turn the NUMLOCK on but it
did
> not work. Any idea.

> Shahin



> > Hi Shahin,

> > It's pretty easy in vb .net:
> > SendKeys.Send("{INSERT}")

> > SendKeys.Send("{NUMLOCK}")

> > SendKeys.Send("{CAPSLOCK}")

> > I haven't actually tested these, but my guess is that they work like a
> > toggle - if on, this turns them off; if off, this turns them on.

> > HTH,

> > Bernie Yaeger



> > > Greetings,

> > > Is there a way to turn the caps lock, the insert key, and the num lock
> key
> > > on and off programmatically?

> > > Shahin



Fri, 22 Jul 2005 04:54:49 GMT  
 Setting Caps, Insert and Num Lock programmatically
Shahin,

On Sun, 2 Feb 2003 12:15:58 -0800

inline...

Quote:
> I tried to put this in the form load event to turn the NUMLOCK on but it did
> not work. Any idea.

This is known issue for older version of Visual Basic. I
don't know that Visual Basic .NET has same problem or not.

But, Also the SendKeys statement is known that it occurs
some troubles. Please check next web site...

http://www.mvps.org/access/api/api0046.htm

---
| aMailAddress |



Fri, 22 Jul 2005 05:19:53 GMT  
 Setting Caps, Insert and Num Lock programmatically
Sorry, I apologise and adjust my reply. The known issue is
not NumLock. That is PrintScreen problem.

On Mon, 03 Feb 2003 06:19:53 +0900

---
| aMailAddress |



Fri, 22 Jul 2005 05:36:17 GMT  
 Setting Caps, Insert and Num Lock programmatically
Hi Shahin,

You can use the keybd_event or SendInput function via Platform Invoke to
toggle these keys. For example:

    Const VK_CAPITAL = &H14
    Const VK_NUMLOCK = &H90
    Const KEYEVENTF_EXTENDEDKEY = &H1
    Const KEYEVENTF_KEYUP = &H2

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

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
        keybd_event(VK_NUMLOCK, &H45, 0, 0)
        keybd_event(VK_NUMLOCK, &H45, KEYEVENTF_KEYUP, 0)
    End Sub

Hope this helps.

Regards,

Felix Wu
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

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

Quote:

>Subject: Setting Caps, Insert and Num Lock programmatically
>Date: Sun, 2 Feb 2003 01:09:31 -0800
>Lines: 8
>Organization: Valleris, Inc
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106

>Newsgroups: microsoft.public.dotnet.languages.vb
>NNTP-Posting-Host: 7.227.nwc.net 207.151.227.7
>Path: cpmsftngxa08!cpmsftngxa06!TK2MSFTNGP08!TK2MSFTNGP09
>Xref: cpmsftngxa08 microsoft.public.dotnet.languages.vb:87944
>X-Tomcat-NG: microsoft.public.dotnet.languages.vb

>Greetings,

>Is there a way to turn the caps lock, the insert key, and the num lock key
>on and off programmatically?

>Shahin



Fri, 22 Jul 2005 12:21:45 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Setting Num Lock and Caps Lock key states

2. GetKeyState for Caps Lock or Num Lock...

3. disabling num, caps, and scroll lock

4. How do I detect Caps/Num lock?

5. Detect if Laptop Docked and Set Num Lock Accordingly

6. Setting NUM LOCK in code

7. Setting caps lock

8. Setting "Caps Lock" on run time

9. Setting Caps Lock with API - Need VB Help

10. Caps Lock Setting ?

11. Set Caps Lock

12. Setting CAPS Lock ON

 

 
Powered by phpBB® Forum Software