Page 1 of 2

TdosPrn con Preview (ralph/anserkk)

Posted: Fri Aug 05, 2011 1:20 pm
by Sdo
Olá a todos !!!
Alguém poderia me dizer onde posso baixar a TdosPrn (modificada pelo ralph e anserkk), pois o link está quebrado, ou se puderem me enviar por e-mail ficaria agradecido.

multsoft.sergio@gmail.com

Obrigado !!!

Sergio...

Re: TdosPrn con Preview (ralph/anserkk)

Posted: Sun Aug 07, 2011 3:57 am
by anserkk
Dear Mr.Sergio,

I shall put the download link here by tomorrow.

Regards
Anser

Re: TdosPrn con Preview (ralph/anserkk)

Posted: Tue Aug 09, 2011 3:24 pm
by Sdo
Olá anserkk !!!

Me desculpe pela demora, pois estava sem net. Fico no aguardo e agradeço pela sua atenção.

Um abraço....

Sergio...

Re: TdosPrn con Preview (ralph/anserkk)

Posted: Wed Aug 10, 2011 4:33 am
by anserkk
Here is the link to download the file
I have made few changes on the version modified by Mr.Ralph

https://rapidshare.com/files/2645837963/TDOSPRN.prg

Regards
Anser

Re: TdosPrn con Preview (ralph/anserkk)

Posted: Wed Aug 10, 2011 12:56 pm
by Sdo
anserkk,

Mais uma vez, muito obrigado pela sua atenção e presteza pelo meu pedido.

Um abraço !!!

Sergio....

Re: TdosPrn con Preview (ralph/anserkk)

Posted: Fri Sep 02, 2011 12:15 pm
by karinha
Você quis dizer: Bom dia senhores, Como faço para corrigir esses erros na tdosprn.prg ?

Buenos días señores,
¿Cómo puedo corregir estos errores en tdosprn.prg?



Error: Unresolved external '_HB_FUN_ACTIVEPRNTYPE' referenced from C:\VENDAS\TDOSPRN.OBJ
Error: Unresolved external '_HB_FUN_ISNETWORKPRN' referenced from C:\VENDAS\TDOSPRN.OBJ
Error: Unresolved external '_HB_FUN_PRNPORTURL' referenced from C:\VENDAS\TDOSPRN.OBJ


Gracias, saludos.

Re: TdosPrn con Preview (ralph/anserkk)

Posted: Sat Sep 03, 2011 4:57 am
by anserkk
karinha wrote:Você quis dizer: Bom dia senhores, Como faço para corrigir esses erros na tdosprn.prg ?

Buenos días señores,
¿Cómo puedo corregir estos errores en tdosprn.prg?

Error: Unresolved external '_HB_FUN_ACTIVEPRNTYPE' referenced from C:\VENDAS\TDOSPRN.OBJ
Error: Unresolved external '_HB_FUN_ISNETWORKPRN' referenced from C:\VENDAS\TDOSPRN.OBJ
Error: Unresolved external '_HB_FUN_PRNPORTURL' referenced from C:\VENDAS\TDOSPRN.OBJ

Gracias, saludos.
From my old utility functions prg

Code: Select all

*------------------------------------------*
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
Regards
Anser

Re: TdosPrn con Preview (ralph/anserkk)

Posted: Mon Sep 05, 2011 1:18 pm
by karinha
anserkk,

Muchas Gracias, thank you very much.

Regards, saludos.

Re: TdosPrn con Preview (ralph/anserkk)

Posted: Mon Sep 12, 2011 12:17 pm
by karinha
anserkk,

Ahora me genera esto error:


Error: Unresolved external '_HB_FUN_OWINGETSERP' referenced from C:\VENDAS\TDOSPRN.OBJ


Gracias,

Saludos.

Re: TdosPrn con Preview (ralph/anserkk)

Posted: Tue Sep 13, 2011 11:01 am
by anserkk

