dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Ascii code!

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Ascii code!

    [Originally posted by Fakhir]

    i know the scan code(ascii code) of caps lock and i want to on it when i press the command button by calling the keypress event of form.
    anyone can help me?
    Fakhir.

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Ascii code!

    [Originally posted by Nick Dawkes]

    Check out the help on SendKeys
    what you wnt is
    SendKeys {CAPSLOCK}
    Hope it helps
    nick

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Ascii code!

    [Originally posted by neophile]

    This should do the trick ;)...



    Public Sub ToggleCapsLock(Optional ByVal Toggled)
    Dim bKeys() As Byte
    Dim bSet As Boolean
    ReDim bKeys(0 To 255)
    Call GetKeyboardState(bKeys(0))
    bSet = (bKeys(vbKeyCapital) And 1)
    If IsMissing(Toggled) Or (bSet <> CBool(Toggled)) Then
    bKeys(vbKeyCapital) = bKeys(vbKeyCapital) Xor 1
    End If
    Call SetKeyboardState(bKeys(0))
    Erase bKeys
    End Sub



    If you leave out the Toggled parameter, it will invert the capslock state. Specifying the parameter as True or False will turn on or off the capslock, respectively. Have fun ;)

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Ascii code! Oops... the declares..

    [Originally posted by neophile]

    Private Declare Function GetKeyboardState Lib "user32" (kbArray As Any) As Long
    Private Declare Function SetKeyboardState Lib "user32" (kbArray As Any) As Long



    ... Sorry about that. You need those ;)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center