Printer Problem

Printer Problem

Postby Randal » Mon Sep 27, 2010 11:40 pm

All,

I have a customer that is using XP SP3 to remote connect to a Win 2008 Server computer. When connected the remote connection sets up temporary printer drivers so she can print to her local printers. They are usually defined as "Brother" or "HP Laser" followed by a number. When she disconnects the temporary printers are removed.

If I use the PRINT FROM USER command the user is presented with the correct list of available printers and can select one and print. This works fine.

Elsewhere in our program I use GetProfStr("Devices") to return an array of available printers that I use in a custom Print Setup dialog. The GetProfStr returns an array of previously connected printers but not the current printer(s) defined by the remote session.

Why doesn't GetProfStr return the same list of printers as the printer class? How can I return the same list of printers shown in the print setup window when using PRINT FROM USER?

On a similar note, why does GetProfStr return all the previous temporary printers? Is Windows 2008 Server storing these for each session but not removing them from the registry? Additionally, none of the other programs she uses return these previously connected printers but rather the correct printers for the remote session.

Any help or suggestions would be greatly appreciated.

Thanks,
Randal
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Re: Printer Problem

Postby cuatecatl82 » Tue Oct 05, 2010 12:31 am

Hi Randal:

It passes something to me similar, I have a list of printers and on the basis of each of them control the reports, some are laser by usb and others by LTP1, strange it are that in the premises I only can generate the report but not to print because the PC is freezed, in the remote printers is not possible the impression unless the service of detects them to printers and install " automatic" and he is very complicated that only does it to the PC, apparently is a problem of the SP3 of XP, I have looked for in the Regedit it installs and them in branches where GetProfStr() does not look for, its necesary to modify so that also looks for, there is not a function that many we used is aPrinters, but works either very well, I have not proven it in Windows Vista because not it use, that could be a track of your problem. :cry:

Code: Select all  Expand view
//-------------------------------------------------------------------//
STATIC FUNCTION aPrinters()

LOCAL aPrinters:= {}, oReg, oKey, cBuffer := "", nId:= 0, cName
LOCAL DumStr := ""

oReg := TReg32():New( HKEY_CURRENT_CONFIG,"System\CurrentControlSet\Control\Print\Printers" )
cName := oReg:GET( "Default" )
oReg:CLOSE()
oReg := TReg32():New( HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Control\Print\Printers" )

WHILE RegEnumKey( oReg:nHandle, nId++, @cBuffer ) == 0
    oKey := TReg32():New( HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Control\Print\Printers\" + cBuffer )
    AADD( aPrinters, { oKey:GET( "
Name" ),  oKey:GET( "Port" ), cName==oKey:GET( "Name" ) } )
    oKey:CLOSE()
ENDDO

oReg:CLOSE()

IF LEN(aPrinters) == 0
 IF lNoImpr == .F.
   oAsis:wStop("
No hay Impresoras Correctamente Instaladas...", "Atención")
   lNoImpr:= .T.
   lNoError:= .F.
 ENDIF
ENDIF

RETURN (aPrinters)


The problem i detected with the new hp laser printers... Sorry my English not is god. :wink:
Soluciones y Diseño de Software
Damos Soluciones...

I.S.C. Victor Daniel Cuatecatl Leon
Director y Diseñador de Proyectos

http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon
User avatar
cuatecatl82
 
Posts: 625
Joined: Wed Mar 14, 2007 6:49 pm
Location: San Cristobal de las Casas, Chiapas México

Re: Printer Problem

Postby Randal » Wed Oct 06, 2010 3:36 pm

Victor:

Thank you for your reply. When the user connects remotely to the server the printers are setup automatically and should be removed when disconnected - this doesn't happen all the time and this is problem. These printer entries remain in the registry and the number of entries keeps growing. Each entry is named with the printer name and a session number. So, you end up with Laser Session:1, Laser Session:2, etc.

The printer entries for the sesssion are being stored in a different registry location (on the server) although WIndows somehow redirects the GetProfStr function to retrieve the printers from this other registry location.

What is odd and the main point of my question is why does the PRINT FROM USER show a dialog with the correct printers only and GetProfStr returns all the printers from the alternate registry location. It appears the GetPrintDC function is retrieving the available printers another way or from the normal registry location while the GetProfStr function is redirected to the registry location where the session printers are saved.

Thanks,
Randal
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 23 guests

cron