open web-browser to review results

Back to topics list To post a new topic, please log in or register
avatar
38
avatar
57
Dohung 2012.10.02 09:11 #
 

Sorry to request very old question.

I want a code that EA can open a default web browser with given URL.

Please help.

Thanks!

 
avatar
13010
WHRoeder 2012.10.02 14:47 #
 
Untested
bool openURL(string url){
    int APPEND  = FILE_CSV|FILE_WRITE;
    string  file = WindowExpertName() + ".URL";
    int handle   = FileOpen(file, APPEND, '~');
    if (handleOPT < 1){ int GLE = GetLastError(); ... }
    FileWrite(handleOPT, "[InternetShortcut]");
    FileWrite(handleOPT, "URL="+url);
    FileClose(handleOPT);
    return ( Shell(TerminalPath()+"\\experts\\files\\"+file) );     // or "cmd.exe", "/C "+file
}
#import "shell32.dll"
   int ShellExecuteA(int hWnd, string Verb, string File, string Parameter, string Path, int ShowCmd);
#import
bool Shell(string file, string parameters=""){
    #define DEFDIRECTORY NULL
    #define OPERATION "open"    // or print
    #define SW_SHOWNORMAL 1
    int r=ShellExecuteA(0, OPERATION, file, parameters, DEFDIRECTORY, SW_SHOWNORMAL);
    if (r > 32) return(true);
    Alert("Shell failed: ",r);
    return(false);
}
Untested
avatar
13010
WHRoeder 2015.06.15 18:40 #
 
  1. Since build 600 Feb 2014, all strings are Unicode. ShellExecuteA must be changed to ShellExecuteW. See also https://forum.mql4.com/67340
  2. open a url i n browser - MQL4 forum




Back to topics list  

To add comments, please log in or register