' PBXA64 Release Template sample
' Theme: 07_winapi_gui
' Focus: window-state, event, and message-routing models
' This headless program derives a deterministic model checksum and prints it.
#COMPILE EXE
#DIM ALL

FUNCTION SampleMix(BYVAL value AS LONG, BYVAL salt AS LONG) AS LONG
    LOCAL shifted AS LONG
    shifted = (value * 17 + salt * 31) MOD 1000003
    shifted = shifted XOR (salt * 13)
    FUNCTION = shifted
END FUNCTION

FUNCTION SampleSeries(BYVAL startValue AS LONG, BYVAL count AS LONG) AS LONG
    LOCAL i AS LONG, total AS LONG, current AS LONG
    current = startValue
    FOR i = 1 TO count
        current = SampleMix(current, i + 481)
        IF (i MOD 3) = 0 THEN total = total + current
        IF (i MOD 5) = 0 THEN total = total XOR current
    NEXT i
    FUNCTION = total + current
END FUNCTION

FUNCTION SampleInvariant(BYVAL checksum AS LONG) AS LONG
    LOCAL normalized AS LONG
    normalized = checksum MOD 97
    IF normalized < 0 THEN normalized = normalized + 97
    FUNCTION = normalized
END FUNCTION

FUNCTION PBMAIN() AS LONG
    LOCAL checksum AS LONG
    checksum = SampleSeries(481, 19)
    checksum = checksum + SampleInvariant(checksum)
    PRINT "07_winapi_gui sample 12 checksum="; checksum
    FUNCTION = 0
END FUNCTION
