I use the OpenDoc6 function to open files in my app. The function accepts parameters for errors and warnings. How do I interpret the codes it passes back? The error values I see most are 0 and 2. For warnings, I see the values 2 or 3.
The returned values are a bit set which means that if one or more errors were encountered, their particular bit will be set to 1 instead of 0. Each bit represents a power or 2, so the bits are identified in decimal as 1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768, and so on. Or in hexadecimal as:
0x100 and so on. In binary, the above look like this:
Notice that each value has a single bit set to one. This allows ou to combine multiple error codes into a single value. For instance, if you have code 1 and code 2, the binary representation looks like this:
which is 0x3 in hex or simple 3 in decimal. This is simply the two error codes added together (1+2).
So, in your case, an error of 2 is simply code 2, which is swFileNotFoundError and a warning of 3 is both codes 1 and 2 or swFileLoadWarning_IdMismatch and swFileLoadWarning_ReadyOnly while a warning of 2 is simply swFileLoadWarning_ReadyOnly.
A value of zero means no bits were set, so there were no errors or warnings.
You can find that in the API help file or the Object Browser inside macro editor or visual studio. Generally a 0 indicates no problems.
Retrieving data ...