Download MetaTrader 5
To add comments, please log in or register
Why to sell products in MetaTrader AppStore? Find that out from the article!
Nikolay
170
Nikolay 2016.05.05 12:24 

How can I program triggering a key press/event?

For the following use case: Normally one can zoom with the "+" and "-" keys, but I would like to zoom with "q" and "r" and my idea is when "q" is pressed to trigger pressing the "+" key. Or are there better ideas how to create this use case?

Keith Watford
Moderator
7875
Keith Watford 2016.05.05 12:55  
Do you know that you can click and drag the date/time axis. Right to zoom in, left to zoom out.
Nikolay
170
Nikolay 2016.05.05 12:56  

I found it:


#import "user32.dll"

void keybd_event(int bVk,int bScan,int dwFlags,int dwExtraInfo);

keybd_event(187,0,0,0); //+ button

keybd_event(189,0,0,0); //- button

Keycodes: http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00000520.html
Tecuciztecatl
70
Tecuciztecatl 2016.05.06 09:27  
OnChartEvent() function  with CHARTEVENT_KEYDOWN is to survey the keyboard.
/
To add comments, please log in or register