No muestra las letras acentuadas?

HMG en Español

Moderator: Rathinagiri

Leopoldo Blancas
Posts: 388
Joined: Wed Nov 21, 2012 7:14 pm
Location: México

Re: No muestra las letras acentuadas?

Post by Leopoldo Blancas »

Hola!!!

Dr. Claudio gracias por el tip SET CODEPAGE TO SPANISH
Saludos
Polo
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: No muestra las letras acentuadas?

Post by Pablo César »

Como hago para compilar y exibir correctamente el retorno de los ficheros en portugues ahora que el compilador está trabajando em UNICODE ?
Utilizo la funcion GET_FOLDER_LINK que devuelve los nombres de las carpetas del Windows utilizando la API y creo que estas están devolviendo em ANSI.
Tendria que convertir de ANSI para UNICODE o que es lo que estoy haciendo de errado ?

Code: Select all

#include "hmg.ch"

#define CSIDL_LOCAL_APPDATA             28
#define SHGFP_TYPE_CURRENT              0

Function Main()
MsgInfo( GET_FOLDER_LINK( SHGFP_TYPE_CURRENT, CSIDL_LOCAL_APPDATA ) )
Return Nil

#pragma begindump

#include <windows.h>
#include <shlobj.h>

#include "hbapi.h"

//************************************************************************************************************
// GET_FOLDER_LINK (id_SHGFP_TYPE, id_CSIDL) ---> Return cFolder
//************************************************************************************************************
HB_FUNC (GET_FOLDER_LINK)
{   
    TCHAR pszPath [MAX_PATH];
    DWORD id_SHGFP_TYPE = (DWORD) hb_parnl (1);
    INT   id_CSIDL      = (INT)   hb_parnl (2);
    
    if(SUCCEEDED (SHGetFolderPath (NULL, id_CSIDL, NULL, id_SHGFP_TYPE, pszPath)))
        hb_retc (pszPath);
    else
        hb_retc ("ERROR: The folder does not exist");            
}

#pragma enddump
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: No muestra las letras acentuadas?

Post by Pablo César »

Ya entendi, me faltaba adiconar el pragma

#define COMPILE_HMG_UNICODE
#include "HMG_UNICODE.h"

Resuelto ! Disculpen, fué distraccion mia.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
srvet_claudio
Posts: 2223
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: No muestra las letras acentuadas?

Post by srvet_claudio »

Pablo, demás de agregarle al código en C:

Code: Select all

#define COMPILE_HMG_UNICODE
#include "HMG_UNICODE.h"
antes de los demás #include, cambia hb_retc() por HMG_retc() y agrégale _TEXT() al mensaje.

Code: Select all

 if(SUCCEEDED (SHGetFolderPath (NULL, id_CSIDL, NULL, id_SHGFP_TYPE, pszPath)))
        HMG_retc (pszPath);
    else
        HMG_retc (_TEXT("ERROR: The folder does not exist"));
Saludos,
Claudio.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: No muestra las letras acentuadas?

Post by Pablo César »

Ahhh si si, me habia olvidado de mencionar. Fundamental cambiar de hb_retc() por HMG_retc() y ponerle el _TEXT() cuando haya necesidad de exponer algun mensaje de tela. Gracias por el esclarecimiento.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: No muestra las letras acentuadas?

Post by Pablo César »

srvet_claudio wrote:pero como dijo Daniel, lo ideal es trabajar directo con el texto en Unicode.
Esto implica que además de usar SET LANGUAGE TO SPANISH, debes utilizar um editor (puede ser el Notepad++ que viene en el paquete HMG) e ir en la opcion Formatar / Codificacion UTF. Irás notar que tendrás que reahacer todos las acentuaciones. Pero eso no es tan dificil, no ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply