Insert Key on/off


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Insert Key on/off

  1. #1
    rkbnair Guest

    Insert Key on/off


    I want to know whether the "ins" key is on or off while starting an application.
    Can anobody help me, how to use this api function to achieve this. I'm just
    a beginner with API.

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


    Thanks


  2. #2
    mark darbyshire Guest

    Re: Insert Key on/off


    As far as I can tell the GetKeyState API is used for detecting key up / down
    (i.e. if you have shift held down and wanted to detect it you would use this
    API ?)

    You can do as you ask by detecting the properties of the status bar (don't
    forget you can hide it if you dont want to use it)

    I know that this is a crude method but try this
    Click the button and it will report the status of Numlock

    Create a project
    Add a command button
    Add a status bar

    the code will do the rest - paste is in as follows

    Private Sub Command1_Click()
    Response = MsgBox(StatusBar1.Panels.Item(2).Enabled)
    End Sub

    Private Sub Form_Load()
    Dim pnlX As Panel
    Dim I As Integer

    For I = 1 To 2
    Set pnlX = StatusBar1.Panels.Add() ' Add 2 panels.
    Next I

    With StatusBar1.Panels
    .Item(1).Style = sbrCaps ' Caps Lock
    .Item(2).Style = sbrNum ' NumLock
    .Item(3).Style = sbrDate ' Date
    End With

    End Sub




    "rkbnair" <rkannale@solus1.ocea> wrote:
    >
    >I want to know whether the "ins" key is on or off while starting an application.
    >Can anobody help me, how to use this api function to achieve this. I'm just
    >a beginner with API.
    >
    >Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long)
    >As Integer
    >
    >
    >Thanks
    >



  3. #3
    mark darbyshire Guest

    Re: Insert Key on/off


    As far as I can tell the GetKeyState API is used for detecting key up / down
    (i.e. if you have shift held down and wanted to detect it you would use this
    API ?)

    You can do as you ask by detecting the properties of the status bar (don't
    forget you can hide it if you dont want to use it)

    I know that this is a crude method but try this
    Click the button and it will report the status of Numlock

    Create a project
    Add a command button
    Add a status bar

    the code will do the rest - paste is in as follows

    Private Sub Command1_Click()
    Response = MsgBox(StatusBar1.Panels.Item(2).Enabled)
    End Sub

    Private Sub Form_Load()
    Dim pnlX As Panel
    Dim I As Integer

    For I = 1 To 2
    Set pnlX = StatusBar1.Panels.Add() ' Add 2 panels.
    Next I

    With StatusBar1.Panels
    .Item(1).Style = sbrCaps ' Caps Lock
    .Item(2).Style = sbrNum ' NumLock
    .Item(3).Style = sbrDate ' Date
    End With

    End Sub




    "rkbnair" <rkannale@solus1.ocea> wrote:
    >
    >I want to know whether the "ins" key is on or off while starting an application.
    >Can anobody help me, how to use this api function to achieve this. I'm just
    >a beginner with API.
    >
    >Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long)
    >As Integer
    >
    >
    >Thanks
    >



  4. #4
    Mark Darbyshire Guest

    Re: Insert Key on/off


    forgot to include to insert key on the last message use:

    sbrIns

    Mark.

    "rkbnair" <rkannale@solus1.ocea> wrote:
    >
    >I want to know whether the "ins" key is on or off while starting an application.
    >Can anobody help me, how to use this api function to achieve this. I'm just
    >a beginner with API.
    >
    >Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long)
    >As Integer
    >
    >
    >Thanks
    >



  5. #5
    Mark Darbyshire Guest

    Re: Insert Key on/off


    forgot to include to insert key on the last message use:

    sbrIns

    Mark.

    "rkbnair" <rkannale@solus1.ocea> wrote:
    >
    >I want to know whether the "ins" key is on or off while starting an application.
    >Can anobody help me, how to use this api function to achieve this. I'm just
    >a beginner with API.
    >
    >Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long)
    >As Integer
    >
    >
    >Thanks
    >



  6. #6
    rkbnair Guest

    Re: Insert Key on/off


    Mark , Thanks for the reply.

    In fact I tried that method and it was giving me inconsistant return values.
    Is there any alternatives?


    "Mark Darbyshire" <m_darbyshire@hotmail.com> wrote:
    >
    >forgot to include to insert key on the last message use:
    >
    >sbrIns
    >
    >Mark.
    >
    >"rkbnair" <rkannale@solus1.ocea> wrote:
    >>
    >>I want to know whether the "ins" key is on or off while starting an application.
    >>Can anobody help me, how to use this api function to achieve this. I'm

    just
    >>a beginner with API.
    >>
    >>Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long)
    >>As Integer
    >>
    >>
    >>Thanks
    >>

    >



  7. #7
    rkbnair Guest

    Re: Insert Key on/off


    Mark , Thanks for the reply.

    In fact I tried that method and it was giving me inconsistant return values.
    Is there any alternatives?


    "Mark Darbyshire" <m_darbyshire@hotmail.com> wrote:
    >
    >forgot to include to insert key on the last message use:
    >
    >sbrIns
    >
    >Mark.
    >
    >"rkbnair" <rkannale@solus1.ocea> wrote:
    >>
    >>I want to know whether the "ins" key is on or off while starting an application.
    >>Can anobody help me, how to use this api function to achieve this. I'm

    just
    >>a beginner with API.
    >>
    >>Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long)
    >>As Integer
    >>
    >>
    >>Thanks
    >>

    >



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