views:

346

answers:

7

I have a foxpro app, that contains hard coded path for icons and bitmaps. That's how foxpro does it and there is no way around it. And this works fine, except that when a removable drive has been used but is not connected, and when is connected windows assigns the same letter as hard coded path, when opening any form that contains such path, the following error message apears (FROM WINDOWS, not fox):

Windows-No disk Exception Processing Message c0000012 Parameters .....

Any help please Nelson Marmol

+2  A: 

Nelson:

"That's how foxpro does it and there is no way around it"?

I'm using FOX since FoxPro 2.5 to Visual FoxPro 9, and you are NEVER forced in any way to hard-code a path, you can use SET PATH TO (sYourPath), you can embed the icons and bitmaps in your EXE / APP file and therefore there's no need of including this resources externally.

You say that you have a "Foxpro App": which version? Old MS-DOS FoxPro o Visual FoxPro? If you're using VFP 8+, you can use SYS(2450, 1):

Specifies how an application searches for data and resources such as functions, procedures, executable files, and so on. 

You can use SYS(2450) to specify that Visual FoxPro searches within an application for a specific procedure or user-defined function (UDF) before it searches along the SET DEFAULT and SET PATH locations. Setting SYS(2450) can help improve performance for applications that run on a local or wide area network.


SYS(2450 [, 0 | 1 ])



Parameters
0 
Search along path and default locations before searching in the application. (Default)

1 
Search within the application for the specified procedure or UDF before searching the path and default locations.

One quick workaround could be assign another letter to your USB via the Disk Manager.

PabloG
A: 

I agree with @PabloG - it's been over a decade since I worked with FoxPro (Dos & Windows) but even back in FPW2.6 you could determine where your app was running 'from', set absolute or relative search paths and even bundle your resources straight into the "compiled" (heh) exe. All of our resources lived in a specific subfolder within the app folder, the database files in another subfolder also below the app folder. We used relative paths for everything as I recall.

Can you give us a bit more information about the problem?

If you think it would be helpful I could try and dig out some of our FPW2.6 code where we're doing this kind of thing. :-)

robsoft
A: 

It's VFP8 and sorry if I did not explained myself corectly. Also I think "there's no way around it" may sounded bad. What I meant is the property "ICON" in the forms. Since we have each component type separated in folders (forms,reports, menus, icons, etc), if you try to make the path relative, next time you edit the file, foxpro will include the fullpath. This problem started recently and we found that our clients started using external usb drives as means for backups.

Nelson: did you try _COMMAND = SYS(2450, 1) in CONFIG.FPW ?
PabloG
A: 

It sounds to me like you are distributing the forms/reports/labels etc to the clients. If you build an EXE, then you shouldn't get the "path" problem as VFP will embed the resource (in this case icon) into the exe and will know how to extract it at runtime.

Peterson

A: 

No, we are no distributing forms or anything with the app... it's an exe. I forgot to mention that the EXE is compressed and obfuscated with KONXIZE 1.0.

nmarmol
A: 

Assuming your application can determine the path to the icon file at runtime, then in the load event of the form, you can set the icon with:

THIS.Icon=<path to file>
A: 

If anybody else runs across this, you can generally type something like this for the Icon property in the Properties window to force it to be evaluated, which will probably prevent the path auto-filling:

="icon.ico"

instead of just icon.ico.

nstenz