TdosPrn con Preview (ralph/anserkk)

Sdo
Posts: 23
Joined: Wed Apr 09, 2008 5:00 pm
Location: Brasil

TdosPrn con Preview (ralph/anserkk)

Post 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...
FWH 9.07 - xHarbour 1.1.0 (Simplex) - PELLES C xDev 0.65
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: TdosPrn con Preview (ralph/anserkk)

Post by anserkk »

Dear Mr.Sergio,

I shall put the download link here by tomorrow.

Regards
Anser
Sdo
Posts: 23
Joined: Wed Apr 09, 2008 5:00 pm
Location: Brasil

Re: TdosPrn con Preview (ralph/anserkk)

Post 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...
FWH 9.07 - xHarbour 1.1.0 (Simplex) - PELLES C xDev 0.65
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: TdosPrn con Preview (ralph/anserkk)

Post 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
Sdo
Posts: 23
Joined: Wed Apr 09, 2008 5:00 pm
Location: Brasil

Re: TdosPrn con Preview (ralph/anserkk)

Post by Sdo »

anserkk,

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

Um abraço !!!

Sergio....
FWH 9.07 - xHarbour 1.1.0 (Simplex) - PELLES C xDev 0.65
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: TdosPrn con Preview (ralph/anserkk)

Post 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.
João Santos - São Paulo - Brasil
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: TdosPrn con Preview (ralph/anserkk)

Post 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
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: TdosPrn con Preview (ralph/anserkk)

Post by karinha »

anserkk,

Muchas Gracias, thank you very much.

Regards, saludos.
João Santos - São Paulo - Brasil
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: TdosPrn con Preview (ralph/anserkk)

Post by karinha »

anserkk,

Ahora me genera esto error:


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


Gracias,

Saludos.
João Santos - São Paulo - Brasil
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: TdosPrn con Preview (ralph/anserkk)

Post 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
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: TdosPrn con Preview (ralph/anserkk)

Post 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
 
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: TdosPrn con Preview (ralph/anserkk)

Post 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!!!
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: TdosPrn con Preview (ralph/anserkk)

Post 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.
João Santos - São Paulo - Brasil
artu01
Posts: 306
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: TdosPrn con Preview (ralph/anserkk)

Post 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
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: TdosPrn con Preview (ralph/anserkk)

Post 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
Post Reply