SetDefaultPrinter library...

Just starting out? Need help? Post your questions and find answers here.
Skipsy
User
User
Posts: 98
Joined: Wed Apr 30, 2003 12:26 pm
Location: France

SetDefaultPrinter library...

Post by Skipsy »

Hello all,

Could someone explain how to use Windows SetDefaultPrint function with
PB ???
http://msdn.microsoft.com/en-us/library ... S.85).aspx

I tried :
SetDefaultPrinter_ ("my_printer")
but the compiler returns an error.

By the way... Is there any way to use this function ???

Thks a lot,
William.
Beware of the man who has the solution before he understands the problem...
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

Its a driver, but also export functions like a dll:

Code: Select all

PrinterName.s="Brother HL-1250"
#Lib=1
winspoollib=OpenLibrary(#lib,"Winspool.drv")
Prototype ProtoSetDefaultPrinter(name.s)
 If winspoollib
 
 SetDefaultPrinter.ProtoSetDefaultPrinter=GetFunction(#Lib,"SetDefaultPrinterA")
 Result=SetDefaultPrinter(PrinterName)
 Debug result
EndIf
SPAMINATOR NR.1
Skipsy
User
User
Posts: 98
Joined: Wed Apr 30, 2003 12:26 pm
Location: France

Post by Skipsy »

Well, I am not sure it's a driver, the goal is not to add a nex printer, just
to define a nex one as default in the existing list.

Iam not sur to understand that code so Iam trying tomorrow.

I was also working on another way :
rundll32 printui.dll,PrintUIEntry /y /n "printer"
but it doesn't work using RunProgram()...

Thks,
WW
Beware of the man who has the solution before he understands the problem...
Post Reply