Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 7 bug on SET RESOURCE command
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00657030
Message ID:
00657632
Views:
26
Andrus,

See comments below.

>thank you for reply.
>
>>Now whether or not it's a bug is another question completely. It could be that the OS is not releasing the file handle properly when the SET RESOUCE TO command is issue. Last night I was able to demonstrate that under Win98SE. Also, if the application resides on a Novell network, that OS is notorious for being slow in this process.
>
>Jim Saunders from Microsoft VFP support replies to this report today as follows:
>
>"Apparently, the file gets partially opened in the system datasession
>when doing the SET RESOURCE, and does not get closed until you exit and
>restart VFP. "
>
>So it seems to be an VFP issue if it tries to use a corrupted resource file?
>
>>My question would be, "Is there any reason why the resource file is included with the executable?"
>>
>>To me, this is sort of like asking for a problem. I know that there are instances where people supply resource files in order to control things like the Print Preview toolbar. Including it with the setup, but excluding it from the exe would solve the problem.
>>
>>I would think, however, because you've included it in the exe, that you have a need to do so. In that light, I'd make the following suggestion.
>>
>>1. Include the resource file in the executable and either change its name or the name in the config.fpw file.
>>
>>2. On startup, SET RESOURCE OFF, open the dbf indicated in the config.fpw file and append into it from the included dbf, then reset with SET RESOURCE TO < filename > You could then delete it on shutdown, if necessary.
>
>I need need to remember the settings of memo, modify file, modify command and modify report windows. User can change them (position, size, font, wrapping, etc.) at run time.
>The only way to to this is use the resource file not included in exe file.
>
>Using your suggestion, all settings are reset at application startup.
>This is not acceptable.

What about
USE (SET('RESOURCE', 1)) AGAIN IN 0 ALIAS temp
IF RECCOUNT() = 0
  APPEND FROM ImbeddedResource
ENDIF
USE
I haven't tested to see if this will work. You may have SET RESOURCE OFF to do the append. Don't forget that in 7.0, you don't have turn the setting to OFF to do the above.

>The only way seems to dedect a corrupted resource file before using SET RESOURCE and fix it or reset to default it only in case of corruption:
>
>
>select 0
>on error lError=.t.
>use myresource excl
>pack  && this line is required to dedect fpt corruption caused by VFP crash
>use
>on error
>if m.lError
>  create table myresource ( type c(12), id c(12), name M, readonly L, ;
>          ckval n(6), data M, updated D )
>  use
>  endif
>set resource to myresource
>
>
>I don't like to add this code to my application startup since
>PACK command slows down startup a lot!
>
>Is there a simpler solution ?
>
>I expected that VFP will create a new empty resource file in this
>case as it prompts.
>However, VFP does not recover from this error.

I think that my suggestion above might turn the trick for you. However, if you're getting a number of C5s, the probabality of corruption of the resource file is increased. I haven't, however, had any problems with such corruption on a local drive with a C5.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform