Amigos Leyendo en http://codigo-base.blogspot.com/ hay un tema que dice Depurando en Windows
Y precisa que podemos invocar desde FW esta funcion del API
IF File( "test.txt" )
OutputDebugString( "El archivo existe" + hb_osnewline() )
ELSE
OutputDebugString( "El archivo no existe" + hb_osnewline() )
ENDIF
Al incluir esto en nuestro codigo fuente realmente no estaremos viendo nada, en primer lugar antes de ejecutar nuestro programa debemos tener en ejecucion dbwin32.exe, este programa se encarga de mostrar en pantalla la informacion pasada como parametro a la funcion
OutputDebugString().
CUando pongo esta fuincion me sale un error
UNRESOLVED EXTERNAL hb_fun_OutputDebugString
que LIB contiene el soporte a esta funcion del API
que deba poner en mi lnk.
Gracias
OutputDebugString(
-
- Posts: 225
- Joined: Tue Feb 28, 2006 4:25 pm
- Location: PERU
OutputDebugString(
ME INTERESA FW Y XHB POR SER OPEN SOURCE
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Vladimir,
Aqui la tienes:
Aqui la tienes:
Code: Select all
#include "FiveWin.ch"
function Main()
OutputDebugString( "Test" )
return nil
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
HB_FUNC( OUTPUTDEBUGSTRING )
{
OutputDebugString( hb_parc( 1 ) );
}
#pragma ENDDUMP
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Y aqui una copia de DbWin32.zip para que la tengamos siempre a mano
www.fivetechsoft.com/files/utilities/dbwin32.zip
www.fivetechsoft.com/files/utilities/dbwin32.zip
- carlos vargas
- Posts: 1421
- Joined: Tue Oct 11, 2005 5:01 pm
- Location: Nicaragua
Funciona de la siguiente forma, en cualquier parte de su programa use
archivo .ch
archivo .prg
Code: Select all
??? date(), time(), version(), 1+1
archivo .ch
Code: Select all
#xcommand ??? <xData> [, <xDataN> ] => OutPutDebugString( <xData> ) ;
[; OutPutDebugString( <xDataN>) ]
Code: Select all
FUNCTION OutPutDebugString(xVal)
OutPutDebugStringC( HB_ValToStr(xVal) )
RETURN NIL
#pragma BEGINDUMP
#include "windows.h"
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbapierr.h"
HB_FUNC( OUTPUTDEBUGSTRINGC )
{
OutputDebugStringA( hb_parc( 1 ) );
}
HB_FUNC ( EXITPROCESS )
{
ExitProcess( 0 ) ;
}
#pragma ENDDUMP
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
Carlos Vargas
Desde Managua, Nicaragua (CA)
-
- Posts: 988
- Joined: Thu Nov 24, 2005 3:01 pm
- Location: Madrid, España
Gente,
tengo una definición de comando que uso hace bastante tiempo, que te pasa no solo el valor sino tambien la lineas de la funcion donde se invoca, y la expresion evaluada. Al ser un comando, se puede hacer una definición nula cuando se compila la version final.
Es interesante tambien el uso de transform para hacer string casi cualquier cosa, pero no es el tema a tratar
Por ejemplo, si ponemos en la línea 895 de bitmap.prg la sig. línea,
Un ejemplo de lo que obtendremos en dBWin32 podría ser:
Esto nos ayuda a saber Exactamente que estamos viendo, porque si imprimimos solo el valor en outdebug no sabremos exactamente a que variable o campo corresponde, ni a que punto del programa corresponde si tenemos muchos valores.
Y todo esto se quita con añadir un /D__RELEASE__ en la línea de compilación de los prgs!
Espero que les sea tan útil como a mí,
Carlos.
tengo una definición de comando que uso hace bastante tiempo, que te pasa no solo el valor sino tambien la lineas de la funcion donde se invoca, y la expresion evaluada. Al ser un comando, se puede hacer una definición nula cuando se compila la version final.
Code: Select all
#ifdef __RELEASE__
# xtranslate DEBUG <clauses, ...> =>
#else
#translate ASSTRING( <x> ) => If( <x> == NIL, 'NIL', Transform( <x> , NIL ) ) + CRLF
#xcommand DEBUG <cString1>[, <cStringN>] ;
=> ;
OutputDebugString( ProcName() +"("+LTrim(Str(ProcLine())) +") - " ) ; OutputDebugString( <"cString1">+" ("+ValType( <cString1> )+"): " ) ; OutputDebugString( ASSTRING( <cString1> ) ) ;
[ ; OutputDebugString( ProcName() +"("+LTrim(Str(ProcLine())) +") - " ) ; OutputDebugString( <"cStringN">+" ("+ValType( <cStringN> )+"): " ) ; OutputDebugString( ASSTRING( <cStringN> ) ) ]
#endif
Por ejemplo, si ponemos en la línea 895 de bitmap.prg la sig. línea,
Code: Select all
DEBUG ::lScroll, nVisHeight, nVisWidth, ::hBitmap, ::oVScroll
Code: Select all
TBITMAP:SCROLLADJUST(895) - ::lScroll (L): F
TBITMAP:SCROLLADJUST(895) - nVisHeight (N): 329
TBITMAP:SCROLLADJUST(895) - nVisWidth (N): 450
TBITMAP:SCROLLADJUST(895) - ::hBitmap (N): -1509616760
TBITMAP:SCROLLADJUST(895) - ::oVScroll (U): NIL
TBITMAP:SCROLLADJUST(895) - ::lScroll (L): F
TBITMAP:SCROLLADJUST(895) - nVisHeight (N): 656
TBITMAP:SCROLLADJUST(895) - nVisWidth (N): 1024
TBITMAP:SCROLLADJUST(895) - ::hBitmap (N): -536539779
TBITMAP:SCROLLADJUST(895) - ::oVScroll (U): NIL
Y todo esto se quita con añadir un /D__RELEASE__ en la línea de compilación de los prgs!
Espero que les sea tan útil como a mí,
Carlos.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: