IsPrinter() & XP

IsPrinter() & XP

Postby avista » Tue Aug 12, 2008 1:59 pm

I still use some clipper applications but have problem with IsPrinter() function becouse under XP it always return .T.
Some solution please ?

Best regards,

p.s

1. If someone have problems with 100% used procesor when start clipper application to release it look for library OSLIB.LIB and use function
OL_AutoYield(.t.)

2. If clipper application print verry slow... starting to print after 15-20 seconds:

START REGEDIT
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WOW
on LPT_Timeout put data 1
it mean start printing after 1 second.
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Postby Antonio Linares » Tue Aug 12, 2008 2:41 pm

You can use the Harbour's IsPrinter() source code to build your own MyIsPrinter():

http://harbour-project.svn.sourceforge. ... iew=markup
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby avista » Wed Aug 13, 2008 7:58 am

Thanks Antonio for fast reply
Can i find a LIB file of it ?

Best regards,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Postby Antonio Linares » Wed Aug 13, 2008 8:01 am

There is no LIB for 16 bits for that code. You have to use that code to build a 16 bits OBJ to link to your application.

Please let me know if you need help to build it,
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby avista » Wed Aug 13, 2008 8:08 am

Sorry but yes i need help to build it ...

Thanks on reply Antonio

Regards,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Postby Antonio Linares » Wed Aug 13, 2008 9:47 am

Here you have the harbour source code adapted for Borland C 16 bits and the generated OBJ. When you link your EXE it may require some missing external functions. Right now I have to go our of the office here, but when I get back I will help you with them:

isprint.c (Borland 16 bits)
Code: Select all  Expand view
// Harbour isprinter.c adapted source code for Borland C 16 bits

#include <Winten.h>
#include <Windows.h>
#include <ClipApi.h>

int strnicmp( char *, char *, int );
int atoi( char * );

BOOL hb_printerIsReady( char * pszPrinterName )
{
   BOOL bIsPrinter;

   {
      USHORT uiPort;
     
      if( pszPrinterName == NULL )
         pszPrinterName = "LPT1";

      if( strnicmp( pszPrinterName, "PRN", 3 ) == 0 )
      {
         _AH = 2;
         _DX = 0; /* LPT1 */

         asm int 0x11; // 17       
     
         bIsPrinter = ( _AH == 0x90 );
      }
      else if( strlen( pszPrinterName ) >= 4 &&
               strnicmp( pszPrinterName, "LPT", 3 ) == 0 &&
               ( uiPort = atoi( pszPrinterName + 3 ) ) > 0 )
      {
         _DX = uiPort - 1;
         _AH = 2;

         asm int 0x11; // 17       
     
         bIsPrinter = ( _AH == 0x90 );
      }
      else
         bIsPrinter = FALSE;
   }

   return bIsPrinter;
}

void pascal HB_ISPRINTER( void )
{
   _retl( hb_printerIsReady( _parc( 1 ) ) );
}

Here is the OBJ:
http://rapidshare.com/files/136987435/i ... r.obj.html

Please notice that the funcion name is HB_ISPRINTER( [cPort] ) --> lYesNo and you can provide an optional parameter to it for the port to check.
Last edited by Antonio Linares on Wed Aug 13, 2008 2:11 pm, edited 1 time in total.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby avista » Wed Aug 13, 2008 2:10 pm

Hi Antonio,
Please check it ... and thanks


C:\verzii\aaa>blinker fi proba,isprinter
__ __
(«») («») BLINKER Dynamic Overlay Linker 1.00 for CA-Clipper 5.3

___ Blink and you'll miss it !!

Copyright (c) Assembler Software Manufacturers, Inc. 1990 - 1995
All Rights Reserved. Licensed solely for use with CA-Clipper 5.3

BLINKER : 1115 : PROBA.OBJ(PROBA) : 'HB_ISPRINT' : unresolved external
BLINKER : 1115 : ISPRINTER.OBJ(ISPRINTER) : '_ATOI' : unresolved external
BLINKER : 1115 : ISPRINTER.OBJ(ISPRINTER) : '_STRNICMP' : unresolved external

BLINKER : 0 Warning error(s), 3 Fatal error(s)

PROBA.EXE (not created) (0.1 seconds)


best regards,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Postby Antonio Linares » Wed Aug 13, 2008 2:15 pm

This OBJ fixes the function name:
http://rapidshare.com/files/137038224/i ... r.obj.html

Please use it as HB_PRINT().

Next I help you to solve those two unresolved externals
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Wed Aug 13, 2008 2:55 pm

Much simpler :-)
Code: Select all  Expand view
#include <ClipApi.h>

void pascal ISPRN( void )
{
   _DX =  _parni( 1 ) - 1;      
   _AH = 2;
   
   asm int 0x11; // 17
   
   _retl( _AL == 0x90 );
}   

From your PRG use it this way:
MsgInfo( IsPrn( 1 ) ) // checks LPT1
MsgInfo( IsPrn( 2 ) ) // checks LPT2
...
Here you have the OBJ:
http://rapidshare.com/files/137047090/i ... r.obj.html
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby avista » Thu Aug 14, 2008 8:03 am

Going good while compiling and linking,
but IsPrn() or IsPrn(1) returning .f. in any case ... is printer present or no.

Regards,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Postby Antonio Linares » Thu Aug 14, 2008 10:29 am

There was an error in my code:

http://www.ctyme.com/intr/rb-2100.htm

This is the right code:
Code: Select all  Expand view
#include <ClipApi.h>

void pascal ISPRN( void )
{
   _DX = _parni( 1 ) - 1;      
   _AH = 2;
   
   asm int 0x17;
   
   _retl( _AL == 0x90 );
}   

And here you have the OBJ:
http://rapidshare.com/files/137243032/i ... r.obj.html

You have to use it the same way
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby avista » Fri Aug 15, 2008 7:36 am

The same,
Always return .f.

Best regards,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Postby Antonio Linares » Fri Aug 15, 2008 8:00 am

Then lets try another way:

Code: Select all  Expand view
#include "FiveWin.ch"

function IsPrn()

   local lResult, oPrn

   PRINT oPrn
      lResult = ! Empty( oPrn:hDC )
   ENDPRINT

return lResult
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby avista » Fri Aug 15, 2008 8:20 am

C:\verzii\aaa>D:BLINKER FI PROBA
__ __
(«») («») BLINKER Dynamic Overlay Linker 1.00 for CA-Clipper 5.3

___ Blink and you'll miss it !!

Copyright (c) Assembler Software Manufacturers, Inc. 1990 - 1995
All Rights Reserved. Licensed solely for use with CA-Clipper 5.3

BLINKER : 1115 : PROBA.OBJ(PROBA) : 'PRINTBEGIN' : unresolved external
BLINKER : 1115 : PROBA.OBJ(PROBA) : 'PRINTEND' : unresolved external

BLINKER : 0 Warning error(s), 2 Fatal error(s)

PROBA.EXE (not created) (0.1 seconds)

________________________________
Regards and thanks for time Antonio,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Postby Antonio Linares » Fri Aug 15, 2008 8:22 am

Aren't you using FiveWin in your application ?

FiveWin is required to make that code work
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 8 guests