Antonio:
Caller Program (Harbour console program)
Code: Select all
cOldCap := GetConsoleTitle()
cCommand := "EXTCMD.EXE " + "IMAGE IMAGES\" + ALLTRIM(Img_filenm) + ".JPG" + " " + ["] + Img_name + ["] + " " + ["] + cOldCap + ["]
cCaption := ALLTRIM( Img_name ) + " - Software (C) Ver. 1.0"
RUN ( "&cCommand" )
EXTCMD.EXE (used to avoid caller program to be tied to called one until it closes. This way caller program can continue without called one being closed)
Code: Select all
#include "Common.ch"
PROCEDURE Main ( cCommand, cArg1, cArg2, cArg3, cArg4 )
MEMVAR cCmd, cParms
PRIVATE cCmd, cParms := ""
DEFAULT cCommand TO ""
DEFAULT cArg1 TO ""
DEFAULT cArg2 TO ""
DEFAULT cArg3 TO ""
DEFAULT cArg4 TO ""
cCmd := cCommand
IF VALTYPE( cArg1 ) == "C" .AND. VALTYPE( cArg2 ) == "C" .AND. ;
VALTYPE( cArg3 ) == "C"
cParms := ["] + cArg1 + ["] + " " + ["] + cArg2 + ["] + " " + ["] + cArg3 + ["]
ELSE
cParms := cArg1
ENDIF
IF VALTYPE( cCmd ) == "C"
IF cParms != NIL .AND. LEFT( cParms, 1 ) != CHR( 34 )
cParms := CHR( 34 ) + cParms
ENDIF
IF cParms != NIL .AND. RIGHT( cParms, 1 ) != CHR( 34 )
cParms := cParms + CHR( 34 )
ENDIF
DEFAULT cParms TO ""
RUN START /I /B &cCmd &cParms
ENDIF
RETURN
// EOP: Main
Called program (image.exe):
Code: Select all
#define NO_OF_COLS INT( GetSysMetrics( 0 ) / 7.933884297520661157 )
#define NO_OF_ROWS INT( GetSysMetrics( 1 ) / 15.18987341772151898 )
// #define NO_OF_COLS 242
// #define NO_OF_ROWS 77
#include "Common.ch"
#include "Fivewin.ch"
#include "Image.ch"
//----------------------------------------------------------------------------//
function Main ( cFile, cImgName, cCaller )
LOCAL oDlg, oSay1, oImage, nCaller
DEFINE DIALOG oDlg ;
TITLE ALLTRIM( cImgName ) + " - Software (C) Ver. 1.0"
oDlg:nTop := GetSysMetrics( 1 ) - 250 - 65
oDlg:nLeft := GetSysMetrics( 0 ) - 377 - 10
oDlg:nBottom := GetSysMetrics( 1 ) - 65
oDlg:nRight := GetSysMetrics( 0 ) - 10
@ 00,00 SAY oSay1 VAR cImgName OF oDlg CENTERED PIXEL SIZE 145,10;
COLOR nRGB(255,255,255), nRGB(0,0,255)
@ 10,00 IMAGE oImage SIZE 150, 140 OF oDlg SCROLL PIXEL // ADJUST
@ 10,155 BUTTON "&Imprimir" SIZE 30,10 OF oDlg PIXEL ACTION PrintImage( oImage )
@ 55,155 BUTTON "&Terminar" SIZE 30,10 OF oDlg PIXEL ACTION oDlg:End()
@ 110,155 CHECKBOX oImage:lStretch PROMPT "&Agrandar" SIZE 75, 10 OF oDlg ;
PIXEL ON CHANGE ( oImage:ScrollAdjust(), oImage:Refresh() )
IF OpenFile ( @oImage, @cFile )
nCaller := FindWindow( 0, cCaller )
ACTIVATE DIALOG oDlg ON INIT ( SysRefresh(), SetFocus( nCaller ), SetForeGroundWindow( nCaller ) )
// ACTIVATE DIALOG oDlg ON INIT SetFocus( FindWindow( 0, cCaller ) )
ENDIF
return nil
// EOF: Main
//----------------------------------------------------------------------------//
FUNCTION OpenFile (oImage, cFile)
LOCAL lPass
IF ! (lPass := FILE(cFile))
MsgInfo("Esta Imagen No Existe: " + cFile)
ELSE
oImage:LoadBmp(cFile)
ENDIF
RETURN (lPass)
* EOF: OpenFile
FUNCTION PrintImage( oImage )
LOCAL oPrn
PRINT oPrn NAME "Image Printing" PREVIEW
PAGE
oPrn:SayImage( 0, 0, oImage )
ENDPAGE
ENDPRINT
RETURN NIL
* EOF: PrintImage
//----------------------------------------------------------------------------//