HMG 3.4.3
Moderator: Rathinagiri
- srvet_claudio
- Posts: 2193
- Joined: Thu Feb 25, 2010 8:43 pm
- Location: Uruguay
- Contact:
Re: HMG 3.4.3
Pablo i will check.
Re: HMG 3.4.3
Great work, Pablo!Pablo César wrote:Thank you Mr. Yi for reporting your results and happy to know is satisfactory. The problem was not only for chinese characters, there are other languages with special characters that it could have been affected at time ago... now is solved, I guess.huiyi_ch wrote:After a preliminary test, the program(unicode and ANSI mode) for the INI file in Chinese characters, set and get all normal, the problem have been solved perfectly.
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
HMG 3.4.3
Thank you Kevin
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: HMG 3.4.3
Claudio Soto博士您好:
我想向您提一点建议,请在HMG_TString类中,增加按字节提取字符串的一些方法,尤其在ANSI模式下,我认为很有必要!这样在使用HMG_TString类对字符串进行处理时,将变的更加统一、规范、方便。
Hello Dr. Claudio Soto
I want to make a suggestion to you, please in the HMG_TString class, increase some methods for extracting parts of a character string by byte, especially in the ANSI mode, I think it is necessary! So,when using HMG_TString class to operate the string, will become more unified, standardized, convenient.
METHOD BLeft (cString, nCount) INLINE HB_BLEFT (cString, nCount)
METHOD BRight(cString, nCount) INLINE HB_BRIGHT (cString, nCount)
METHOD BSubStr(cString, nStart, nCount) INLINE HB_BSUBSTR (cString, nStart, nCount)
我想向您提一点建议,请在HMG_TString类中,增加按字节提取字符串的一些方法,尤其在ANSI模式下,我认为很有必要!这样在使用HMG_TString类对字符串进行处理时,将变的更加统一、规范、方便。
Hello Dr. Claudio Soto
I want to make a suggestion to you, please in the HMG_TString class, increase some methods for extracting parts of a character string by byte, especially in the ANSI mode, I think it is necessary! So,when using HMG_TString class to operate the string, will become more unified, standardized, convenient.
METHOD BLeft (cString, nCount) INLINE HB_BLEFT (cString, nCount)
METHOD BRight(cString, nCount) INLINE HB_BRIGHT (cString, nCount)
METHOD BSubStr(cString, nStart, nCount) INLINE HB_BSUBSTR (cString, nStart, nCount)
- srvet_claudio
- Posts: 2193
- Joined: Thu Feb 25, 2010 8:43 pm
- Location: Uruguay
- Contact:
Re: HMG 3.4.3
HB_Uxxx string functions work with any CP ( ANSI and Unicode ).huiyi_ch wrote:Claudio Soto博士您好:
我想向您提一点建议,请在HMG_TString类中,增加按字节提取字符串的一些方法,尤其在ANSI模式下,我认为很有必要!这样在使用HMG_TString类对字符串进行处理时,将变的更加统一、规范、方便。
Hello Dr. Claudio Soto
I want to make a suggestion to you, please in the HMG_TString class, increase some methods for extracting parts of a character string by byte, especially in the ANSI mode, I think it is necessary! So,when using HMG_TString class to operate the string, will become more unified, standardized, convenient.
METHOD BLeft (cString, nCount) INLINE HB_BLEFT (cString, nCount)
METHOD BRight(cString, nCount) INLINE HB_BRIGHT (cString, nCount)
METHOD BSubStr(cString, nStart, nCount) INLINE HB_BSUBSTR (cString, nStart, nCount)
Re: HMG 3.4.3
Hello Pablo César
经过测试,嵌套函数cFilePath(hb_ProgName())
在UNICODE模式,不论文件路径中有无中文字符,返回结果都正常!
在ANSI模式下,如果文件路径中存在中文字符,嵌套函数cFilePath(hb_ProgName())返回结果会多一个"\"字符,但getcurrentfolder()返回结果正确!
After testing, nested function cFilePath (hb_ProgName ())
In UNICODE, whether file path contain or not Chinese characters, return the results are normal!
In ANSI mode, if the file path contain Chinese characters, the nested function cFilePath (hb_ProgName()) returns the result incorrect , But getcurrentfolder () returns the result is normal.
经过测试,嵌套函数cFilePath(hb_ProgName())
在UNICODE模式,不论文件路径中有无中文字符,返回结果都正常!
在ANSI模式下,如果文件路径中存在中文字符,嵌套函数cFilePath(hb_ProgName())返回结果会多一个"\"字符,但getcurrentfolder()返回结果正确!
After testing, nested function cFilePath (hb_ProgName ())
In UNICODE, whether file path contain or not Chinese characters, return the results are normal!
In ANSI mode, if the file path contain Chinese characters, the nested function cFilePath (hb_ProgName()) returns the result incorrect , But getcurrentfolder () returns the result is normal.
Code: Select all
#include <hmg.ch>
request hb_codepage_gbk
Function Main()
local path:=""
hb_CdPSelect("GBK") //with chinese os, in ANSI moden must used hb_CdPSelect("GBK") ,else display "?????"
path:=cFilePath(hb_ProgName())
msginfo(path)
msginfo(getcurrentfolder())
Return nil
Re: HMG 3.4.3
Hello Dr. Claudio Sotosrvet_claudio wrote:HB_Uxxx string functions work with any CP ( ANSI and Unicode ).huiyi_ch wrote:Claudio Soto博士您好:
我想向您提一点建议,请在HMG_TString类中,增加按字节提取字符串的一些方法,尤其在ANSI模式下,我认为很有必要!这样在使用HMG_TString类对字符串进行处理时,将变的更加统一、规范、方便。
Hello Dr. Claudio Soto
I want to make a suggestion to you, please in the HMG_TString class, increase some methods for extracting parts of a character string by byte, especially in the ANSI mode, I think it is necessary! So,when using HMG_TString class to operate the string, will become more unified, standardized, convenient.
METHOD BLeft (cString, nCount) INLINE HB_BLEFT (cString, nCount)
METHOD BRight(cString, nCount) INLINE HB_BRIGHT (cString, nCount)
METHOD BSubStr(cString, nStart, nCount) INLINE HB_BSUBSTR (cString, nStart, nCount)
It is very possible that you do not understand what I mean! In HMG, I will use the method of the hmg_string class in a unified way, without going to use the function!
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
HMG 3.4.3
It's making sense, his request Claudio.huiyi_ch wrote:Hello Dr. Claudio Sotosrvet_claudio wrote:HB_Uxxx string functions work with any CP ( ANSI and Unicode ).huiyi_ch wrote:Claudio Soto博士您好:
我想向您提一点建议,请在HMG_TString类中,增加按字节提取字符串的一些方法,尤其在ANSI模式下,我认为很有必要!这样在使用HMG_TString类对字符串进行处理时,将变的更加统一、规范、方便。
Hello Dr. Claudio Soto
I want to make a suggestion to you, please in the HMG_TString class, increase some methods for extracting parts of a character string by byte, especially in the ANSI mode, I think it is necessary! So,when using HMG_TString class to operate the string, will become more unified, standardized, convenient.
METHOD BLeft (cString, nCount) INLINE HB_BLEFT (cString, nCount)
METHOD BRight(cString, nCount) INLINE HB_BRIGHT (cString, nCount)
METHOD BSubStr(cString, nStart, nCount) INLINE HB_BSUBSTR (cString, nStart, nCount)
It is very possible that you do not understand what I mean! In HMG, I will use the method of the hmg_string class in a unified way, without going to use the function!
These ones are missing at HMG_TString class:
Code: Select all
METHOD BLeft (cString, nCount) INLINE HB_BLEFT (cString, nCount)
METHOD BRight(cString, nCount) INLINE HB_BRIGHT (cString, nCount)
METHOD BSubStr(cString, nStart, nCount) INLINE HB_BSUBSTR (cString, nStart, nCount)
You have mentioned these Harbour function here but not included...
So I have not used before HB_B family... but nevertheless it would be good to have it in HMG. And can be added others like: HB_BAT, HB_BLEN, HB_BCODE, HB_BPEEK, HB_BPOKE and HB_BCHAR ?
Someone could tell me for what is it used for ? ( something about binary/byte ? )
I found this from Viktor Szakats for NTP functions:
Code: Select all
STATIC FUNCTION ntohl( c )
IF hb_Version( HB_VERSION_ENDIANNESS ) == HB_VERSION_ENDIAN_LITTLE
RETURN ;
hb_BSubStr( c, 4, 1 ) + ;
hb_BSubStr( c, 3, 1 ) + ;
hb_BSubStr( c, 2, 1 ) + ;
hb_BSubStr( c, 1, 1 )
ENDIF
RETURN c
Could it be useful (this checking) for something to us ?
Or just for as reference ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
HMG 3.4.3
Hi Hui, Claudio and friends,
For UNICODE works perfectly, the question is for ANSI mode. Of course and rebuild HMG in ANSI and make tests.
I have tested with this code example and with this changing to see results:
I have created a subfolder called "返回结果正确" and run it my demo and the bad result is this:
I tried Claudio to modificate GETPROGRAMFILENAME and GETMODULEFILENAME replacing GetModuleFileName by GetModuleFileNameA in trying to pass working these C functions only for ANSI. But it didn't work.
This changing to GetModuleFileNameA, it doesn't compile in UNICODE.
How it could could for ANSI (which is the main problem) for get right folder name ?
Sorry Mr. Hui. My knowledge is very very limited (quite nothing) in C. So it's not more in my hands, I guess.
For UNICODE works perfectly, the question is for ANSI mode. Of course and rebuild HMG in ANSI and make tests.
I have tested with this code example and with this changing to see results:
Code: Select all
#include <hmg.ch>
REQUEST HB_CODEPAGE_GBK
Function Main
hb_CdPSelect("GBK")
MSGDEBUG(MyGetStartUpFolder())
Return
Function MyGetStartUpFolder() // by Pablo on November, 2016 - To remove last unnecessary backslash
LOCAL cStartUpFolder
If HMG_IsCurrentCodePageUnicode()
cStartUpFolder := cFilePath(hb_ProgName())
Else
MsgInfo("In ANSI")
cStartUpFolder := cFilePath(GetProgramFileName())
Endif
If hb_ULeft(cStartUpFolder,1) = "\"
cStartUpFolder := hb_ULeft( cStartUpFolder, HMG_Len( cStartUpFolder ) - 1 )
Endif
Return cStartUpFolder
I tried Claudio to modificate GETPROGRAMFILENAME and GETMODULEFILENAME replacing GetModuleFileName by GetModuleFileNameA in trying to pass working these C functions only for ANSI. But it didn't work.
This changing to GetModuleFileNameA, it doesn't compile in UNICODE.
How it could could for ANSI (which is the main problem) for get right folder name ?
Sorry Mr. Hui. My knowledge is very very limited (quite nothing) in C. So it's not more in my hands, I guess.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: HMG 3.4.3
Hi Pablo
ANSI versions of these functions:
ANSI versions of these functions:
Code: Select all
HB_FUNC( GETPROGRAMFILENAMEA )
{
CHAR Buffer [MAX_PATH + 1];
GetModuleFileNameA(GetModuleHandle(NULL), Buffer, MAX_PATH);
hb_retc(Buffer);
}
HB_FUNC( GETMODULEFILENAMEA )
{
CHAR Buffer [MAX_PATH + 1];
HMODULE hModule = HB_ISNIL(1) ? GetModuleHandle(NULL) : (HMODULE) HMG_parnl(1);
GetModuleFileNameA(hModule, Buffer, MAX_PATH);
hb_retc(Buffer);
}