Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // PRINTER_OPTION_FLAGS as defined in winspool.h
- typedef enum _PRINTER_OPTION_FLAGS
- {
- PRINTER_OPTION_NO_CACHE = 1 << 0,
- PRINTER_OPTION_CACHE = 1 << 1,
- PRINTER_OPTION_CLIENT_CHANGE = 1 << 2,
- PRINTER_OPTION_NO_CLIENT_DATA = 1 << 3,
- } PRINTER_OPTION_FLAGS;
- // PRINTER_OPTION_FLAGS literally translated to Delphi
- type
- PRINTER_OPTION_FLAGS = (
- PRINTER_OPTION_NO_CACHE = 1 shl 0,
- PRINTER_OPTION_CACHE = 1 shl 1,
- PRINTER_OPTION_CLIENT_CHANGE = 1 shl 2,
- PRINTER_OPTION_NO_CLIENT_DATA = 1 shl 3
- );
- // but because Delphi would not allow you to directly assign the enum elements to that DWORD field without
- // typecasting, it's more comfortable to translate those enum elements as constants in this case
- const
- PRINTER_OPTION_NO_CACHE = 1 shl 0;
- PRINTER_OPTION_CACHE = 1 shl 1;
- PRINTER_OPTION_CLIENT_CHANGE = 1 shl 2;
- PRINTER_OPTION_NO_CLIENT_DATA = 1 shl 3;
- // otherwise, you would need to write something like follows (which is the most precise, but requires more
- // writing and still gives you no type safety because you can mistype what is shown on the second line)
- var
- Options: PRINTER_OPTIONSA;
- begin
- ...
- Options.dwFlags := DWORD(PRINTER_OPTION_NO_CACHE);
- ...
- Options.dwFlags := DWORD(alClient); // <- not much typesafe, right ?
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement