SetDefaultPrinter name collision

If you are a C/C++/C# developer and have any questions about using our products from your application here is the place to post them.
Post Reply
billb
Posts: 6
Joined: Fri Jan 16 2004

SetDefaultPrinter name collision

Post by billb »

I can't believe I didn't find this in the archives, but when I follow the instructions in TN02 - Correctly using DEVMODE ... I receive a compiler error when I include winspool.h. The error is "error C2733: second C linkage of overloaded function 'SetDefaultPrinterA' not allowed". I notice that CdIntf210.h has the same function name.

What is the solution here?

Thank you.
zaksoft
Posts: 66
Joined: Fri Feb 20 2004

SetDefaultPrinter collision

Post by zaksoft »

I've also feaced with this problem.

With an eMail I've sdviced the support that SetDefaultPrinter is a Win32 SDK function, but they send me a small project without problem.

Of course they don't link Winspool.lib, so there are no conflict

You have 2 options:

1) Use LoadLibrary and rename the function
2) Patch library, DLL and H and change from SetDefaultPrinter to some other name (but be aware of order, I use SetDefaultPrinpdf to maintain the same naming order)

I've choose the second way, but this lead to manual install and re-patch every version.

I hope thay change the code in a future release (at least for VC users)

Hope this help.
Davide Zaccanti
Post Reply