Page 15 of 30
Re: HMG 3.4.3
Posted: Sun Nov 27, 2016 8:12 pm
by KDJ
Pablo, so we invite you on vacation to Poland.
Polish language you almost mastered, therefore there will be no communication problems.
HMG 3.4.3
Posted: Mon Nov 28, 2016 12:53 am
by Pablo César
Thanks a lot. The same I can tell you when you would like to come to south of Brasil.
HMG 3.4.3
Posted: Mon Nov 28, 2016 10:10 pm
by Pablo César
Hi Mr. Hui,
Regarding GetStartUpFolder in ANSI
Any news ? Have you solved ? Have you tested my pre-solution ?
Please give us return...
Re: HMG 3.4.3
Posted: Tue Nov 29, 2016 3:40 am
by huiyi_ch
Pablo César 您好,
我这几天由于休假,没有及时将测试结果回复,请谅解.
我下载了您的程序并进行了测试(在UNICODE和ANSI模式下),结果一切正常.我觉得您的解决方案更稳妥,兼容性更好.非常感谢您的付出.
Hello Pablo César,
I am a few days due to leave, not in time to test results back, please understand.
I downloaded your program and tested it (in UNICODE and ANSI mode) and everything worked fine. I found your solution to be more secure and more compatible. Thank you very much.
HMG 3.4.3
Posted: Tue Nov 29, 2016 9:42 am
by Pablo César
Hi Mr. Hui,
Thank you for reporting.
huiyi_ch wrote:tested it (in UNICODE and ANSI mode) and everything worked fine
That's good ! Is that what I wanted to know. If in ANSI is working good. Because for me it was working a little bit strange in ANSI by my last tests.
Have the ANSI strings been treated or are you using directly without any problem?
Re: HMG 3.4.3
Posted: Tue Nov 29, 2016 1:44 pm
by huiyi_ch
Once again, I tested the function MyGetStartUpFolder (), In ANSI mode, the function returns the correct result.
Code: Select all
#include <hmg.ch>
REQUEST HB_CODEPAGE_GBK
Function Main
local cpath,i
MyGetStartUpFolder()
hb_CdPSelect("GBK") // "CP936" // GB2312
cpath:=MyGetStartUpFolder()
for i:=1 to ostring:len(cpath)
msginfo(ostring:substr(cpath,i,1))
next
Return
Function MyGetStartUpFolder() // by Pablo on November, 2016 - To remove last unnecessary backslash
LOCAL cStartUpFolder := cFilePath(hb_ProgName())
If HMG_IsCurrentCodePageUnicode()
If hb_URight(cStartUpFolder,1) = "\"
cStartUpFolder := hb_URight( cStartUpFolder, HMG_Len( cStartUpFolder ) - 1 )
Endif
MSGDEBUG("UNICODE",cStartUpFolder)
Else
If Right(cStartUpFolder,1) = "\"
cStartUpFolder := SubStr( cStartUpFolder, 1, Len( cStartUpFolder ) - 1 )
Endif
MSGDEBUG("ANSI",cStartUpFolder)
Endif
Return cStartUpFolder

- ansi_mode.jpg (81.2 KiB) Viewed 6310 times
HMG 3.4.3
Posted: Tue Nov 29, 2016 2:16 pm
by Pablo César
Thank you Mr. Hui.
My system is not in Chinese and I could not test in ANSI.
Dr. Claudio, do you think that is posible to officially replace actual GetStartUpFolder() by this MyGetStartUpFolder() for us ? (not with the same name, of course).
Code: Select all
Function MyGetStartUpFolder() // by Pablo on November, 2016 - To remove last unnecessary backslash
LOCAL cStartUpFolder := cFilePath(hb_ProgName())
If HMG_SupportUnicode()
If hb_URight(cStartUpFolder,1) = "\"
cStartUpFolder := hb_URight( cStartUpFolder, HMG_Len( cStartUpFolder ) - 1 )
Endif
MSGDEBUG("UNICODE",cStartUpFolder)
Else
If Right(cStartUpFolder,1) = "\"
cStartUpFolder := SubStr( cStartUpFolder, 1, Len( cStartUpFolder ) - 1 )
Endif
MSGDEBUG("ANSI",cStartUpFolder)
Endif
Return cStartUpFolder
Re: HMG 3.4.3
Posted: Tue Nov 29, 2016 5:05 pm
by srvet_claudio
Pablo César wrote:Thank you Mr. Hui.
My system is not in Chinese and I could not test in ANSI.
Dr. Claudio, do you think that is posible to officially replace actual GetStartUpFolder() by this MyGetStartUpFolder() for us ? (not with the same name, of course).
Code: Select all
Function MyGetStartUpFolder() // by Pablo on November, 2016 - To remove last unnecessary backslash
LOCAL cStartUpFolder := cFilePath(hb_ProgName())
If HMG_IsCurrentCodePageUnicode()
If hb_URight(cStartUpFolder,1) = "\"
cStartUpFolder := hb_URight( cStartUpFolder, HMG_Len( cStartUpFolder ) - 1 )
Endif
MSGDEBUG("UNICODE",cStartUpFolder)
Else
If Right(cStartUpFolder,1) = "\"
cStartUpFolder := SubStr( cStartUpFolder, 1, Len( cStartUpFolder ) - 1 )
Endif
MSGDEBUG("ANSI",cStartUpFolder)
Endif
Return cStartUpFolder
The code duplication is unnecessary, all HB_Uxxx functions work with ANSI and Unicode.
GetStartUpFolder()
Posted: Tue Nov 29, 2016 5:39 pm
by Pablo César
Hi Claudio,
I also would agree with you about hb_U... functions are compactibles for UNICODE and ANSI modes. But...
I have tested my friend. Tested with this chinese characters (not our language) I and can confirm to you there is something wrong with
hb_USubStr when is chinese characters in ANSI mode.
You can do by yourself this test of demo:
- test.rar
- Sources, Executable and chinese subfolder name
- (2.57 MiB) Downloaded 247 times
But please download this, unpack and run in the chinese subfolder with name "返回结果正确" (but HMG must be rebuilded in ANSI mode). Then you will see it's working removing last backslash. Because is using
SubStr intead of
hb_USubStr. You can change in the code and compile (the sub-folder will be also updated too automactically). Please Claudio, test it and prove it.
But the right code to replaces
GetStartUpFolder by this
MyGetStartUpFolder:
Code: Select all
Function MyGetStartUpFolder() // by Pablo on November, 2016 - To remove last unnecessary backslash
LOCAL cStartUpFolder := cFilePath(hb_ProgName())
If HMG_SupportUnicode()
If hb_URight(cStartUpFolder,1) = "\"
cStartUpFolder := hb_USubStr( cStartUpFolder, 1, HMG_Len( cStartUpFolder ) - 1 )
Endif
Else
If Right(cStartUpFolder,1) = "\"
cStartUpFolder := SubStr( cStartUpFolder, 1, Len( cStartUpFolder ) - 1 )
Endif
Endif
Return cStartUpFolder
Please understand replacement but with the same name of function:
GetStartUpFolder() with the contain above code listed.
Please also note, was wrongly using HMG_IsCurrentCodePageUnicode() instead of HMG_SupportUnicode(). I have replaced and this is the right one, same that Mr. Hui tested and corrected in my previous messages too.
Please confirm.
Re: HMG 3.4.3
Posted: Tue Nov 29, 2016 9:58 pm
by srvet_claudio
I will check