from help...
SetDefaultPrinter
The SetDefaultPrinter function sets the printer name of the default printer for the current user on the local computer.
BOOL SetDefaultPrinter(
LPCTSTR pszPrinter // default printer name
);
Parameters
pszPrinter
[in] Pointer to a null-terminated string containing the default printer name. For a remote printer, the name format is \\server\printername. For a local printer, the name format is printername.
If this parameter is NULL or an empty string, that is, "", SetDefaultPrinter does nothing if there is already a default printer. However, if there is no default printer, SetDefaultPrinter sets the default printer to the first printer, if any, in an enumeration of printers installed on the local computer.
Return Values
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
To set the default printer on Windows 2000, call SetDefaultPrinter. To set the default printer to earlier operating systems, call GetProfileString, WriteProfileString, and SendNotifyMessage, as shown in the following code:
// read PrinterPorts section from win.ini
// returned string should be of the form "driver,port,timeout,timeout", i.e. "winspool,LPT1:,15,45".
GetProfileString(TEXT("Windows"
,TEXT("Device"
,_T(",,,"
,m_szName, COUNTOF(m_szName));
WriteProfileString(TEXT("Windows"
,TEXT("Device"
,pszPrinterName ));
// Notify all open applications of the change. Note, only applications that handle the message will recognize the change.
#if WM_WININICHANGE != WM_SETTINGCHANGE
// Old message type; for windows95
SendNotifyMessage(HWND_BROADCAST,WM_WININICHANGE,0,(LPARAM)szWindows);
#endif
// New message type
SendNotifyMessage(HWND_BROADCAST,WM_SETTINGCHANGE,0,(LPARAM)szWindows);
When using this method, you must specify a valid printer, driver, and port. If they are invalid, the APIs do not fail but the result is not defined. This could cause other programs to set the printer back to the previous valid printer. You can use EnumPrinters to retrieve the printer name, driver name, and port name of all available printers.
Requirements
Windows NT/2000 or later: Requires Windows 2000 or later.
Windows 95/98/Me: Unsupported.
Header: Declared in Winspool.h; include Windows.h.
Library: Use Winspool.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows 2000.
See Also
Printing and Print Spooler Overview, Printing and Print Spooler Functions, EnumPrinters, GetDefaultPrinter, GetProfileString, WriteProfileString, SendNotifyMessage
So it looks like you are going to have to check for what OS you program is on and then use the correct method. You can search this site for code to check which OS your program is running on.
Good Luck