Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools

Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools (http://www.expert-advisor.com/forum/index.php)
-   Programmierung MQL5 (http://www.expert-advisor.com/forum/forumdisplay.php?f=221)
-   -   HTML Open (http://www.expert-advisor.com/forum/showthread.php?t=7318)

Aleksi 28.03.23 13:44

HTML Open
 
Hallo, mir ist zwar bekannt, dass die Frage hier bereits gestellt wurde, aber leider konnte ich die Herausforderung nicht lösen. Bitte um Hilfe.

Der Web-Browser soll geöffnet werden mit der ausgewählten D
atei
Code:

// Import the ShellExecuteW() function from the shell32.dll
#import "shell32.dll"
int ShellExecuteW(int hwnd,string Operation,string File,string Parameters,string Directory,int ShowCmd);
#import

void OnStart()
{
  // Show file open dialog
  string filenames[];
  if(FileSelectDialog("Dateien zum Laden auswählen", NULL,
                      "bericht (*.html)|*.html|All files (*.*)|*.*",
                      FSD_ALLOW_MULTISELECT|FSD_FILE_MUST_EXIST, filenames, "data.html")>0)
  {
      // Get the path of the terminal data directory
      string dataPath = TerminalInfoString(TERMINAL_DATA_PATH);
     
      // Open each selected file in the default web browser
      int total=ArraySize(filenames);
      for(int i=0; i<total; i++)
      {
        // Construct the full path of the file relative to the terminal data directory
        string filePath = dataPath + "\\" + filenames[i];
        Print(filePath);
        // Open file in default web browser using ShellExecuteW()
        bool result = (ShellExecuteW(0, "open", filePath, "", "", 1) > 32);
       
        if(result)
        {
            Print("Datei ", filenames[i], " erfolgreich geöffnet.");
        }
        else
        {
            Print("Fehler beim Öffnen von ", filenames[i]);
        }
      }
  }
  else
  {
      Print("Keine Dateien ausgewählt.");
  }
}

2023.03.28 13:53:54.991 auto open log (DE40,H1) Fehler beim Öffnen von report.html


Alle Zeitangaben in WEZ +2. Es ist jetzt 07:38 Uhr.

Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.1
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum