Page 1 of 1
Can not Print in Vista SP1.
Posted: Thu Jun 19, 2008 2:46 pm
by Patrick Mast
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:
Code: Select all
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]
Posted: Thu Jun 19, 2008 3:02 pm
by Marco Turco
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.
Posted: Thu Jun 19, 2008 4:40 pm
by Patrick Mast
Marco Turco wrote:is your printer a local or a network printer ?
Local printer.
Patrick
Posted: Thu Jun 19, 2008 6:37 pm
by Kleyber
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,
Posted: Thu Jun 19, 2008 6:40 pm
by Patrick Mast
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
Posted: Thu Jun 19, 2008 6:45 pm
by Richard Chidiak
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
Posted: Thu Jun 19, 2008 7:19 pm
by MOISES
Hi,
This error occurs, for example, when printing from PREVIEW?.
Best regards,
Posted: Thu Jun 19, 2008 7:23 pm
by Richard Chidiak
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
Posted: Fri Jun 20, 2008 10:40 am
by Patrick Mast
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
oPrn:=TPrinter():New("Testpage",.f.,.f.,"HP xyz")
We now have to do:
Code: Select all
oPrn:=TPrinter():New("Testpage",.f.,.f.,"HP xyz,winspool,LPT1:")
Is this correct?
Thanks!
Patrick
Posted: Mon Jun 23, 2008 6:23 am
by Richard Chidiak
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
Posted: Mon Jun 23, 2008 6:45 am
by Patrick Mast
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
Re:
Posted: Tue May 12, 2009 7:48 pm
by Manuel Valdenebro
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
Re: Can not Print in Vista SP1.
Posted: Wed May 13, 2009 7:30 am
by StefanHaupt
Manuel,
I had a similar situation printing in Vista, did you read my post in this topic ?
http://forums.fivetechsupport.com/viewt ... =3&t=15485
Vista does not allow, to initialize the same printer twice, then the error occurs.
Re: Can not Print in Vista SP1.
Posted: Wed May 13, 2009 10:18 pm
by Manuel Valdenebro
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
Re: Re:
Posted: Fri May 15, 2009 7:49 am
by StefanHaupt
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
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.