Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot open form
Message
From
02/08/2001 13:54:41
 
 
To
02/08/2001 13:43:03
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00538916
Message ID:
00538984
Views:
28
gosh, I hope you did not come up w/this off the top of you head, in just a couple of minutes! (:0)
thanks Celtin, I'll give it a try now.
I guess I will have to pay more attention to this kind of things. Is the first time I have a corrupted form, and of course, it happens now that I need to set the app in the next 7 min.



>
>Edgar,
>I was just leaving. I don't have time for details, if it had some garbage you could try this on a copy :
>
fastrepair('blahblah.scx')
>function fastrepair
>Lparameters tcDBF
>Local handle, lnFileSize, lnReccount, lnHeaderSize, lnRecordSize, ;
>	lnCalculatedReccount, llHasMemo
>handle=fopen(tcDBF,12) && Opened readwrite
>lnFileSize = fseek(handle,0,2) && Get file size
>* Read header info
>With this
>	lnReccount   = ReadBytes(handle, 4,4)
>	lnHeaderSize = ReadBytes(handle, 8,2)
>	lnRecordSize = ReadBytes(handle,10,2)
>
>	lnCalculatedReccount = floor((lnFileSize-(lnHeaderSize+1))/lnRecordSize)
>	If lnCalculatedReccount # lnReccount && If calculated # recorded fix it
>		WriteBytes(handle, 4,4,lnCalculatedReccount)
>	Endif
>Endwith
>=fclose(handle)
>
>function readbytes
>Lparameters tnHandle, tnPos, tnSize, tlLR
>Local lcString, lnRetValue,ix
>=fseek(tnHandle, tnPos,0) && Go to pos
>lcString = fread(tnHandle, tnSize) && Read tnSize bytes
>lnRetValue = 0
>For ix=0 to tnSize-1  && Convert to a number
>	lnRetValue = lnRetValue + asc(substr(lcString,ix+1)) * ;
>		iif(tlLR,256^(tnSize-1-ix),256^ix)
>Endfor
>Return int(lnRetValue)
>
>function WriteBytes
>Lparameters tnHandle, tnPos, tnSize, tnNumber, tlLR
>Local lcString, lnLowDword, lnHighDword,ix
>lcString=''
>If tlLR
>	For ix=tnSize-1 to 0 step -1
>		lcString=lcString+chr(tnNumber/256^ix%256)
>	Endfor
>Else
>	For ix=0 to tnSize-1
>		lcString=lcString+chr(tnNumber/256^ix%256)
>	Endfor
>Endif
>=fseek(tnHandle, tnPos,0) && Go to pos
>Return fwrite(tnHandle,lcString)
>
Cetin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform