D
Dirk Vanhaute
I have only small knowledge of c++, but I would like to compile the
example in
http://support.microsoft.com/kb/q246772/
HOWTO: Retrieve and Set the Default Printer in Windows
I included "#include <Windows.h>" at the start, and the following goes
wrong :
BOOL DPGetDefaultPrinter(LPTSTR pPrinterName, LPDWORD pdwBufferSize)
{
....
PROC fnGetDefaultPrinter = NULL;
....
// This line works :
fnSetDefaultPrinter = GetProcAddress(hWinSpool, SETDEFAULTPRINTER);
....
bFlag = fnGetDefaultPrinter(pPrinterName, pdwBufferSize);
// but this one gives
// GetDfltPrt.cpp(100) : error C2197: 'int (__stdcall *)(void)' : too
many actual parameters
....
bFlag = fnSetDefaultPrinter(pPrinterName);
// and this gives the same.
This should probably be casted, because the number of parameters is
different.
Comments on this code are also welcome. Are there better ways to get
the default printer on all windows platforms ?
Many thanks in advance.
Dirk.
example in
http://support.microsoft.com/kb/q246772/
HOWTO: Retrieve and Set the Default Printer in Windows
I included "#include <Windows.h>" at the start, and the following goes
wrong :
BOOL DPGetDefaultPrinter(LPTSTR pPrinterName, LPDWORD pdwBufferSize)
{
....
PROC fnGetDefaultPrinter = NULL;
....
// This line works :
fnSetDefaultPrinter = GetProcAddress(hWinSpool, SETDEFAULTPRINTER);
....
bFlag = fnGetDefaultPrinter(pPrinterName, pdwBufferSize);
// but this one gives
// GetDfltPrt.cpp(100) : error C2197: 'int (__stdcall *)(void)' : too
many actual parameters
....
bFlag = fnSetDefaultPrinter(pPrinterName);
// and this gives the same.
This should probably be casted, because the number of parameters is
different.
Comments on this code are also welcome. Are there better ways to get
the default printer on all windows platforms ?
Many thanks in advance.
Dirk.