Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Marat Chariev
  Where is Marat Chariev?
 Montreal
 Canada
 Marat Chariev
 To: Karben Selim Mejia
  Where is Karben Selim Mejia?
 San Pedro Sula
 Honduras
 Karben Selim Mejia
 Tags
Subject: RE: any body kows how to get the printer handle?
Thread ID: 15933 Message ID: 16037 # Views: 1 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Monday, October 07, 2002 11:05:07 PM         
   


If I understand right, you need to get Printer DC (current or chosen). If so, you might want to try code, that I use in FRX2Any utility.
**********************************************************************************************
LPARAMETERS tlShowDialog

DECLARE INTEGER CreateDC IN Win32API AS CreatePrinterDC STRING, STRING, STRING, STRING

LOCAL lnHDC

LOCAL lcPrinter
LOCAL lcLastOnError
LOCAL lcDriver

LOCAL llError

LOCAL loForm

lnHDC = 0

IF tlShowDialog

loForm = CREATEOBJECT('BaseForm')
loForm.ADDOBJECT('oDialog', 'BaseCommonDialogBox')

lcLastOnError = ON("ERROR")

IF !ISNULL(loForm) AND !ISNULL(loForm.oDialog)

WITH loForm.oDialog
.CancelError = .T.

ON ERROR llError = .T.

*-- Get printer hDC
.Flags = 0x100

.ShowPrinter()

lnHDC = IIF(llError, 0, .hDC)
ENDWITH

ENDIF

ON ERROR &lcLastOnError
ELSE
lcPrinter = SET('PRINTER', 3)

IF '5.0' $ OS()
*-- If the OS is 5.0, the driver is either DISPLAY or WINSPOOL
lcDriver = 'WINSPOOL'
ELSE
*-- If the OS is Windows 9x, the driver is NULL
lcDriver = NULL
ENDIF

IF !EMPTY(lcPrinter)
lnHDC = INT(CreatePrinterDC(lcDriver, lcPrinter, NULL, NULL))
ENDIF
ENDIF


**********************************************************************************************
HTH
Marat Chariev

ENTIRE THREAD

how to add bmp to rich text contro Posted by JIGNESH BAROT @ 10/4/2002 7:50:43 AM
RE: how to add bmp to rich text contro Posted by Karben Selim Mejia @ 10/4/2002 6:50:32 PM
RE: how to add bmp to rich text contro Posted by JIGNESH BAROT @ 10/5/2002 9:41:11 AM
RE: how to add bmp to rich text contro Posted by JIGNESH BAROT @ 10/5/2002 10:09:34 AM
any body kows how to get the printer handle? Posted by Karben Selim Mejia @ 10/5/2002 4:39:43 PM
RE: any body kows how to get the printer handle? Posted by Eric den Doop @ 10/6/2002 11:07:18 AM
RE: any body kows how to get the printer handle? Posted by Karben Selim Mejia @ 10/6/2002 8:39:09 PM
RE: Yes this is a code to get the printer handle Posted by JIGNESH BAROT @ 10/7/2002 7:54:13 AM
RE: any body kows how to get the printer handle? Posted by Marat Chariev @ 10/7/2002 11:05:07 PM
RE: any body kows how to get the printer handle? Posted by Karben Selim Mejia @ 10/8/2002 12:00:16 AM
RE: any body kows how to get the printer handle? Posted by Marat Chariev @ 10/8/2002 3:30:21 PM
RE: any body kows how to get the printer handle? Posted by Karben Selim Mejia @ 10/8/2002 3:44:52 PM