Re: exe won't run

Tech-Archive recommends: Speed Up your PC by fixing your registry



Gene,
The aggregation of the data into local systems has me confused. Can
you explain that a bit more? If the program is networked to several
workstations and more than one workstation is accessing the data how
do you control overwrites?
TonySper

"TonySper" <tsperduti@xxxxxxxxxxxxx> wrote in message
news:_5Hbg.54125$iB2.5294@xxxxxxxxxxxxxxxxxxxxxxxxx
Gene,
Thank you for all the info and code. I just printed it out and will
play with it to see what I have to do with my program. I more than
likely will have to change my code as to where the databases are
located as of now they are all located at the server along with the
exe file. Interesting code. Yes I forgot that you cannot overwrite the
exe file once it is started. Dumb of me. Your idea has lots of merit
and changes some of my thoughts.
Thanks again.
TonySper

"Gene Wirchenko" <genew@xxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5g4s62dc5kedukea942qp2d87qq63qo6dd@xxxxxxxxxx
On Fri, 19 May 2006 13:58:29 -0400, "TonySper"
<tsperduti@xxxxxxxxxxxxx> wrote:

Gene,
The automatic update sounds great. I have not been able to accomplish
that as yet. Can you give me a clue or help on how you did that??
I would guess you keep the databases on the server and then load the
exe file on the server. In the beginning you would load the exe file

Actually, the data is split up into local systems and aggregated
(though this has nothing to do with the automatic update).

on all the workstations. Do you write a proc in the exe file that

No. I create the local directory, a shortcut (with the current
directory set to the local directory), and copy the config file and
the loader program to the local directory. The first run will cause
the executable to be copied.

compares the server exe file and if different uploads the version
from
the server to the workstation?? I like the idea.

No, because you can not do that. The file of a program being
executed is locked. I run a loader which checks, updates as
necessary, then runs (with /n) the main program, and terminates.

My code does not allow for the updating of the loader program
itself, but as that is not too likely for me, I have not bothered to
add that. It would be the same principle though. My code is
configurable, so you ought to be able to make it suit your needs
fairly easily. Replace the #include line with
#define CHRCR chr(13)
That is the only part of the include file that this program uses.

***** Start of Code *****
* cbs2load
* Loader Program for CBS2
* Last Modification: 2005-07-21

* This program checks that the local copy of CBS2 is the latest
version
* as compared to a repository copy. If the local copy is not current,
it is
* replaced with a copy of the repository version. Either way,
assuming no
* errors, CBS2 is then started. The version checking is by file
datestamp.
*
* This program should be compiled to an executable. Use:
* build project cbs2load from cbs2load
* build exe cbs2load from cbs2load recompile
* Copy the executable to s:\cbs2\env.

#include "cbs2.h"

* Settings (assumes starting from default values)
set talk off
set exact on

* Do this in case a configuration file with screen=off has not been
set up
* yet. If there is no configuration file, there will be a flash of
the VFP
* main screen.
*
* Position to just off screen at the bottom, righthand corner.
_screen.top=sysmetric(2)
_screen.left=sysmetric(1)
_screen.visible=.f.

* Configuration Data
local progtitle, localprog, reposprog
progtitle="CBS2"
localprog="cbs2.exe" && local filename
reposprog="s:\cbs2\app\cbs2.exe" && repository filename

* Status Message and Flags
local statusmsg, haserror, haswarning
statusmsg=""
haserror=.f.
haswarning=.f.

* Whether to copy from the repository
local copyrepos
copyrepos=.f.

* Directory Data
local reposcnt, reposdata(1)
local localcnt, localdata(1)

* In each directory, there should be only one copy of the program.
If
* there is more than one, then the directory is corrupt, since the
name
* does not contain wildcard characters.
reposcnt=adir(reposdata,reposprog)
if reposcnt>1
haserror=.t.
if statusmsg>""
statusmsg=statusmsg+CHRCR
endif
statusmsg=statusmsg+"Repository directory is corrupt."
endif
localcnt=adir(localdata,localprog)
if localcnt>1
haserror=.t.
if statusmsg>""
statusmsg=statusmsg+CHRCR
endif
statusmsg=statusmsg+"Local directory is corrupt."
endif

* If there is no repository copy, this is an error.
if reposcnt=0
haserror=.t.
if statusmsg>""
statusmsg=statusmsg+CHRCR
endif
statusmsg=statusmsg+;
"Repository version of "+progtitle+" does not exist."
endif

* If there is no local copy, this could just be a new Station.
if localcnt=0
haswarning=.t.
copyrepos=.t.
if statusmsg>""
statusmsg=statusmsg+CHRCR
endif
statusmsg=statusmsg+;
"Warning: Local version of "+progtitle+" does not exist."
endif

* One of each: how do the dates compare?
if reposcnt=1 and localcnt=1
do case
case reposdata(1,3)>localdata(1,3)
copyrepos=.t.
case reposdata(1,3)=localdata(1,3) and
reposdata(1,4)>localdata(1,4)
copyrepos=.t.
otherwise
copyrepos=.f.
endcase
endif

* Error exit
if haserror
statusmsg=statusmsg+CHRCR+CHRCR+;
progtitle+;
" can not be started. Please save this message for Technical
Support."
wait statusmsg window nowait noclear
wait && Save message until keystroke or mouse click.
return
endif

* Set copy message.
if copyrepos
if statusmsg>""
statusmsg=statusmsg+CHRCR+CHRCR
endif
if localcnt>0
statusmsg=statusmsg+;
"An updated version of "+progtitle+;
" is being installed. It will then be started."
else
statusmsg=statusmsg+;
progtitle+" is being installed. It will then be started."
endif
endif

* Display non-error status message (if any).
if statusmsg>""
wait statusmsg window nowait noclear
endif

* Copy from repository.
if copyrepos
set safety off
copy file (reposprog) to (localprog)
endif

* Run whichever version. Do not wait for it to return.
run /n &localprog

return
***** End of Code *****

Sincerely,

Gene Wirchenko



.



Relevant Pages

  • Re: exe wont run
    ... My code does not allow for the updating of the loader program ... replaced with a copy of the repository version. ... Do this in case a configuration file with screen=off has not been ...
    (microsoft.public.fox.programmer.exchange)
  • Re: exe wont run
    ... My code does not allow for the updating of the loader program ... replaced with a copy of the repository version. ... Do this in case a configuration file with screen=off has not been ...
    (microsoft.public.fox.programmer.exchange)
  • Re: exe wont run
    ... My code does not allow for the updating of the loader program ... replaced with a copy of the repository version. ... Do this in case a configuration file with screen=off has not been ...
    (microsoft.public.fox.programmer.exchange)
  • Re: [RFC] ACPI power-off on P4 HT
    ... as I miss being able to let my workstation shutdown on it's own. ... +#ifdef CONFIG_SMP ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Any Python Hackers Wanna Beta Test????
    ... >>external configuration file for use by my applications. ... > Python module you also get built-in support for conditionals, ...
    (comp.lang.python)