Using Win32 functions in Visual FoxPro Image Gallery
Printing and Print Spooler
..msdn
AddPort
AddPrinter
ClosePrinter
ConfigurePort
ConnectToPrinterDlg
DeletePort
DeviceCapabilities
DocumentProperties
EndDoc
EndPage
EnumForms
EnumJobs
EnumPorts
EnumPrinterData
EnumPrinterDrivers
EnumPrinters
EnumPrintProcessorDatatypes
EnumPrintProcessors
Escape
FindClosePrinterChangeNotification
FindFirstPrinterChangeNotification
FindNextPrinterChangeNotification
FreePrinterNotifyInfo
GetDefaultPrinter
GetPrinter
GetPrinterData
GetPrinterDriverDirectory
GetPrintProcessorDirectory
OpenPrinter
PrinterProperties
SetDefaultPrinter
SetJob
SetPrinter
StartDoc
StartPage
Code examples:
Configuring DEVMODE structure for a printer
Printing Image File, programmatically set print page orientation to landscape
DocumentProperties
..msdn    Add comment     W32 Constants      Translate this page
The DocumentProperties function retrieves or modifies printer initialization information or displays a printer-configuration property sheet for the specified printer.
Code examples:
Printing Image File, programmatically set print page orientation to landscape
Configuring DEVMODE structure for a printer
Declaration:
LONG DocumentProperties(
  HWND hWnd,               // handle to parent window 
  HANDLE hPrinter,         // handle to printer object
  LPTSTR pDeviceName,      // device name
  PDEVMODE pDevModeOutput, // modified device mode
  PDEVMODE pDevModeInput,  // original device mode
  DWORD fMode              // mode options
);
FoxPro declaration:
DECLARE INTEGER DocumentProperties IN winspool.drv;
    INTEGER   hWnd,;
    INTEGER   hPrinter,;
    STRING    pDeviceName,;
    STRING  @ pDevModeOutput,;
    STRING  @ pDevModeInput,;
    INTEGER   fMode

Parameters:
hWnd
[in] Handle to the parent window of the printer-configuration property sheet.

hPrinter
[in] Handle to a printer object. Use the OpenPrinter or AddPrinter function to retrieve a printer handle.

pDeviceName
[in] Pointer to a null-terminated string that specifies the name of the device for which the printer-configuration property sheet is displayed.

pDevModeOutput
[out] Pointer to a DEVMODE structure that receives the printer configuration data specified by the user.

pDevModeInput
[in] Pointer to a DEVMODE structure that the operating system uses to initialize the property sheet controls.

fMode
[in] Specifies the operations the function performs. If this parameter is zero, the DocumentProperties function returns the number of bytes required by the printer driver"s DEVMODE data structure.
Return value:
If the function fails, the return value is less than zero.

If the function displays the property sheet, the return value is either IDOK or IDCANCEL, depending on which button the user selects.

If the fMode parameter is zero, the return value is the size of the buffer required to contain the printer driver initialization data. Note that this buffer can be larger than a DEVMODE structure if the printer driver appends private data to the structure.
Usage:
* DocumentProperties call is configured 
* to return the required size for DEVMODE buffer

nDevmodeSize = DocumentProperties(_screen.HWnd, hPrinter,;
    cPrinterName, 0, 0, 0)
My comment:
Read also Microsoft Help and Support article (former Q102966) Registry Entries for Printing.

See also: PrintDlg
Word Index links for the DocumentProperties :
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2003-02-10 10:33:06
Modified: 2009-09-23 12:17:48
Visited in last 7 days: 26
User Contributed Notes:
Tristan Leask | 2005-05-03 06:08:32
Can this be used to set the orientation of the paper for printing? The DEVMODE example shows how to change it but this change does not stay with the printer and are lost once the printer is closed. I have looked about and i think this is used with the setprinter call. I don't suppoose you have an example of this at all?
A.M. | 2005-05-03 09:25:52
Modified DEVMODE structure should be used, for example, with CreateDC call like in "Creating a device context for the specified printer" code sample.

In my understanding, all FoxPro printing-related functions shield the DEVMODE from any access through API calls.
Tristan Leask | 2005-05-03 11:24:54
Okay. Well i am using a third party control that does not allow me to specify that i want to print using a landscape layout. I was going to try and modify the printers settings so that the printer defaults to landscape. I understand i will still need a modified DEVMODE that i will need to use with setprinter. I don't suppose you have an example of doing this?

I assume that first you get the printer info using getprintera() (print_info_2) then you should be able to the reference to the devmode which you can then modify and put back into the printer info structure. This can then be used with the setprinter() command. Have no idea how to do this all though <g>!
A.M. | 2005-05-03 12:02:52
I was thinking about extending SetPrinter example. Or it rather should be a separate example showing how to set defaults for a printer. Will probably do soon.

Meanwhile take a look at some Registry keys:
HKEY_CURRENT_USER\Printers\DevModePerUser
HKEY_CURRENT_USER\Printers\DevModes2
Tristan Leask | 2005-05-04 03:43:49
Okay thats sounds great, thanks. This link might be of interest for you for the example...

http://www.cadvault.com/forums/archive/index.php/t-1949.html

Copyright 2001-2017 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.38.173)
15 sec.Function: 'OpenWaitableTimer'
30 sec.Function: 'NormalizeString'
43 sec.Function: 'GetClassInfoEx'
58 sec.Function: 'WinHttpOpen'
1.2 min.Function: 'CeFindNextDatabaseEx'
1.5 min.Function: 'GetCommandLine'
1.72 min.Function: 'CryptImportKey'
1.98 min.Function: 'GdipInvertMatrix'
2.22 min.
Function group: 'Terminal Services'
2.52 min.Function: 'CLSIDFromString'
Google
Advertise here!