Can not Print in Vista SP1.

Can not Print in Vista SP1.

Postby Patrick Mast » Thu Jun 19, 2008 2:46 pm

Hello,

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

Looking in printer.prg, I see it's because of this code:
Code: Select all  Expand view
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]
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby Marco Turco » Thu Jun 19, 2008 3: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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Patrick Mast » Thu Jun 19, 2008 4:40 pm

Marco Turco wrote:is your printer a local or a network printer ?

Local printer.

Patrick
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby Kleyber » Thu Jun 19, 2008 6: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
User avatar
Kleyber
 
Posts: 581
Joined: Tue Oct 11, 2005 11:28 am
Location: São Luiz, Brasil

Postby Patrick Mast » Thu Jun 19, 2008 6: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
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby Richard Chidiak » Thu Jun 19, 2008 6: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[code][/code]
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby MOISES » Thu Jun 19, 2008 7:19 pm

Hi,

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

Best regards,
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Postby Richard Chidiak » Thu Jun 19, 2008 7: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Patrick Mast » 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:
Code: Select all  Expand view
oPrn:=TPrinter():New("Testpage",.f.,.f.,"HP xyz")
We now have to do:
Code: Select all  Expand view
oPrn:=TPrinter():New("Testpage",.f.,.f.,"HP xyz,winspool,LPT1:")
Is this correct?

Thanks!

Patrick
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby Richard Chidiak » Mon Jun 23, 2008 6: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Patrick Mast » Mon Jun 23, 2008 6: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
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Re:

Postby Manuel Valdenebro » Tue May 12, 2009 7: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[code][/code]


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
User avatar
Manuel Valdenebro
 
Posts: 706
Joined: Thu Oct 06, 2005 9:57 pm
Location: Málaga-España

Re: Can not Print in Vista SP1.

Postby StefanHaupt » Wed May 13, 2009 7: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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: Can not Print in Vista SP1.

Postby Manuel Valdenebro » 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
User avatar
Manuel Valdenebro
 
Posts: 706
Joined: Thu Oct 06, 2005 9:57 pm
Location: Málaga-España

Re: Re:

Postby StefanHaupt » Fri May 15, 2009 7: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: Select all  Expand view
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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 116 guests