"Mike Hearn" mike@theoretic.com wrote:
- num = sizeof(PrinterName);
- if (!GetDefaultPrinterW(PrinterName, &num))
- WCHAR default_name[255];
- DWORD default_name_size = sizeof(default_name);
- if (GetDefaultPrinterW(default_name, &default_name_size) == 0) {
You should pass the size of buffer in characters, not in bytes to GetDefaultPrinter.