|
|
|
GetDefaultPrinter |
The GetDefaultPrinter function returns the default printer as defined by Windows.
C
BOOL SftPrintPreview_GetDefaultPrinter(LPTSTR lpszPrinter, int* cntChars);
C++
static BOOL GetDefaultPrinter(LPTSTR lpszPrinter, int* cntChars)
Parameters
lpszPrinter
Returns the name of the printer defined by Windows as the default printer.
cntChars
On entry, the maximum size of the buffer lpszPrinter where the printer name is to be returned, including trailing \0 (in characters, not bytes).
On return, contains the actual number of characters returned in lpszPrinter (excluding the trailing \0).
Returns
The return value is TRUE if the function was successful, FALSE otherwise.
Comments
The GetDefaultPrinter function returns the default printer as defined by Windows.
The default printer defined by Windows is not necessarily the same as the application's current (default) printer. The application's current printer can be retrieved using the GetCurrentPrinter function.
Example
C
TCHAR szPrinter[_MAX_PATH]; int cntChars = _MAX_PATH; SftPrintPreview_GetDefaultPrinter(szPrinter, &cntChars); MessageBox(NULL, szPrinter, TEXT("Default Printer"), MB_OK | MB_TASKMODAL | MB_ICONINFORMATION);
C++
TCHAR szPrinter[_MAX_PATH]; int cntChars = _MAX_PATH; CSftPrintPreview::GetDefaultPrinter(szPrinter, &cntChars); MessageBox(NULL, szPrinter, TEXT("Default Printer"), MB_OK | MB_TASKMODAL | MB_ICONINFORMATION);
See Also C/C++ API | C++ Classes | Notifications