To Antonio:

To Antonio:

Postby HunterEC » 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: Select all  Expand view


#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 !!!!
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: To Antonio:

Postby cnavarro » Thu Aug 18, 2016 10:54 am

Look function GetConsoleTitle, please test

Code: Select all  Expand view

#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
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: To Antonio:

Postby HunterEC » Thu Aug 18, 2016 12:20 pm

Cristobal:

Gracias por la idea, pero da este mensaje:
Code: Select all  Expand view
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.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: To Antonio:

Postby Antonio Linares » Mon Aug 29, 2016 5:56 pm

Gustavo,

Prueba asi:
Code: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42094
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: To Antonio:

Postby HunterEC » Tue Aug 30, 2016 5: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: Select all  Expand view
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
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: To Antonio:

Postby Antonio Linares » Tue Aug 30, 2016 6:19 am

Gustavo,

Modifica esta línea asi:

hb_retclen( buffer, dwSize );
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 111 guests