Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7962595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:22:51+00:00 2026-06-04T05:22:51+00:00

I have an application which uses hotkeys which are to be defined by the

  • 0

I have an application which uses hotkeys which are to be defined by the user. It is a combination of 2 keys, either CTRL, ALT, SHIFT as one hotkey and the F* Function keys as the other (e.g. CTRL + F1, ALT + F2 or SHIFT + F8) As stated these are then chosen by the user before a global keyhook is put in place to listen for them and trigger an event. In my app I have all my function keys as follows:

  Public Const VK_F1 = &H70
  Public Const VK_F2 = &H71
  Public Const VK_F3 = &H72
  Public Const VK_F4 = &H73

etc etc…

Here is the code I am using the catch the key combinations:

      If (Hookstruct.vkCode = VK_F5) And _
        CBool(Hookstruct.flags And _
        LLKHF_ALTDOWN) Then
        'TriggerEventHere

        'Return True
    End If

I also have Two combo boxes for the user to select ALT, CTRL, SHIFT in one combobox and the Function keys in the other. I then have a button which activates the hook.

My question is this; how can I use the user information from the comboboxes to set the relevant key combinations in my code when the app is running?

Thanks for taking the time to read this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:22:53+00:00Added an answer on June 4, 2026 at 5:22 am

    how can I use the user information from the comboboxes to set the relevant key combinations in my code when the app is running?

    1. Set the form’s KeyPreview property to true (this will capture all the key strokes at the form level). E.g.:

      KeyPreview = true
      
    2. In the Form1_KeyDown event you can look up the Key combinations defined by the user, i.e. these could be stored in a List(Of KeyPresses) where KeyPresses is a class (tip: use the KeyEventArgs class as inspiration) that has the user-defined key combinations.

    3. At run-time, after users save key press combinations, when they do key presses, it will fire the KeyDown event, and you’ll check the List(Of KeyPresses) and trigger an event:

      Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) _
         Handles MyBase.KeyDown
            ' Test for the Alt key
            If e.Alt = KeyPressesList(0).Alt Then
                MessageBox.Show("Alt was pressed")
            End If
      End Sub
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which uses version 8.0.50727.5592 of the CRT. One of the
I have a application which uses two instances of one TableViewController in two different
I have one application which uses the standard .NET forms authentication cookie, now I
I have an application which uses a key combination that is composed of more
I have one application which uses NHibernate to save entities to a database, and
I have an application which uses Audio Queues to do recording of spoken user
I have an application which uses PreviewKeyDown to capture CTRL X keystrokes (where X
I have an application which uses four databases in different geographical locations. All the
I have an application which uses libuv library. it runs default loop: uv_run(uv_default_loop()); How
I have an application which uses the Word and Excel interop references. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.