hi im looking for a help to shutdown pc by an EA

 
hi coders, wt im looking for is can e shutdown the pc with an expertadvisor( when dailytarget hit then it should be close all orders n shutdown the pc ) . anyone can help me for that n i think this will help for other members also when we think about acc management
 

execute trough cmd.exe "shutdown -s -t 0"

 
thnx for repiles . ill try this https://www.mql5.com/en/forum/119063
 

I hope you never do that to my PC. You are taking personal risk of someone elses physical property and that could lead you to legal issues. I would not want that to happen to my machine.

 
LEHayes:

I hope you never do that to my PC. You are taking personal risk of someone elses physical property and that could lead you to legal issues. I would not want that to happen to my machine.


LEHayes - you've done a lot more to an unsuspecting PC by installing Windows on it. That's just as likely to do damage to it, and I'll not hold my breath for any Hayes vs Gates lawsuit.

CB

 
i got below code snippet from https://forum.mql4.com/24357

#import "shell32.dll"

int ShellExecuteA(int hwnd,string Operation,string File,string Parameters,string Directory,int ShowCmd);

#import

Then when you want to run it you do it this way:

ShellExecuteA(0, "Open", "c:\shutdown.exe", "", "", 1);

but my problem is do we need to copy shell32 dll form windows folder to experts/libraries or just use this code snippet only ?or how to access cmd by mql code n then use "shutdown -s -t 0" ?

 
i think problem solved chk this entire thread https://www.mql5.com/en/forum/119063
 
LEHayes:

I hope you never do that to my PC. You are taking personal risk of someone elses physical property and that could lead you to legal issues. I would not want that to happen to my machine.


I don't see how he is taking personal risk of someone elses property, he never said he is not using his own PC.
Reason: