Support Board
Date/Time: Sun, 15 Jun 2025 17:11:26 +0000
Post From: C# program for copying key strokes from one SC instance to another one
[2025-06-04 11:51:08] |
User887627 - Posts: 5 |
Hi SC team, I’m running two instances of Sierra Chart on the same Windows PC and I’m using a custom C# application to mirror keystrokes from one instance (the active one) to the other (in the background). This is to synchronize trading hotkeys between both instances. What works: Regular SC chart hotkeys (like Buy Market, Flatten, Cancel All, etc.) do trigger on the background instance when I mirror the keys using PostMessage or WM_KEYDOWN. What doesn’t work: The Trade Executor study hotkeys (like the one set to Key = 80 for 'P') do not react to mirrored keystrokes. I tried sending the keys via: PostMessage with WM_KEYDOWN / WM_KEYUP SendInput (which only works for the active window) WM_CHAR Various combinations with and without scan codes In all cases, the background SC instance receives the keystroke (verified in logs), but the study does not respond. My suspicion (confirmed by behavior): The study may be using GetAsyncKeyState() or a similar low-level API to detect key presses, which only works for real physical key presses and not simulated ones via Windows messages or injected input. My Question: Is the Trade Executor study designed to respond only to actual physical keyboard input? Or is there a recommended way to trigger its hotkeys externally (e.g. via DTC, shared memory, file commands, or another IPC mechanism)? Thanks in advance! |