Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling Procedure In VFP exe?
Message
De
02/05/2013 10:29:10
Mike Sue-Ping
Cambridge, Ontario, Canada
 
 
À
02/05/2013 10:13:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Divers
Thread ID:
01572452
Message ID:
01572459
Vues:
58
Jos,

I'm confused (nothing new there). Could you please reword your suggestion for me? When you say "new PRG in the exe..." I'm not sure which exe you are referring to.

I have an existing exe, say exe1, that issues a bunch of SET PROCEDURE TO... commands in the startup code. I have a new exe, say exe2, where I was hoping to issue a "DO someproc IN exe1". That fails to work unless "someproc" is defined in the main startup program of exe1.

My current solution is to issue SET PROCEDURE TO... in exe2 (just like in exe1) and "DO someproc". This approach has nothing to do with exe1 anymore (and defeats my attempt to reuse code that exists already in exe1).

Hope that makes my situation a little clearer now.

Mike


>Mike,
>
>Try create a new PRG in the exe which issues the SET PROC and then calls the existing procedure in the procedure file. Would that work perhaps?
>
>
>>Thanks for the feedback Mike. Yeah, I see your entries all over the FoxWiki about the Pros/Cons of SET PROCEDURE... :)
>>
>>I don't have the liberty of moving the procedures to a separate prgs. I'm just going to have to issue a set proc to... in the new exe as well.
>>
>>Mike
>>
>>
>>>Hi Mike
>>>
>>>I've spent years trying to convince people to not use procedure files. They are usually an arbitrary collection of barely related things. I believe the set procedure command was originally a work around to allow longer procedure names than 8 char file names.
>>>
>>>In your case, having a routine buried in a procedure file is preventing you from executing it the way you want. If you would extract that routine from the procedure file, add it to the project as a separate .prg file and rebuild your exe, you will still be able to execute it in the current exe and you will be able to execute it from an external exe via DO prgname IN exename.
>>>
>>>HTH
>>>
>>>>I'm trying to call a procedure in a separate executable. It only appears to work if the procedure is defined in the main program of the executable. For example:
>>>>
>>>>If testproc is defined in main.prg and I call it with DO testproc IN mytest.exe it works fine.
>>>>
>>>>If I define testproc in myprocs.prg and set procedure to myprocs.prg in the main program of the exe, when I try DO testproc IN mytest.exe I get a "Procedure 'testproc.prg' does not exist". Looks like the "set procedure to" command does not get called in this case.
>>>>
>>>>Does anyone have any suggestions for a workaround? I'm trying to create an optional "addon" to a product by creating a new exe that would try to reuse existing procedures in the "mytest.exe". mytest.exe has multiple set procedure to additive commands in it's startup. I figured that since they're already there, why bother including those procedures in the new exe. Apparently I can't unless I refactor mytest.exe.
>>>>
>>>>TIA
>>>>Mike
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform