FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour To Antonio:
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
To Antonio:
Posted: Thu Aug 18, 2016 10:46 AM
Antonio:

My friend, you provided me this piece of code (that works GREAT) as a way to set the console window title:
Code (fw): Select all Collapse
#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

HB_FUNC( SETCONSOLETITLE )
{
   hb_retl( SetConsoleTitle( ( char * ) hb_parc( 1 ) ) );
}

#pragma ENDDUMP


Is there a way to get the current caption / title ?

Thank you very much !!!!
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: To Antonio:
Posted: Thu Aug 18, 2016 10:54 AM
Look function GetConsoleTitle, please test

Code (fw): Select all Collapse
#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

HB_FUNC( SETCONSOLETITLE )
{
   hb_retc( GetConsoleTitle( ( char * ) hb_parc( 1 ), 50 ) );
}
#pragma ENDDUMP
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
Re: To Antonio:
Posted: Thu Aug 18, 2016 12:20 PM
Cristobal:

Gracias por la idea, pero da este mensaje:
Code (fw): Select all Collapse
Error E2342 .\\ROUTINES.PRG 109: Type mismatch in parameter 'szText' (wanted 'co
nst signed char *', got 'unsigned long') in function HB_FUN_GETCONSOLETITLE
*** 1 errors in Compile ***


Gracias mi amigo.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: To Antonio:
Posted: Mon Aug 29, 2016 05:56 PM
Gustavo,

Prueba asi:
Code (fw): Select all Collapse
#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

HB_FUNC( GETCONSOLETITLE )
{
   char buffer[ 100 ];
   DWORD dwSize;

   dwSize = GetConsoleTitle( buffer, 100 );
   hb_reclen( buffer, dwSize );
}
#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
Re: To Antonio:
Posted: Tue Aug 30, 2016 05:25 AM
Antonio:

Thank you for your prompt response. Using Harbour Harbour320_160105_0904 and Borland BCC7 I'm getting the following linker error:
Code (fw): Select all Collapse
Turbo Incremental Link 6.70 Copyright (c) 1997-2014 Embarcadero Technologies, Inc.
Error: Unresolved external '_hb_reclen' referenced from C:\APPS\TEST\OBJ\PROG02.OBJ
Error: Unable to perform link
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: To Antonio:
Posted: Tue Aug 30, 2016 06:19 AM
Gustavo,

Modifica esta línea asi:

hb_retclen( buffer, dwSize );
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion