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 9017391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:15:44+00:00 2026-06-16T04:15:44+00:00

I am building an multimedia console based on an old computer running Win7. I

  • 0

I am building an multimedia console based on an old computer running Win7.

I want to control the players with a numeric keyboard.
I can’t use the common media control devices because they respond only to windows media player. I will use the KVM Player, Winamp and others. So each one has it’s own set of keyboard shortcuts for play, pause, foward, volume etc.

For that I am thinking of building a Delphi application that detects the foreground application and gets from a database the shortcuts this application uses.

When I use the numeric keyboard (the size of a regular remote control) and press 5 for play, my application could detect it and send to the OS the P key if I am using Winamp or Space if I am using Media Player Classic.

What functions should I use to first grab the pressed key and then send a different key?

  • 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-16T04:15:45+00:00Added an answer on June 16, 2026 at 4:15 am

    Part of the solution can be use a Keyboard Hook (WH_KEYBOARD_LL) to capture a special key combination or a single key and then use the keybd_event function to send (replace) another keystroke.

    Try this sample code which intercepts the VK_UP key and send a S

    var
     hhk: HHOOK;
    
    
    function CBT_FUNC(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
    
    
    type
      PKBDLLHOOKSTRUCT = ^TKBDLLHOOKSTRUCT;
      TKBDLLHOOKSTRUCT = record
        vkCode: cardinal;
        scanCode: cardinal;
        flags: cardinal;
        time: cardinal;
        dwExtraInfo: Cardinal;
      end;
      PKeyboardLowLevelHookStruct = ^TKeyboardLowLevelHookStruct;
      TKeyboardLowLevelHookStruct = TKBDLLHOOKSTRUCT;
    
    var
     LKBDLLHOOKSTRUCT: PKeyboardLowLevelHookStruct;
    begin
       case nCode of
         HC_ACTION:
         begin
           LKBDLLHOOKSTRUCT := PKeyboardLowLevelHookStruct(lParam);
            if (LKBDLLHOOKSTRUCT^.vkCode = VK_UP)  then
            begin
    
              if (wParam=WM_KEYUP) or (wParam=WM_SYSKEYUP)then
               keybd_event( Ord('S'), 0, KEYEVENTF_KEYUP, 0)
              else
               keybd_event( Ord('S'), 0, 0, 0);
    
              Exit(1); //eat the key
            end;
         end;
       end;
      Result := CallNextHookEx(hhk, nCode, wParam, lParam);
    end;
    
    Procedure InitHook();
    begin
      hhk := SetWindowsHookEx(WH_KEYBOARD_LL, @CBT_FUNC, 0, 0);
      if hhk=0 then RaiseLastOSError;
    end;
    
    
    Procedure KillHook();
    begin
      if (hhk <> 0) then
        UnhookWindowsHookEx(hhk);
    end;
    
    
    initialization
      InitHook();
    
    finalization
      KillHook();
    end.
    

    Before to use this kind of hook remember read the documentation, specifically the remarks section.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Building an ASP.NET MVC3 application at work and I'm trying to use a program
Building an NSCharacter set to restrict a UITextField for entering user names. I want
Building a website using a PHP based Ecommerce product Magento. The problem I have
Building a site so users can add topics onto a site and ask then
Building off Does Perl have an enumeration type? , how can I perform dynamic
Building my first serious Node.js project (using Express). I need to use several calls
Building pHash 0.9.4 on OSX can turn out to be tricky. For those of
Building a Shopping Cart app. Some products have options, some don't. I visitor can
Building a comment system with Ajax and JQuery and I want the div the
Building a form for users to submit data. I can't seem to understand or

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.