Login Page - Create Account

Support Board


Date/Time: Fri, 21 Mar 2025 10:58:18 +0000



Post From: How to center a chart from the ACSIL code ?

[2022-11-16 16:30:02]
JohnR - User831573 - Posts: 320
First, I have not done this in ASCIL or C++, but within your ACSIL code you would read the range and on some cycle (tick, time, etc) then determine if the last price or last bar is over a distance from the center. Then call some other function(s) to update / redraw. or use the C++ code to SendKey the 'End' key. I have not done this, but in a google search in C++ there is info on SendKey with example code and link to key definitions.

It could be an easy way to get this done, by sending END key from within your ACSIL.

https://stackoverflow.com/questions/5607849/how-to-simulate-a-key-press-in-c
how to use sendinput function in C++.
// ...
INPUT ip;
// ...
// Set up a generic keyboard event.
ip.type = INPUT_KEYBOARD;
ip.ki.wScan = 0; // hardware scan code for key
ip.ki.time = 0;
ip.ki.dwExtraInfo = 0;

// Press the "A" key
ip.ki.wVk = 0x41; // virtual-key code for the "a" key
ip.ki.dwFlags = 0; // 0 for key press
SendInput(1, &ip, sizeof(INPUT));
// ...
Virtual-Key Codes page is where the magic number 0x41 came from.
Go to SendInput documentation page. Still don't understand where's the 0x41.
Go to INPUT documentation and from there to KEYBDINPUT documentation. Still no magic 0x41.
Finally go to Virtual-Key Codes page and understand that Microsoft has given the names for Ctrl (VK_CONTROL), Alt (VK_MENU), F1-F24 (VK_F1 - VK_F24, where are 13-24 is a mystery), but forgot to name characters. Actual characters have codes (0x41-0x5A), but don't have names like VK_A - VK_Z I was looking for in winuser.h header.

JohnR