FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Can not Print in Vista SP1.
Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Can not Print in Vista SP1.
Posted: Thu Jun 19, 2008 02:46 PM
Hello,

In Windows Vista with Service Pack 1, I always get this message:


Looking in printer.prg, I see it's because of this code:
elseif ComDlgXErr() != 0
      MsgStop( "There are no printers installed!"  + CRLF + ;
               "Please exit this application and install a printer." )


Is anyone else experience this problem. And if so, how can we solve it?

Thanks!

Patrick[/img]
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Can not Print in Vista SP1.
Posted: Thu Jun 19, 2008 03:02 PM

Hi Patrick,
is your printer a local or a network printer ?

Windows Vista is not very fast to active the network connections at startup so you have to give the time to make this before start your app if only network printers are availables on your workstation.

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Can not Print in Vista SP1.
Posted: Thu Jun 19, 2008 04:40 PM
Marco Turco wrote:is your printer a local or a network printer ?

Local printer.

Patrick
Posts: 581
Joined: Tue Oct 11, 2005 11:28 AM
Can not Print in Vista SP1.
Posted: Thu Jun 19, 2008 06:37 PM
Patrick Mast wrote:
Marco Turco wrote:is your printer a local or a network printer ?

Local printer.

Patrick


Hi, Patrick,

I had this problem specially after updating to SP2. At the first time, it prints ok, but on the second time, it gives me this error. If you come back to SP1 there is no problem. So, it seems to be a Vista problem (and a serious problem!). Because of this I had to come back to XP.

Regards,
Kleyber Derick



FWH / xHb / xDevStudio / SQLLIB
Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Can not Print in Vista SP1.
Posted: Thu Jun 19, 2008 06:40 PM
I had this problem specially after updating to SP2. At the first time, it prints ok, but on the second time, it gives me this error. If you come back to SP1 there is no problem. So, it seems to be a Vista problem (and a serious problem!). Because of this I had to come back to XP.
But we have too many clients who are upgrading to Vista and I can not tell my customres to downgrade their OS.

Antonio? Can you help us?

Thanks!

Patrick
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Can not Print in Vista SP1.
Posted: Thu Jun 19, 2008 06:45 PM
Patrick,

I have been through this one last week

The problem comes from identifying the printer

if you are printing to a specifief printer and just passing the printer's name before (as i was doing), you will get the message.

You have to pass now the port also, and it will work ok.

It works also as backward's compatibility (vista without sp1 and xp)

Below is my printer selection function

FUNCTION GETIMPRI(ADEVICES)
*----------------------------------------
LOCAl cAllEntries, cEntry, I, cName, cPrn, cPort, J

cAllEntries := STRTRAN( GetProfString( "Devices" ), Chr( 0 ), CRLF )
FOR I:= 1 TO MlCount( cAllEntries )
cName := MemoLine( cAllEntries,,I)
cEntry := GetProfString( "Devices",cName,"")
J := 2
WHILE ! EMPTY(cPort := StrToken(cEntry,J++,","))
// AADD(aDevices,TRIM(cName))
AADD(aDevices,TRIM(cName) + "," + CENTRY) // CHIDIAK
ENDDO
NEXT
RETURN aDevices


HTH

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 838
Joined: Wed Aug 22, 2007 10:09 AM
Can not Print in Vista SP1.
Posted: Thu Jun 19, 2008 07:19 PM

Hi,

This error occurs, for example, when printing from PREVIEW?.

Best regards,

Saludos / Regards,



FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Can not Print in Vista SP1.
Posted: Thu Jun 19, 2008 07:23 PM
This error occurs on vista sp1 when you print without prompting the user for the printer, to an identified printer by it's name

it occurs before preview

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Can not Print in Vista SP1.
Posted: Fri Jun 20, 2008 10:40 AM
Richard Chidiak wrote:I have been through this one last week
The problem comes from identifying the printer
if you are printing to a specifief printer and just passing the printer's name before (as i was doing), you will get the message.
You have to pass now the port also, and it will work ok.

