screenshots not being created correctly

 

Hello,

I have a continued problem with the creation of screenshots in metatrader.

There is no consistency to this problem that I can find.  The problem:  Screenshots are being created with 0 bytes (sometimes)

I'm not sure how to solve this as there is no consistency.  I know people are going to ask for the code but it makes no difference.  This is the ONLY line of code in the entire program that takes a screenshot.

WindowScreenShot("ScreenshotsDir\\" + ID + ".gif",ScreenShotWidth,ScreenShotHeight,-1,-1,-1);

The same line of code gets executed and one time I'll have a screenshot, the next time I'll have a screenshot but the file is 0 bytes.  There is only one line of code and i'm getting a different result each time even though the same code is being executed. 

 Does anyone have any insights on why this could be happening?  Your assistance would be very much appreciated. 

 
if(!WindowScreenShot("ScreenshotsDir\\" + ID + ".gif",ScreenShotWidth,ScreenShotHeight,-1,-1,-1)) { Print(GetLastError()); }
 
How much time delay is there between consecutive calls of this?
 
honest_knave:
How much time delay is there between consecutive calls of this?

There is nothing in the code for a time delay, would just be the amount of time take to loop back through the code.  I'm not a developer but if you could put the code in to include a time delay that would just compile for me I'd gladly test it  :)  

 

I'll also report back on this suggestion to get the error:

if(!WindowScreenShot("ScreenshotsDir\\" + ID + ".gif",ScreenShotWidth,ScreenShotHeight,-1,-1,-1)) { Print(GetLastError()); }
 
trader88888:

There is nothing in the code for a time delay, would just be the amount of time take to loop back through the code.  I'm not a developer but if you could put the code in to include a time delay that would just compile for me I'd gladly test it  :)  

 

I'll also report back on this suggestion to get the error:

 

The program just tripped and there was no error left even with the screenshot being 0kb  :(
 

You can use this code to see how long it is between attempts to make a screenshot. I'd be interested to see the time delay on the 0kb screenshots.

static uint LastShot=0;
if(!WindowScreenShot("ScreenshotsDir\\" + ID + ".gif",ScreenShotWidth,ScreenShotHeight,-1,-1,-1)) { Print(GetLastError()); }
printf("Time between screenshots was %d ms",GetTickCount()-LastShot);
LastShot=GetTickCount();
 
honest_knave:

You can use this code to see how long it is between attempts to make a screenshot. I'd be interested to see the time delay on the 0kb screenshots.

Hello,

 When trying to compile I get these two errors:  

'unit' - declaration without type
'LastShot' - undeclared identifier

Sorry I'm not much of a programmer just trying to make this one change on my own.
 

I've just rechecked that code and it compiles without any problem at my end, so I'm guessing you've made a typographical error somewhere in your code where you have inserted it.

If you post up some more code I can help, otherwise you'll need to start double checking everything.

 
honest_knave:

I've just rechecked that code and it compiles without any problem at my end, so I'm guessing you've made a typographical error somewhere in your code where you have inserted it.

If you post up some more code I can help, otherwise you'll need to start double checking everything.

I can see that Trader88888 has mis-typed uint as unit
 
GumRai:
I can see that Trader88888 has mis-typed uint as unit
Good eye and thank you for that.  It's now compiled and i'll let you know the outcome, should not be too long.
 
GumRai:
I can see that Trader88888 has mis-typed uint as unit
Good spot GumRai - I should have read Trader88888's post more carefully!
Reason: