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