> next question, this code gpfs:
Worked with 32 bit, but GPFed with 64 bit. 32 bit and 64 bit use different assemblers. Thanks for reporting it.
I have changed the code to:
PRIVATE FUNCTION AfxStrRSet (BYREF wszMainStr AS CONST WSTRING, BYVAL nStringLength AS LONG, BYREF wszPadCharacter AS WSTRING = " ") AS CWSTR
DiM cwsPadChar AS CWSTR = wszPadCharacter
IF cwsPadChar = "" THEN cwsPadChar = " "
cwsPadChar = LEFT(cwsPadChar, 1)
DIM cws AS CWSTR = SPACE(nStringLength)
FOR i AS LONG = 1 TO LEN(cws)
MID(**cws, i, 1) = cwsPadChar
NEXT
MID(**cws, nStringLength - LEN(wszMainStr) + 1, LEN(wszMainStr)) = wszMainStr
RETURN cws
END FUNCTION
I have also changed the code for AfxStrLSet and AfxStrCSet:
' ========================================================================================
' Returns a string containing a left-justified (padded) string.
' If the optional parameter wszPadCharacter not specified, the function pads the string with
' space characters to the left. Otherwise, the function pads the string with the first
' character of wszPadCharacter
' Example: DIM cws AS CWSTR = AfxStrLSet("FreeBasic", 20, "*")
' ========================================================================================
PRIVATE FUNCTION AfxStrLSet (BYREF wszMainStr AS CONST WSTRING, BYVAL nStringLength AS LONG, BYREF wszPadCharacter AS WSTRING = " ") AS CWSTR
DiM cwsPadChar AS CWSTR = wszPadCharacter
IF cwsPadChar = "" THEN cwsPadChar = " "
cwsPadChar = LEFT(cwsPadChar, 1)
DIM cws AS CWSTR = SPACE(nStringLength)
FOR i AS LONG = 1 TO LEN(cws)
MID(**cws, i, 1) = cwsPadChar
NEXT
MID(**cws, 1, LEN(wszMainStr)) = wszMainStr
RETURN cws
END FUNCTION
' ========================================================================================
' ========================================================================================
' Returns a string containing a centered (padded) string.
' If the optional parameter wszPadCharacter not specified, the function pads the string with
' space characters to the left. Otherwise, the function pads the string with the first
' character of wszPadCharacter.
' Example: DIM cws AS CWSTR = AfxStrCSet("FreeBasic", 20, "*")
' ========================================================================================
PRIVATE FUNCTION AfxStrCSet (BYREF wszMainStr AS CONST WSTRING, BYVAL nStringLength AS LONG, BYREF wszPadCharacter AS WSTRING = " ") AS CWSTR
DiM cwsPadChar AS CWSTR = wszPadCharacter
IF cwsPadChar = "" THEN cwsPadChar = " "
cwsPadChar = LEFT(cwsPadChar, 1)
DIM cws AS CWSTR = SPACE(nStringLength)
FOR i AS LONG = 1 TO LEN(cws)
MID(**cws, i, 1) = cwsPadChar
NEXT
MID(**cws, (nStringLength - LEN(wszMainStr)) \ 2 + 1, LEN(wszMainStr)) = wszMainStr
RETURN cws
END FUNCTION
' ========================================================================================