Holas
Pueden descargarlo de aqui.
http://200.72.140.34/privado/
Desde Chile
Adolfo[/url]
faraon wrote:Pueden volver a subirlo por favor???
anserkk wrote:faraon wrote:Pueden volver a subirlo por favor???
http://rapidshare.com/files/187515980/A ... ersion.zip
Anser
#include "FiveWin.ch"
#include "report.ch"
#define HKEY_LOCAL_MACHINE 2147483650
Function Atest()
@ 2, 12 BUTTON oBtn2 PROMPT "&Texto" OF oDlg SIZE 40,12 ;
ACTION TestRep( .t., oDlg)
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL
/--------------------------------------------------------------------------
static function TestRep( lModal, oDlg)
local oPrn, cTitulo
local nLin, nLinMax, nPag, cTmp, nItens
SET _3DLOOK ON
SetMTxtPreview( .f., 5, 2, .f., .t. )
cTitulo:= "**** TEST DE TTXTPREVIEW ****"
USE TEST2
GO TOP
nLin := 1
nPag := 0
nItens := nTotal := 0
oPrn:= TDosPrn():New(.t.) // .T. bota error de variable no existe HKEY_LOCAL_MACHINE
if ! oPrn:lCancel
begin sequence
oPrn:StartPage()
do while !Eof()
//--- Cabecalho
//
if nLin = 1
nPag++
oPrn:Command( oPrn:cNormal )
oPrn:Say( nLin, 00, PadC( cTitulo, 79 ) )
oPrn:Command( oPrn:cCompress )
++nLin
oPrn:Say( ++nLin, 01, "LISTA DE FUNCIONARIOS" )
oPrn:Say( nLin, 124, "Pag.: " + StrZero( nPag,3 ) ) // Pagina
//oPrn:Say( ++nLin, 001, Repl("-", 160) )
oPrn:Say( ++nLin, 001, Repl("-", 130) )
oPrn:Say( ++nLin, 001, "NOMBRE DIRECCION CIUDAD ESTADO CEP SALARIO" )
oPrn:Say( ++nLin, 001, Repl("-", 130) )
endif
//--- Corpo do relatorio
//
nlin+=1
oPrn:Say( nLin, 001, Alltrim( first ) + " " + Alltrim( last ) )
oPrn:Say( nLin, 043, street )
oPrn:Say( nLin, 075, left( city, 20) )
oPrn:Say( nLin, 098, state )
oPrn:Say( nLin, 107, zip )
oPrn:Say( nLin, 119, Transform( salary, "@R 999,999,999.99" ) )
**oPrn:Say( nLin, 135, notes )
skip
nItens++
nTotal+= salary
if nLin+1 > oPrn:nMaxLine // se passou a linha max
oPrn:Say( ++nLin, 001, Repl("-", 160) )
nLin:= 1 // volta contador para 1
endif // nova pagina
enddo
oPrn:Say( ++nLin, 001, Repl("-", 160) )
oPrn:Say( ++nLin, 001, "Total de Funcionarios : " + Alltrim( Tran( nItens,"999,999" ) ) )
oPrn:Say( nLin, 119, Transform( nTotal, "@R 999,999,999.99" ) )
oPrn:EndPage() // salta pagina
oPrn:End()
end sequence
close TEST2
//--- Passar a Dialog como ultimo parametro.
//
if oPrn:lPreview
TxtPreview( oPrn:cDevice, cTitulo, lModal,,, oPrn, oDlg, , oPrn:lModoGraf )
endif
endif
return nil
*------------------------------------------*
Function ActivePrnType()
*------------------------------------------*
// Function created by Anser
// This function will check whether the current/active/selected printer is
// Dot Matrix or InkJet/Laser
// Return Value .T. = Dot MAtrix
// Return Value .F. = Inkjet or Laser
Local oPrn
PRINT oPrn NAME "Test"
if Empty( oPrn:hDC )
MsgStop("No printers Installed")
Return .F. // Printer is not installed or ready
endif
IF oPrn:nLogPixelX() <= 350 // Dot Matrix Printer ie Text Printer
ENDPRINT
Return .T.
else // Injet or Laser ie Grpahics Printer
ENDPRINT
Return .F.
Endif
ENDPRINT
Return .F.
*----------------------------------------*
FUNCTION IsNetworkPrn(cPrnName)
*----------------------------------------*
* Function created by Anser
* This function will determine whether the Printer is a Network Printer(DOT Matrix)
* cPrnName is the Name of the Printer For Eg.PrnGetName()-> \\Abhi\Epson LQ-2080 ESC/2 P
Local cPrnPcName:=""
Local aPrnSrvrs:={},nPos:=0
aPrnSrvrs:=oWinGetSerP() // Gives NetBios name of PrintServers availabe to the user
cPrnName:=Ltrim(Rtrim(cPrnName))
if left(cPrnName,2) == "\\"
cPrnName:=Right(cPrnName,len(cPrnName)-2) // Remove the \\ from the Printer name found at the begining of the Prn name
cPrnPcName:=LEFT(cPrnName, AT("\",cPrnName) -1) // Pick only the PCName ie Abhi from the string "Abhi\Epson LQ-2080"
else
Return .F.
Endif
nPos:=aScan(aPrnSrvrs,cPrnPcName)
if nPos > 0
Return .T.
Else
Return .F.
Endif
*----------------------------------------------*
FUNCTION PrnPortUrl(cPrnName)
*----------------------------------------------*
* Fuction created by Anser
* Returns a string \\NetBiosName_Of_The_Pc_Where_The_Printer_IsPhysically_Installed\Printer_ShareName
* Expected value in Parameter cPrnName is the Printer Name For Eg.PrnGetName()-> "\\Abhi\Epson LQ-2080 ESC/2 P"
* Uses Registry to find out the values
LOCAL cRealPrnName:="", cPcName :="" , cPrnShareName:="" , cRegPath:=""
LOCAL oReg
if empty(cPrnName)
MsgStop("Printer Name is empty. Unable to proceed further")
Return ""
Endif
cPrnName:=Ltrim(Rtrim(cPrnName))
if left(cPrnName,2) == "\\" // Network Dot Matrix Printer name will have \\ in the beginning of the Printer Name
cPrnName:=Right(cPrnName,len(cPrnName)-2) // Remove the \\ from the Printer name found at the begining of the Prn name
cPcName:=LEFT(cPrnName, AT("\",cPrnName) -1) // Pick the PCName ie Abhi from the string "Abhi\Epson LQ-2080"
cRealPrnName:=RIGHT(cPrnName, Len(cPrnName)-AT("\",cPrnName) ) // Picking the Printer name after avoiding the "\\Abhi\" from the string
Endif
// Path in the registry for Windows 2000 and above
cRegPath:="SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\LanMan Print Services\Servers\"+cPcName+"\Printers\"+cRealPrnName+"\DsSpooler"
oReg := TReg32():New(HKEY_LOCAL_MACHINE,cRegPath )
IF oReg:nError = 0
cPcName := oReg:Get("shortServerName", "")
cPrnShareName := oReg:Get("printShareName", "")
else
MsgInfo("Unable to locate NetBiosName of the PC where the Printer is physically installed"+CRLF+;
"Unable to locate the Printer's ShareName")
Return ""
ENDIF
oReg:Close()
oReg := NIL
RETURN "\\"+cPcName+"\"+cPrnShareName
*******************
FUNCTION oWinGetSerP()
*******************
* Returns the names of print servers available for the current post
* Author Badara Thiam
LOCAL nHandle
LOCAL cValue
LOCAL n1
LOCAL n2
LOCAL cSubkeys
LOCAL aHKey := HKEY_LOCAL_MACHINE
LOCAL TSERVEURS := {}
cSubKeys := "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\LanMan Print Services\Servers"
IF RegOpenKey( aHKey, cSubKeys, @nHandle ) == 0
* Recherche des serveurs accessibles
n1 := 0
TSERVEURS := {}
DO WHILE .T.
cValue := ""
n2 := RegEnumKey( nHandle, n1, @cvalue )
SysRefresh()
IF n2 = 0
AADD(TSERVEURS, cValue)
ELSE
EXIT
ENDIF
n1 ++
ENDDO
RegCloseKey( nHandle )
ENDIF
RETURN ACLONE(TSERVEURS)
artu01 wrote:you can try my code with your program and tell me if you get to print over usb printer
i hope that you can help me
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 35 guests