Now I'm lost with pointers to a string. 
PB helpfile contains following code snippet as an example
When I started to get some problems in a similar situation, I copied the sample above to my program and I think it worked for a while - can't be sure anymore. Now it only GPF's for me, no matter what I do (restart Windows, reboot the machine, use fixed lenght or null terminated strings etc.)
Does anybody know what is wrong now?
I have attached a small compilable sample which on my system GPF's.
I have thought that following is true
but seems that I'm wrong
because if I look the execution of Sub above, it increments S in steps of 4 (causing the code to point to some place illegal?).
TIA
Lasse Rantanen
[email protected]

PB helpfile contains following code snippet as an example
Code:
SUB Lower(zStr AS STRING) DIM s AS STRING PTR, i AS INTEGER s = VARPTR(zStr) FOR i = 1 TO LEN(zStr) IF @s = "A" THEN @s = "a" INCR s NEXT END SUB
Does anybody know what is wrong now?
I have attached a small compilable sample which on my system GPF's.
I have thought that following is true
Code:
VARPTR(s) s=s+15 @s=P | | v v s = "ABCDEFGHIJKLMNOP" 0123456789012345 111111

TIA
Lasse Rantanen
[email protected]
Code:
$COMPILE EXE #INCLUDE "WIN32API.INC" %LOWER = 1000 %CANCEL = 1001 %LABEL1 = 1002 DECLARE CALLBACK FUNCTION TestDlgProc DECLARE SUB Lower(zStr AS STRING) GLOBAL hDlg AS LONG '============================================================================== FUNCTION WINMAIN (BYVAL CurInst AS LONG, _ BYVAL PrvInst AS LONG, _ CmdLine AS ASCIIZ PTR, _ BYVAL CmdShow AS LONG) EXPORT AS LONG DIALOG NEW 0, "String Test", , , 140, 80, %WS_CAPTION , TO hDlg CONTROL ADD LABEL, hDlg, %LABEL1, "AbbAaBBa", 5, 10, 130, 28 CONTROL ADD BUTTON, hDlg, %LOWER, "Lower", 5, 60, 60, 14 CONTROL ADD BUTTON, hDlg, %CANCEL, "Cancel", 75, 60, 60, 14 DIALOG SHOW MODAL hDlg, CALL TestDlgProc END FUNCTION '============================================================================== CALLBACK FUNCTION TestDlgProc LOCAL sMyStr AS STRING SELECT CASE CBMSG CASE %WM_COMMAND SELECT CASE CBWPARAM CASE %CANCEL DIALOG END CBHNDL CASE %LOWER CONTROL GET TEXT hDlg, %LABEL1 TO sMyStr Lower sMyStr CONTROL SET TEXT hDlg, %LABEL1, sMyStr END SELECT END SELECT END FUNCTION '============================================================================== SUB Lower(zStr AS STRING) DIM s AS STRING PTR DIM i AS INTEGER s = VARPTR(zStr) FOR i = 1 TO LEN(zStr) IF @s = "A" THEN @s = "a" INCR s NEXT END SUB
Comment