#compile exe
#dim all
#if %def(%pb_cc32) 'ignore if compiled in PBWin 10
#console off 'no unneeded console if compiled in PBCC 6
#endif
'
declare function GetDiskFreeSpaceW lib "Kernel32.dll" alias "GetDiskFreeSpaceW" _
(RootPathName as wstringz, _
SectorsPerCluster as dword, _
BytesPerSector as dword, _
NumberOfFreeClusters as dword, _
TotalNumberOfClusters as dword) as long
'
function main (byval hInstance as dword, _
byval hPrevInst as dword, _
byval lpszCmdLine as wstringz ptr, _
byval nCmdShow as long ) as long
local hTWin, SampleNum, FreeClusters as dword
local ActionKey as wstring
'
txt.window(""$$,160, 120, 23, 35) to hTWin
'
txt.color = &h00D000
txt.print "Complete run will take 20 minutes."$$
txt.print "Disk free space rechecked"$$
txt.print "every 1 minute."$$
txt.color = %rgb_red
txt.print
txt.print "Press ESC to exit early (now, or"$$
txt.print "to exit loop after completion"$$
txt.print "of a minute pause)."$$
txt.color = &h00D000
txt.print
txt.print "Press any key to start:"$$
txt.color = %rgb_black
txt.waitkey$ to ActionKey
if ActionKey = $$esc then exit function
txt.cls
for SampleNum = 1 to 20
txt.cell = SampleNum, 1
GetDiskFreeSpaceW("", 0, 0, FreeClusters, 0)
txt.print FreeClusters
txt.color = &h00D000
txt.cell = SampleNum + 1, 1
if SampleNum < 20 then
txt.print "60 seconds till next sample."$$
txt.color = %rgb_black
sleep 60000
txt.cell = SampleNum + 1, 1
txt.print string$$(30, $$spc)
txt.inkey$ to ActionKey
if ActionKey = $$esc then exit for
end if
next
txt.print
txt.color = %rgb_red
txt.print "Press any key to close."$$
txt.waitkey$
end function
Created on August 03, 2025
Done with this window?