PDA

View Full Version : Webupdate



NewsArchive
06-04-2005, 09:14 AM
Hi Friedrich,

I have sucessfully implemented the webupdate in a project.

When you run the wupdate.exe and it needs to update the EXE that
called it, i.e. if you have a menu item etc. that calls wupdate.exe to
check for updates, how can I, from my program, detect if there are
updates or not, so I can terminate my exe if it needs to be updated?
Currently I just terminate my exe when the user run wupdate.exe from
it, but it's a bit rough<g>

I was thinking that perhaps you could allow us to pass a hwnd
parameter as a command line parameter to wupdate and you could send a
message if there is an update and if there is no update available to
that handle. That way we could subclass the window and check for that
message coming in.

I.e.

Run ('wupdate.exe /hwnd=' & 0{Prop:Handle})

And then you could do:

If Not NeedsUpdate
If CmdLineHandle
PostMessage(ProgHandle,NoNeedForUpdateMessageID,0, 0)
End
Else
If CmdLineHandle
PostMessage(ProgHandle,NeedsUpdateMessageID,0,0)
End
End

Something like that.

What do you think?

Best regards,


Arnór Baldvinsson
Icetips Software
San Antonio, Texas, USA
www.icetips.com

NewsArchive
06-04-2005, 09:14 AM
Arnor,
I've done something like this using the mailslots stuff in Bill Roe's
Valutilities.

Jane

NewsArchive
06-04-2005, 09:14 AM
>I was thinking that perhaps you could allow us to pass a hwnd
>parameter as a command line parameter to wupdate and you could send a
>message if there is an update and if there is no update available to
>that handle. That way we could subclass the window and check for that
>message coming in.

Arnor,

A couple of things come to mind off the top of my head. I haven't used
wupdate, but I'm assuming it, or part of it, is a script you can modify.

SB's Get Sytem Information supports getting the command line. I assume you'd
have to parse it, but that would be simple.

Have a look at "Command Line Options" SB's help.

/V VARIABLE VALUE
Set %VARIABLE% to VALUE

That should do nicely.

You could also do it the hard(er) way with:

RegisterWindowMessage()
EnumWindows()
PostMessage()

--
Best regards,

Mark

-------------------------------------------------------------------
Why waste time learning when ignorance is instantaneous?
We do email right!
Rock solid hosting services at http://www.lanbytes.net

NewsArchive
06-04-2005, 09:14 AM
Hi Mark,

>A couple of things come to mind off the top of my head. I haven't used
>wupdate, but I'm assuming it, or part of it, is a script you can modify.

It is. On inspection of the options, I see that there is a script
item called "Terminate Active Application" That sounds very promising
for what I had in mind, i.e. to terminate the calling program if
updates need to be installed. And there is also an option to "Detect
Active Application" So that you could detect if it's running and then
throw up some messages about it being in use. Maybe put a loop in so
that it can detect if the program is terminated and if not, it could
terminate by force if needed.

So it seems that Friedrich is way ahead of me on this one;)

Best regards,

Arnór Baldvinsson
Icetips Software
San Antonio, Texas, USA
www.icetips.com

NewsArchive
06-04-2005, 09:15 AM
>Hi Mark,
>
>>A couple of things come to mind off the top of my head. I haven't used
>>wupdate, but I'm assuming it, or part of it, is a script you can modify.
>
>It is. On inspection of the options, I see that there is a script
>item called "Terminate Active Application" That sounds very promising
>for what I had in mind, i.e. to terminate the calling program if
>updates need to be installed. And there is also an option to "Detect
>Active Application" So that you could detect if it's running and then
>throw up some messages about it being in use. Maybe put a loop in so
>that it can detect if the program is terminated and if not, it could
>terminate by force if needed.

I use Detect Active Application in a loop exactly as you describe. I won't
forcibly kill the application, though. I loop three times and if it's still
active I terminate the install.

--
Best regards,

Mark

-------------------------------------------------------------------
Why waste time learning when ignorance is instantaneous?
We do email right!
Rock solid hosting services at http://www.lanbytes.net

NewsArchive
06-04-2005, 09:15 AM
Hi Mark,

>I use Detect Active Application in a loop exactly as you describe. I won't
>forcibly kill the application, though. I loop three times and if it's still
>active I terminate the install.

Take a peek at my loop posted in another message. I think this should
do it. I also decided against forcing the termination, but I'm not
terminating the install. If there is an update (in this project) it
is a critical one that must be installed.

Best regards,

Arnór Baldvinsson
Icetips Software
San Antonio, Texas, USA
www.icetips.com

NewsArchive
06-04-2005, 09:16 AM
Hi Friedrich,

>I was thinking that perhaps you could allow us to pass a hwnd
>parameter as a command line parameter to wupdate and you could send a

Ok, here is something I've cooked up but not tested yet.

I plan on use the "/V var value" command line option to pass the name
of the executable to wupdate.exe. Then I have cooked up this script
to add to wupdate.sb5 at around line 100:

If %RUNNINGEXE% Not Equals "" Then
Loop
Set Variable %ISEXERUNNING% to Detect Active Application(%RUNNINGEXE%)
If %ISEXERUNNING% Equals "1" Then
Message Box "Please close the %RUNNINGEXE% program." -- "A Program is running"
Cycle Loop
Else
Break Loop
End
End
End
Hide Wizard Dialog "#2"

So when I call this it would be something like:

Run('wupdate.exe /V RUNNINGEXE OFFICE.EXE')

or something like that. Does this make sense?

Best regards,

Arnór Baldvinsson
Icetips Software
San Antonio, Texas, USA
www.icetips.com

NewsArchive
06-08-2005, 03:20 AM
Hi Arnór,

I'll check this in detail this evening (I am brain dead today).

Friedrich

NewsArchive
06-08-2005, 03:20 AM
Arnór,

The code makes perfect sense!

Friedrich

--
Friedrich Linder
CEO, Lindersoft
www.lindersoft.com
1.954.252.3910

"point. click. ship" - that's SetupBuilder 5

NewsArchive
06-08-2005, 03:21 AM
Hi Arnor

I set up a simple bit of code that ftp's the ini file from the webserver and
then compares the version number in the ini file with the current version in
the registry. It then tells the user that there is an update available and
then chains wupdate.exe rather than run. This code is launched on a new
thread when the app opens so there is no delays and it simply returns is the
version numbers are the same.

Happy to share the code if you want it. Uses Nettalk.

Cheers
Simon Burrows
Visit the new Data Ferret Website
http://www.dataferret.net

NewsArchive
06-08-2005, 03:21 AM
Hi Simon,

>then chains wupdate.exe rather than run. This code is launched on a new
>thread when the app opens so there is no delays and it simply returns is the
>version numbers are the same.

Thanks for sharing that idea. As I already have a module that is run
from the main exe when the program starts up to check for database
updates etc. I could add a ftp check there to download the ini file
and compare.

My idea here is just to make it possible stright out of wupdate to
handle as much of this as possible and I think the code I posted
should work. I'm not going to be able to test it until next week
though...

Best regards,

Arnór Baldvinsson
Icetips Software
San Antonio, Texas, USA
www.icetips.com

NewsArchive
06-08-2005, 03:21 AM
Hi Arnor

The other reason for doing this is that users tend to only go and check for
an update when they have been sent an email etc or if they remember (i.e.
very rarely). This way, as soon as you issue a new version, users are told
that it is available next time they run the applications, so you are less
likely to have out of date customers.

Cheers
Simon Burrows
Visit the new Data Ferret Website
http://www.dataferret.net

NewsArchive
06-08-2005, 03:22 AM
Hi Simon,

>The other reason for doing this is that users tend to only go and check for
>an update when they have been sent an email etc or if they remember (i.e.
>very rarely). This way, as soon as you issue a new version, users are told
>that it is available next time they run the applications, so you are less
>likely to have out of date customers.

Yep;) However, in this particular project I actually have a way of
forcing an update remotely. This software uses SQL databases with
replication. If a SQL script is sent to the remote dbs, a special
module that runs before the actual program, checks if there are
scripts and if there are it runs it against the db and then it forces
a check for updates to the program as these would go together in most
cases so I just force it every time.

Best regards,

Arnór Baldvinsson
Icetips Software
San Antonio, Texas, USA
www.icetips.com