Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to position the GETPRINTER() dialog
Retrieving the command line for the VFP session
Using MessageBeep
Winsock: retrieving information from a host database for a given host name
Obtaining names and positions for shortcuts located on the Windows Desktop
Disconnecting USB Mass Storage Device programmatically
GetFocus returns a HWND value
Smart Card Database Query Functions
Storing the environment strings in cursor
Winsock: reading and setting socket options
GDI+: retrieving list of available image encoders and image decoders
How to enumerate terminal servers within the specified Windows domain
How to obtain the number of rows affected by remote UPDATE, INSERT or DELETE statement
How to read email messages using Simple MAPI
Quering a waveform-audio input device
Scanning the hierarchy of child windows down from the main VFP window
The DetectAutoProxyUrl function identifies the auto-config script location
Validating URLs using moniker functions
Winsock: initializing the service in the VFP application
CryptoAPI: Collection of Providers class
Form Magnifier
Moving shortcut to a specified position on the Windows Desktop
Opening the Page Setup dialog box to specify the attributes of a printed page
Pocket PC: custom RAPI class for operating with the System Registry
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

  •  
      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: 2009-01-03 15:26:33  
    Visits in 7 days: 162  
    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-2013 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.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (50.17.109.248)
    1.27 hrs.Example: 'How to find when the application started'
     Example: 'Reading entries from Event logs'
    11.63 hrs.Function: 'ReleaseMutex'
     Example: 'Adding user-defined items to the Control Menu of VFP form (requires VFP9)'
    12.19 hrs.Function: 'GetUserNameEx'
    Function group: 'System Information'
     Example: 'How to remove a directory that is not empty'
     Example: 'How to delete IE cookies, clear IE history and delete files in Temporary Internet Files directory'
    14.83 hrs.Example: 'Using InternetGoOnline function'
     Example: 'Retrieving configuration information for the specified workstation (Win2000/XP)'
    18.52 hrs.Example: 'Retrieving the priority class for the current process'
    Google
    Advertise here!