How to Piggyback a Keypress?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Is there a easy way to resend the KeyPress to the window after
capturing a hotkey?

protected override void WndProc(ref Message m) {
base.WndProc(ref m);
if(m.Msg == WM_HOTKEY) {
if(m.WParam == myHotkeyID) /* Do What I Want to
Do */
Resend the Key Pressed to the application without
triggering the hotkey message again.
}
}
}

it works if I use the C# "SendKeys.Send(...)", and mimics the "ctrl/
shift/alt modifiers" nicely, but the hotkeys are defined by the user,
and converting the "Keys.___" to a string manually is hard at times...
"IE Keys.OemTilda.ToString()" != "`"

Is using PostMessage the easiest? Getting the SYSKEYDOWN, KEYDOWN,
lParam Mimic etc all perfect would take a tiny bit..

Would there be a trick with the DefWndProc/DefWindowProc I could use?

.



Relevant Pages

  • Re: How to Piggyback a Keypress?
    ... If all you want to do is do your processing, then let the application react normally to the keypress, then have done it already by calling the WndProc method on the base implementation. ... protected override void WndProc{ ... Resend the Key Pressed to the application without ... triggering the hotkey message again. ...
    (microsoft.public.dotnet.languages.csharp)
  • Find Mouse Clicks (When App isnt Focused)
    ... protected override void WndProc{ ... to caputre the left clicks eventhough it says it successfully ... registered the hotkey. ... The hotkey method works if I change the "Keys.LButton" to ...
    (microsoft.public.dotnet.languages.csharp)