Cannot open Font .ttf with ShellExecuteW

 

Dear Coders,

I can open text files, videos, images,  but not Font files ".ttf ".  I would like to open it first, then install. Is there a trick to open them ?

Thank you in advance for your support,


#import "shell32.dll"
int ShellExecuteW(int hwnd, string lpOperation, string lpFile, string lpParameters,string lpDirectory, int nShowCmd);
#import

string FileName = "SPORT.ttf";

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   ObjectsDeleteAll(0,"BUTTON")
   ;
   return(0);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {
   ObjectsDeleteAll(0,"BUTTON");
   return(0);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   Button("BUTTON");
   ObjectSetText("BUTTON","OPEN  FILE");
   return(0);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
  {
   if(id==CHARTEVENT_OBJECT_CLICK)
     {
      if(sparam=="BUTTON")
        {
         OPEN();
        }
     }
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void Button(string name)
  {
   ObjectCreate(name,OBJ_BUTTON,0,0,0);
   ObjectSet(name,OBJPROP_XDISTANCE,100);
   ObjectSet(name,OBJPROP_YDISTANCE,30);
   ObjectSet(name,OBJPROP_XSIZE,100);
   ObjectSet(name,OBJPROP_YSIZE,20);
   ObjectSetString(0,name,OBJPROP_FONT,"Verdana");
   ObjectSetInteger(0,name,OBJPROP_FONTSIZE,9);
   ObjectSet(name,OBJPROP_COLOR,clrBlack);
   ObjectSet(name,OBJPROP_BGCOLOR,clrWhite);
   ObjectSet(name,OBJPROP_CORNER,0);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OPEN()
  {
   ShellExecuteW(NULL,"open",TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL4\\Files\\"+FileName,NULL,NULL,5);
  } 
//+------------------------------------------------------------------+
 
Mpower:   but not Font files ".ttf ".  I would like to open it first, then install. Is there a trick to open them ?
  1. You do not open them, you install it into Windows and then that font can be selected in text operations.
  2. Shell only can start executables - .exe .com.
 
William Roeder:
  1. You do not open them, you install it into Windows and then that font can be selected in text operations.
  2. Shell only can start executables - .exe .com.

Thank you William Roeder for your prompt reply  ;)

I continue to look for the way how to install Font programmatically with MT4. I mean open the window, then we just click on Install.

Have a great day,

Reason: