cause script to run

 

Hi was wondering, could a GUI associated with a dll raise an event that will cause a Metatrader script to call a dll routine to get data or input that the GUI has collected from a user?

 thanks,

MilfordT 

 
milfordT:

Hi was wondering, could a GUI associated with a dll raise an event that will cause a Metatrader script to call a dll routine to get data or input that the GUI has collected from a user?

 thanks,

MilfordT 

Hi milfordT,

Correct me if I'm wrong, in short, could dll call a script ? Yes, by setting hotkey for the script (or CI or EA) and run keyboard event function in dll. In MetaEditor 5 see include/VirtualKeys, and in MetaEditor 4 see include/WinUser32. Here's MSDN of keyboard event http://msdn.microsoft.com/en-us/library/windows/desktop/ms646304(v=vs.85).aspx

I never use keyboard event in dll though, and annoying thing is, we probably have to make the chart or even the MT, an active window first :(. 

:D 

keybd_event function (Windows)
  • msdn.microsoft.com
Synthesizes a keystroke. The system can use such a synthesized keystroke to generate a WM_KEYUP or WM_KEYDOWN message. The keyboard driver's interrupt handler calls the keybd_event function. Note This function has been superseded. Use SendInput instead. Syntax Parameters bVk [in] A virtual-key code. The code must be a value in the range 1...
 
onewithzachy:

Hi milfordT,

Correct me if I'm wrong, in short, could dll call a script ? Yes, by setting hotkey for the script (or CI or EA) and run keyboard event function in dll. In MetaEditor 5 see include/VirtualKeys, and in MetaEditor 4 see include/WinUser32. Here's MSDN of keyboard event http://msdn.microsoft.com/en-us/library/windows/desktop/ms646304(v=vs.85).aspx

I never use keyboard event in dll though, and annoying thing is, we probably have to make the chart or even the MT, an active window first :(. 

:D 

thanks again onewithzachy. 

I'm thinking I could use a hot key to start the following sequence:

1) run script

2) script calls some dll routine that brings up GUI

3) user inputs parameters

4) after clicking some button on GUI, dll or GUI, then creates some event that will cause script to know data is ready and then script will call another dll routine to retrieve user inputs

Does this look feasible to you? or can you suggest an easier solution?

  

 

milfordT 

thanks again onewithzachy. 

I'm thinking I could use a hot key to start the following sequence:

1) run script

2) script calls some dll routine that brings up GUI

3) user inputs parameters

4) after clicking some button on GUI, dll or GUI, then creates some event that will cause script to know data is ready and then script will call another dll routine to retrieve user inputs

Does this look feasible to you? or can you suggest an easier solution? 


Hi milfordT,

Is it like this http://msdn.microsoft.com/en-us/library/windows/desktop/ms632588(v=vs.85).aspx ?, Of course it's feasible.

However script can also accept user input by adding "#property script_show_inputs" 

//#property script_show_confirm //<<-- Are you sure thing
#property script_show_inputs  //<<-- show me the input

input double double_your_loss=0.0;
input int    integreedy_input=7;
input string any_kind_a_string="abcdefghijklmnopqrstuvwxyz";
input ulong  wear_short=1;

:D 

Dialog Boxes (Windows)
  • msdn.microsoft.com
A dialog box is a temporary window an application creates to retrieve user input. An application typically uses dialog boxes to prompt the user for additional information for menu items. A dialog box usually contains one or more controls (child windows) with which the user enters text, chooses options, or directs the action. Windows also...
Reason: