Help with chart screen shot

 

From the diaries of the worlds worst programmer.

So I have implemented the following code in my bot, the idea is to take a screenshot OnTimer and on a button click

 

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void TakePicture()
//+------------------------------------------------------------------+
  {
   string filename= "ScreenShot\\"+Symbol()+"\\"+TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS)+".png";
   int ChartWidth = guiGetChartWidth(hwnd);
   int ChartHeight= guiGetChartHeight(hwnd);

   bool TakeScreenShot=ChartScreenShot(0,filename,ChartWidth,ChartHeight,ALIGN_RIGHT);
  }

 

But when I check my files I see this

 

There is no file ext (.gif, jpeg,png). No file ext no picture.  

 

Can someone please help the worlds worst programmer. 

 

P.S. I also ues the coding from the good people at  http://www.mt4gui.com/

 

 
That is because you are using colons in the filename which are invalid characters. A filename such as "2016.06.27 15:24:31.png" is invalid, so you end up with only "2016.06.27 15" because it gets truncated at the first invalid character.
 

Thank you so much bro. Got it working a treat now. :)

Here's the new code for others that might find themselves in my shoes.

 

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void TakePicture()
//+------------------------------------------------------------------+
  {
   string filename= "ScreenShot\\"+IntegerToString(TimeYear(TimeCurrent()))+"\\"+Symbol()+"\\"+IntegerToString(TimeMonth(TimeCurrent()))+"\\"+IntegerToString(TimeDay(TimeCurrent()))+"\\"+IntegerToString(TimeHour(TimeCurrent()))+"_"+IntegerToString(TimeMinute(TimeCurrent()))+".png";
   int ChartWidth = guiGetChartWidth(hwnd);
   int ChartHeight= guiGetChartHeight(hwnd);

   bool TakeScreenShot=ChartScreenShot(0,filename,ChartWidth,ChartHeight,ALIGN_RIGHT);
  }
 
Robert Browne:

Thank you so much bro. Got it working a treat now. :)

Here's the new code for others that might find themselves in my shoes.

 


Guy, you're amazing. Thank you so much!!!! 

Reason: