CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Location
    Denmark
    Posts
    4

    Setting Default Printer in Win95/98/NT4 using C

    I am trying to write a program in C/C++ for the win32 environment that will change a certain printer to the default printer. Any help I could get would be great!


  2. #2
    Join Date
    Apr 1999
    Posts
    396

    Re: Setting Default Printer in Win95/98/NT4 using C

    Hey Tom Salomone, Todd here Checking out documentation on SetPrinter() API and here's what I have. You want a PRINTER_INFO_2 structure, to call to SetPrinter.

    SetPrinter(hPrinter,2,(PRINTER_INFO_2*)&pInfo,0);

    For your pInfo PRINTER_INFO_2 structure, Set the Attributes field to contain PRINTER_ATTRIBUTE_DEFAULT.

    I guess a call to GetPrinter would be used to fill the PRINTER_INFO_2 structure, then just modify the Attributes (pInfo.Attributes |= PRINTER_ATTRIBUTE_DEFAULT);


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured