//+------------------------------------------------------------------+ //| WinAPIErrorsDescription.mqh | //| Copyright © 2018, Vladimir Karputov | //| http://wmua.ru/slesar/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2018, Vladimir Karputov" #property link "http://wmua.ru/slesar/" #property version "1.002" //--- #define ERROR_FILE_NOT_FOUND 0x00000002 // (2) The system cannot find the file specified #define ERROR_PATH_NOT_FOUND 0x00000003 // (3) The system cannot find the path specified #define ERROR_NOT_READY 0x00000015 // (21) The device is not ready #define ERROR_FILE_EXISTS 0x00000050 // (80) The file exists #define ERROR_ALREADY_EXISTS 0x000000B7 // (183) Cannot create a file when that file already exists #define ERROR_NOACCESS 0x000003E6 // (998) Invalid access to memory location //--- //+------------------------------------------------------------------+ //| Error description | //+------------------------------------------------------------------+ void ErrorDescription(const int error) { switch(error) { case ERROR_FILE_NOT_FOUND: //--- dec 2 hex 0x2 PrintFormat("WinAPI ERROR (\"%s\") ", "The system cannot find the file specified"); break; case ERROR_PATH_NOT_FOUND: //--- dec 3 hex 0x3 PrintFormat("WinAPI ERROR (\"%s\") ", "The system cannot find the path specified"); break; case ERROR_NOT_READY: //--- dec 21 hex 0x15 PrintFormat("WinAPI ERROR (\"%s\") ", "The device is not ready"); break; case ERROR_FILE_EXISTS: //--- dec 80 hex 0x50 PrintFormat("WinAPI ERROR (\"%s\") ", "The file exists"); break; case ERROR_ALREADY_EXISTS: PrintFormat("WinAPI ERROR (\"%s\") ", "Cannot create a file when that file already exists"); break; case ERROR_NOACCESS: PrintFormat("WinAPI ERROR (\"%s\") ", "Invalid access to memory location"); break; default: PrintFormat("WinAPI ERROR (\"%s\") ,%X (hex), %u (dec)", "Unknown error",error,error); break; } } //+------------------------------------------------------------------+