Download MetaTrader 5

I have GetLastError I need a SetLastError

To add comments, please log in or register
Ernie Gunning
1147
Ernie Gunning 2013.02.22 06:34 

Hi All,

I always want to do this funny stuff just before I need to go to work, so if you can help, please do, if not net...enjoy your weekend :)
I wrote my own class an in the constructor I set out different rules for the class to "initialize" if these conditions aren't met I would like for the class to not initialize. I approaches this by doing the following:

 

                          CExperBase(CSignal *signal,long magicNumber, long deviation)
                         { 
                           Signal = signal;
                           ClearTradeValues();
                           Magic = magicNumber;
                           Deviation = deviation;
                           if(signal.Init()!=0)
                           {
                              printf("There was an error initializing the siganl. Stopping.");
                                    }
                           
                         };

 

As you can see if the signal does not initialize I print an error. I would actually like to not initialize the CExpertBase object in this case, how can I do this? 
Reason for not initializing CExpertBase : I use CExpertBase in a different file and Would like know when there was an error

I had the idea of using the MT5 error structure as this is a class but I don't see a SetLastError...
Please help. I think I might be going against the OO principle for rules of the constructor LOL but yea...

phi nuts
2184
phi nuts 2013.02.28 06:29  
ToolMaker:

Hi All,

I always want to do this funny stuff just before I need to go to work, so if you can help, please do, if not net...enjoy your weekend :)
I wrote my own class an in the constructor I set out different rules for the class to "initialize" if these conditions aren't met I would like for the class to not initialize. I approaches this by doing the following:

As you can see if the signal does not initialize I print an error. I would actually like to not initialize the CExpertBase object in this case, how can I do this? 
Reason for not initializing CExpertBase : I use CExpertBase in a different file and Would like know when there was an error

I had the idea of using the MT5 error structure as this is a class but I don't see a SetLastError...
Please help. I think I might be going against the OO principle for rules of the constructor LOL but yea...


Did you mean this SetUserError() ?
To add comments, please log in or register