Code: Select all

*******************
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) 
 
Regards
Anser

Re: TdosPrn con Preview (ralph/anserkk)

Posted: Tue Sep 13, 2011 11:34 am
by Bayron
Hi Mr. Anser,

When I tried to compile I get the following error:

Code: Select all

Application
===========
   Path and name: C:\Users\Maya\DOWNLO~1\TDOSPRN.exe (32 bits)
   Size: 1,572,864 bytes
   Time from start: 0 hours 0 mins 0 secs 
   Error occurred at: 09/13/11, 05:22:54
   Error description: Error BASE/1066  Argument error: conditional
   Args:
     [   1] = U   

Stack Calls
===========
   Called from: C:\Users\Maya\DOWNLO~1\TDOSPRN.prg => TDOSPRN:PRINTSETUP(461)
   Called from: C:\Users\Maya\DOWNLO~1\TDOSPRN.prg => TDOSPRN:NEW(188)
   Called from: C:\Users\Maya\DOWNLO~1\TDOSPRN.prg => WORKSHEET(414)
 
Everything seems to be Ok with the the variable, but I don't know if something is wrong with the New Method...

Code: Select all

METHOD New(lUserConfig) CLASS TDosPrn

     ::cCompress   := "15"
     ::cNormal     := "18"
     ::cFormFeed   := "12"
     ::cInitPrn    := "18,27,80"
     ::cNegOn      := "27,71"
     ::cNegOff     := "27,72"
     ::c10cpi      := "27,80"
     ::c12cpi      := "27,77"
     ::cWidOn      := "27,87,1"
     ::cWidOff     := "27,87,0"
     ::cBuffer     := ""
     ::nLeftMargin := 0
     ::nTopMargin  := 0
     ::nRow        := 0
     ::nCol        := 0
     ::lAnsiToOem  := .T.
     ::cPort       := StrTran( PrnGetPort(), ":", "" )
     ::nLastError  := fError()
     ::lUserConfig := lUserConfig
     if ::nLastError <> 0
        MsgInfo('There is no printer available')
     endif
     ::cDevice     := ::cPort+iif(!"."$::cPort,".PRN","")
     ::hDC         := fCreate(::cPort)

     ::lPreview    := .t.
     ::lCancel     := .f.
     ::nMaxLine    := 66
     ::nLength     := 66
     ::lModoGraf   := .f.
     ::lIsLaser    := .f.

     ::nPage := 1                  // Ednaldo
     ::PrintSetup()      //Ralph

RETURN Self
 

Re: TdosPrn con Preview (ralph/anserkk)

Posted: Tue Sep 13, 2011 11:38 am
by Bayron
I changed:

Code: Select all

FUNCTION WorkSheet(cPort)
 
for:

Code: Select all

Static FUNCTION WorkSheet(cPort)
 
It seems to be compiling now, I will save in my utils until I need it...
Thanks for sharing!!!

Re: TdosPrn con Preview (ralph/anserkk)

Posted: Tue Sep 13, 2011 12:10 pm
by karinha
anserkk wrote:

Code: Select all

*******************
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) 
 
Regards
Anser

Anser,

Muchas gracias.

Voy probar.

Re: TdosPrn con Preview (ralph/anserkk)

Posted: Wed May 16, 2012 12:53 am
by artu01
anser
i got this error in execution
Error description: Error BASE/1003 Variable does not exist: HKEY_LOCAL_MACHINE

thank for helping


FWH 08.11 xharbour 1.2.1 PellesC

Re: TdosPrn con Preview (ralph/anserkk)

Posted: Wed May 16, 2012 4:57 am
by anserkk
artu01 wrote:anser
i got this error in execution
Error description: Error BASE/1003 Variable does not exist: HKEY_LOCAL_MACHINE

Code: Select all

#define  HKEY_LOCAL_MACHINE      2147483650
Regards
Anser