Re: ExecuteReport( )
Posted: Sun Apr 12, 2015 3:41 pm
Obrigado Daniel, vou esperar um pouco o do FW e ver a viabilidade. Meus conhecimentos em C são limitados.
Exclusive forum for HMG, a Free / Open Source xBase WIN32/64 Bits / GUI Development System
http://www.hmgforum.com/
Hola Andresandyglezl wrote: It happens something strange with this example ...
Only works with the image that brings the folder: D:\HMG\3.4\SAMPLES\hPDF\HMG_HPDF\hmghpdf.png
Can someone try, any ideas?
Code: Select all
#xtranslate @ <nRow> , <nCol> PRINT IMAGE <cImage> ;
WIDTH <nWidth> ;
HEIGHT <nheight> ;
[ <stretch : STRETCH> ] ;
[ <transparent: TRANSPARENT> ] ;
[ TRANSPARENTCOLOR <aTransparentColor> ];
[ TYPE <cType:JPG,PNG> ] ;
=> ;
iif( _HMG_SYSDATA \[ 513 \],_HMG_HPDF_IMAGE ( <cImage> , <nRow> , <nCol> , <nheight> , <nWidth> , <.stretch.>, <"cType"> ), _HMG_PRINTER_H_IMAGE ( _HMG_SYSDATA \[ 374 \] , <cImage> , <nRow> , <nCol> , <nheight> , <nWidth> , <.stretch.> , <.transparent.> , <aTransparentColor> ) )
Thanks for sharing the code ! I tried it with a simple example:Amarante wrote:Clearing Up ....
This routine is not of my own ... it was originally made by Rossine, who posted it on another forum and that Pablo thought was a woman. I just changed for my needs.
Run_MyProcess does not prevent the user closes their program .... you need to make use of other artifices to prevent the ever-existing, user wretched, miserable and other insults that I should not speak here to find a flaw in your program.
Another time I will show in a sample program.
------------------
Aclarar ....
Esta rutina no es de mi propia ... que fue hecho originalmente por Rossine, quien lo publicó en otro foro y que Pablo creía que era una mujer. Acabo de cambiar para mis necesidades.
Run_MyProcess no impide que el usuario cierra su programa .... lo necesario para hacer uso de otros artificios para evitar la siempre existente, el usuario desventurado, miserable y otros insultos que no debo hablar aquí para encontrar un defecto en su programa.
Otra vez voy a mostrar en un programa de ejemplo.
------------------
Esclarecendo....
Essa rotina não é de minha autoria... foi feita originalmente por Rossine, que postou ela em outro fórum e que o Pablo achava que era mulher. Eu apenas alterei para minhas necessidades.
A Run_MyProcess não impede que o usuário feche o seu programa.... você precisa fazer usar de outros artificios para impedir o sempre existente, usuário desgraçado, miseravel e outros impropérios que não devo falar aqui de achar uma falha no seu programa.
Outra hora demonstrarei em um programa exemplo.
Code: Select all
#include "hmg.ch"
#include "fileio.ch"
Function Main
DEFINE WINDOW Win_1 ;
ROW 0 ;
COL 0 ;
WIDTH 640 ;
HEIGHT 480 ;
TITLE 'Test' ;
WINDOWTYPE MAIN
@ 030,160 BUTTON Button_1 CAPTION "Create & Open Test.txt" ACTION {||Test1()} WIDTH 290
END WINDOW
Win_1.Center
Win_1.Activate
Return
PROCEDURE Test1()
hb_memowrit( "test.txt", "Test File..." )
Run_MyProcess( "notepad test.txt")
RETURN
/**
*
* Run_MyProcess
*
* Description: Executes an external process
* Syntax.....: Run_MyProcess( <expC1>, [expL1], [expB1], [expN1], [expN2] )
* Parameters.: <expC1> - Expression of process running
* [expL1] - Wait on process (default .T.)
* [expB1] - Block-function to be performed during the process
* [expN1] - Time (default 1)
* [expN2] - Number of times to perform the block-function (default 0)
* Return.....: expN - Result of the process
* Example....:
* Run_MyProcess( "SumatraPDF.exe " + "Certidao.PDF", .T. )
* ------ other sample -----
* hb_memowrit( "test.txt", "Test File..." )
* ? "Retorno:", Run_MyProcess( "notepad test.txt", .T., { || QOUT( "Waiting Notepad close..." ) }, 1 )
* WAIT "When you get here notepad already ended. press ENTER..."
* ? "Retorno:", Run_MyProcess( "notepad test.txt", .F. )
* WAIT "When you get here notepad is still running. press ENTER..."
* ? "Retorno:", Run_MyProcess( "notepad test.txt",, { | nCtd | QOUT( "Waiting Notepad close (" + hb_ntos( 5 - nCtd ) + ")..." ) },, 5 )
* WAIT "The Loop was closed after in 5 seconds..."
* ? "Retorno:", Run_MyProcess( "notepad test.txt",, { | nCtd | QOUT( "Forcing the closure of Notepad by returning the codeblock..." ), IIF( nCtd = 2, .F., .T. ) } )
* WAIT "The Loop was closed..."
*
*/
FUNCTION Run_MyProcess( cExecute, lWait, bBlock, nTime, nOccurs )
#define LWA_ALPHA 0x02
LOCAL cWin_ := _HMG_SYSDATA[ 316 ] // Name of the current window
LOCAL hProcess
LOCAL nCtd := 0
LOCAL nResult
LOCAL lRet
__DefaultNIL( @lWait, .T. )
__DefaultNIL( @nTime, 1 )
__DefaultNIL( @nOccurs, 0 )
hProcess := HB_ProcessOpen( cExecute )
IF hProcess <> F_ERROR
SetLayeredWindowAttributes( GetFormHandle( cWin_ ), 0, 180, LWA_ALPHA )
DO WHILE ( nResult := HB_ProcessValue( hProcess, .F. ) ) == - 1
DO EVENTS
IF .NOT. lWait
EXIT
ENDIF
nCtd += 1
IF HB_IsBlock( bBlock )
lRet := EVAL( bBlock, nCtd )
IF HB_IsLogical( lRet ) .AND. .NOT. lRet
HB_ProcessClose( hProcess, .T. )
EXIT
ENDIF
ENDIF
IF nTime > 0
HB_IdleSleep( nTime )
ENDIF
IF nCtd == nOccurs
HB_ProcessClose( hProcess, .T. )
EXIT
ENDIF
ENDDO
SetLayeredWindowAttributes( GetFormHandle( cWin_ ), 0, 255, LWA_ALPHA )
ELSE
MsgInfo( "Error Open Process" )
ENDIF
RETURN nResult