You mean, instead of doing this:
oPrn:=TPrinter():New("Testpage",.f.,.f.,"HP xyz")
We now have to do:
oPrn:=TPrinter():New("Testpage",.f.,.f.,"HP xyz,winspool,LPT1:")
Is this correct?

Thanks!

Patrick
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Can not Print in Vista SP1.
Posted: Mon Jun 23, 2008 06:23 AM

Patrick,

Yes , this is the way to go if you print without prompting the user to select a printer, if you prompt for printer selection, the old syntax works ok

gotta love vista !

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Can not Print in Vista SP1.
Posted: Mon Jun 23, 2008 06:45 AM
Richard Chidiak wrote:Yes , this is the way to go if you print without prompting the user to select a printer, if you prompt for printer selection, the old syntax works ok

gotta love vista !
Thank you Richard!

Patrick
Posts: 711
Joined: Thu Oct 06, 2005 09:57 PM
Re:
Posted: Tue May 12, 2009 07:48 PM
Richard Chidiak wrote:
You have to pass now the port also, and it will work ok.
Below is my printer selection function

FUNCTION GETIMPRI(ADEVICES)
*----------------------------------------
LOCAl cAllEntries, cEntry, I, cName, cPrn, cPort, J

cAllEntries := STRTRAN( GetProfString( "Devices" ), Chr( 0 ), CRLF )
FOR I:= 1 TO MlCount( cAllEntries )
cName := MemoLine( cAllEntries,,I)
cEntry := GetProfString( "Devices",cName,"")
J := 2
WHILE ! EMPTY(cPort := StrToken(cEntry,J++,","))
// AADD(aDevices,TRIM(cName))
AADD(aDevices,TRIM(cName) + "," + CENTRY) // CHIDIAK
ENDDO
NEXT
RETURN aDevices

HTH

Richard


Richard,

I have a function, including in the previeus, to change on line the printer. This is the code:

func f_CamImpre (oDevice, cCbx )
local cPrinter

// impresora predeterminada
cPrinter := GetProfString( "windows", "device" , "" )
// instalamos la impresora elegida
WriteProfString( "windows", "device", cCbx )
// refrescamos el sistema
SysRefresh()
//iniciamos impresora
PrinterInit()

DeleteDC( oDevice:hDC ) // Sugestion by Enrico M. Giordano

// temporal printer
oDevice:hDC := GetPrintDefault( GetActiveWindow() )

SysRefresh()
// default printer again
WriteProfString( "windows", "device", cPrinter )

RETURN nil

I have now, in Vista, second time that I try to print, the message "There are not printer inst..."

Can you help me to change that function to adding the port number?

Thanks and regards
Un saludo



Manuel
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: Can not Print in Vista SP1.
Posted: Wed May 13, 2009 07:30 AM
Manuel,

I had a similar situation printing in Vista, did you read my post in this topic ?
http://forums.fivetechsupport.com/viewtopic.php?f=3&t=15485

Vista does not allow, to initialize the same printer twice, then the error occurs.
kind regards

Stefan
Posts: 711
Joined: Thu Oct 06, 2005 09:57 PM
Re: Can not Print in Vista SP1.
Posted: Wed May 13, 2009 10:18 PM
StefanHaupt wrote:
Vista does not allow, to initialize the same printer twice, then the error occurs.


Stefan,

But if I use standard rpreview it is correct.

Regards
Un saludo



Manuel
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: Re:
Posted: Fri May 15, 2009 07:49 AM
Manuel Valdenebro wrote:
I have now, in Vista, second time that I try to print, the message "There are not printer inst..."


Manuel,

as I said, vista does not allow to initialize the printer twice, if this error only occures on the second try to print the first printer object doesn´t seem to be finished. Did you correctly end your printer object ?

BTW, to get all installed printers you can use the function GetPrinters() from xharbour.
Code (fw): Select all Collapse
aPrinter := GetPrinters()
IF lPreview
  PRINT oPrint NAME "Formular" PREVIEW TO aPrinter[xx]
ELSE
  PRINT oPrint NAME "Formular" TO aPrinter[xx]
ENDIF


This is working fine for me.
kind regards

Stefan

Continue the discussion