Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Retrieving the name of the default printer for the current user on the local computer (Win NT/XP)
Winsock: how to retrieve the protocol information corresponding to a protocol number
Accessing examples contained in this reference through Web Services
Reading the state of mouse buttons within DO WHILE loop
Accessing Windows Control Panel from VFP Application
Obtaining the bounding rectangle for the specified device context
Simple MAPI: how to pick an email recipient from Outlook Express address book
How to save registry key including its subkeys and values to a file
Using Multimedia Command Strings to play MIDI files
Creating a device context for the specified printer
Enumerating servers of the specified type (e.g. SQL Server) in the primary domain
Creating hash values for the list of names
Extracting the name and extension parts of a path string
Reading and setting Environment variables
Converting a hexadecimal string to an integer
Converting path to original case
Deleting files into the Recycle Bin
How to drag a Form not using its Titlebar or Caption
How to hide your program from the Close Program dialog (Win9* only)
How to test file attributes (key method for FileExists and DirectoryExists routines)
Reading parameters of streams in AVI file
GDI+: saving image of FoxPro form to graphics file (BMP, GIF, JPG, PNG, TIF)
How to enumerate terminal servers within the specified Windows domain
Retrieving default spooling directory name
Retrieving the name of the default printer for the current user on the local computer (Win NT/XP)

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Versions:
click to open
Before you begin:
This code sample retrieves the name of default printer on local computer and obtains detailed information for this printer in PRINTER_INFO_5 format.

See also:
  • Using EnumPrinters function to enumerate locally installed printers
  • Enumerating print jobs and retrieving information for default printer
  • How to retrieve number of print jobs that have been queued for the printer
  • Setting default printer
  •  
      Members area. Log in to view this example.
     
      User name:
      Password:
     
     
      Forgot your password?
     
      Sign up for
    the Membership
     
     


    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    5094 bytes  
    Created: 2002-12-30 21:43:09  
    Modified: 2013-10-10 11:17:44  
    Visits in 7 days: 127  
    Listed functions:
    ClosePrinter
    GetDefaultPrinter
    GetLastError
    GetPrinter
    GetProfileString
    LocalAlloc
    LocalFree
    LocalSize
    OpenPrinter
    Printer friendly API declarations
    My comment:
    The name of the default printer can be read from the Windows Registry: use GetProfileString function with "Windows" and "Device" passed as first two parameters.

    Note that GetDefaultPrinter function requires at least Win2K and is not supported on older Windows versions. On Win9*/Me the EnumPrinters called with PRINTER_ENUM_DEFAULT flag returns information about the default printer.

    See also: SetDefaultPrinter, APRINTERS().
    Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian  
    FreeTranslation.com offers instant, free translations of text or web pages.
    User Contributed Notes:
    thelasttimetoPayForcodeFromHere | 2006-06-19 16:45:47
    THE CODING EXAMPLE IS FRAUDULENT
    IT NEVER WORKS
    SO BEWARE OF THEFT ON THIS WEBSITE
    PROCEDURE decl

        DECLARE INTEGER GetDefaultPrinter IN winspool.drv ;

            STRING @pszBuffer, INTEGER @pcchBuffer



        DECLARE INTEGER GetPrinter IN winspool.drv;

        AS GetPrinterA;

            INTEGER hPrinter, INTEGER Lvl, STRING @pPrinter,;

            INTEGER cbBuf, INTEGER @pcbNeeded



        DECLARE INTEGER OpenPrinter IN winspool.drv;

            STRING pPrinterName, INTEGER @phPrinter, INTEGER pDefault
    Anatoliy Mogylevets | 2006-06-19 17:08:06
    Dear Patrick O'Hara (pohara@recyclingit.com),

    I appreciate your opinion but you are wrong. This code sample is nothing like fraudulent or stolen. If this is all about the small amount of money you paid for it -- a refund has been issued.

    I do my best and I try to be as honest towards the visitors on my website as possible.

    Copyright 2001-2018 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

    Privacy policy
    Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (54.91.16.95)
    10 sec.Function: 'GetProcessVersion'
    Function group: 'Process and Thread'
    16 sec.Function: 'waveInGetErrorText'
    Function group: 'Windows Multimedia'
    24 sec.Function: 'inet_addr'
    Function group: 'Windows Sockets 2 (Winsock)'
    32 sec.Example: 'How to print FoxPro form'
    41 sec.
    Function group: 'Debugging'
    50 sec.Function: 'GdipGetImageEncodersSize'
    1 min.Function: 'GdipSetClipRectI'
    Function group: 'GDI+ Graphics'
    1.13 min.
    Function group: 'File Management'
    1.3 min.Function: 'inet_addr'
    Function group: 'Windows Sockets 2 (Winsock)'
    1.48 min.Example: 'How to assemble an array of strings and pass it to external function'
    Google
    Advertise here!