topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 8:25 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: DcuHelper.exe v1.10 (7/12/11) - Update checking for your apps (dcupdater compat)  (Read 120312 times)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
I wanted to describe one thing i will be adding very soon to the dcuhelper.exe utility.

Right now, when your program launches it to check for updates, it finds the dcupdater tool installed on the user's computer and invokes it.

If the main dcupdater tool is not installed, then dcuhelper will tell the user about it, and open the dcupdater web page for them so they can install it if they want.

I'm going to change this slightly so that if the dcupdater tool is not found, it will display a message explaining this to the user and offer them 3 choices:
1. Open the dcupdater web page to learn more about the updater and download it.
2. Open the program's own web page (the program they asked to check for updates for) so they can manually look for an update.
3. Cancel and do nothing.

In this way, even users who do not want to use the updater can be redirected to the program website to check for updates manually.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
I've uploaded a new version of dcuhelper.exe:

from readme:
//---------------------------------------------------------------------------
This tiny helper utility will let your program check for updates by invoking the
 isntalled DcUpdater tool on their computer, or explaining to them how to get it
 and directing them to the DcUpdater web page (and your program's web page)
 if it's not installed.

For help, more examples, sample scripts, see this thread on our forum:
 https://www.donation...dex.php?topic=9607.0

Main DcUpdater web page:
 https://www.donation...r/Updater/index.html
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------
Version info:
   v1.01.01 - August 16, 2007 - first public release
   v1.02.01 - September 8, 2007 - added dll exports, improved help,
      opens program webpage if updater not installed.
      added version info to usage display (invoke with no arguments).
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------
1. To register your program's directory with the system updater:
   dcuhelper.exe -r "program_labelname" "full_path_to_app_directory"

2. To invoke the updaterwith various commandline options:
   dcuhelper.exe -[r]i "program_labelname" "full_path_to_app_directory" "missingupdatertitle_or_._for_silent" [commandline options to be passed to updater]
   e.g. if they explicitly ask to check for updates, do so and report results no matter what:
    dcuhelper.exe -ri "ProcessTamer" "C:\Program Files\ProcessTamer" "Error"
   e.g. or if you want to check for updates at startup silently (dont report if no update found):
    dcuhelper.exe -ri "ProcessTamer" "C:\Program Files\ProcessTamer" "."

3. To UNregister your program's directory with the system updater (not really necessary):
   dcuhelper.exe -u "program_labelname"

Note: program_labelname is just a unique arbitrary label that is used to create the redirect files (see below).
//---------------------------------------------------------------------------



//---------------------------------------------------------------------------
How does dcuhelper.exe register your program with the updater?
It creates a file:
   %COMMONAPPDATA%\\DonationCoder\\DcUpdater\\RedirectFiles\program_labelname.dcupdateredirect
Which points to your program's directory.
//---------------------------------------------------------------------------



//---------------------------------------------------------------------------
You can also load the dcuhelper.exe from within your program as if it were
 a dll, and invoke it that way (and check for updater path/existence):

extern "C" __declspec( dllexport ) int DLLMainCall(int argc, char** argv);  // returns 0 on success
extern "C" __declspec( dllexport ) char* DLLGetDcUpdaterPath(char *appdir); // blank on not installed
//---------------------------------------------------------------------------

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
If the main dcupdater tool is not installed, then dcuhelper will tell the user about it, and open the dcupdater web page for them so they can install it if they want.

mouser, what if the dcupdater tool is installed in a custom folder? i get the message box saying it's not installed..

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
mouser, what if the dcupdater tool is installed in a custom folder? i get the message box saying it's not installed..
i'll be fixing this soon.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
thanks mouser.. :Thmbsup:

seedling

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 129
    • View Profile
    • Donate to Member
here's some code to drop into your project to call the dcupdater
(this is borland builder code. adjust for your compiler)

// store application path
AnsiString AppPath = ExtractFilePath(Application->ExeName);

           // fix working path to AppPath
SetCurrentDir(AppPath);

// dcupdate filename without extension
AnsiString AppName = "<yourappname>";

// append path with dcuhelper file
AnsiString dcufullpath = (AppPath + "\\dcuhelper.exe");

// create command line arg string
AnsiString comlineargs = ("-ri " + AppName + " \"" + AppPath + "\" \"warning\" -show");

// run dcupdater tool
ShellExecute(NULL,"open",dcufullpath.c_str(),comlineargs.c_str(),NULL,SW_HIDE);

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Thanks for posting that seedling  :up:

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,777
    • View Profile
    • Read more about this member.
    • Donate to Member
I've got some weird behavior with dcuhelper that we talked about in IRC. But I thought I'd post about it here in case you needed more information on what was happening.

I've been getting dcuhelper to work with my Universe project. Following along with the methods mentioned in this thread, I've placed dcuhelper in it's own directory inside the application directory, and I call dcuhelper.exe with a batch file in the Universe directory. Directory structure is like so:

Universe\dcuhelper\dcuhelper.exe
Universe\universe.dcupdate
Universe\update.bat

The batch file contains the following:

dcuhelper\dcuhelper.exe -ri "Universe" "%CD%" "Attention"

Running this batch file on a PC that doesn't have DcUpdater installed brings up a dialog box that says something to the effect that "DcUpdater isn't installed but is required to check for updates. The Universe website and the DcUpdater website will now be opened in your browser."

Then it opens up the Universe website (as defined in the .dcupdate file) and an error 404 for the DcUpdater. The URL it opens to is https://www.donationcoder.com/Software/Mouser/Updater&app=Universe. I'm not sure why it includes the information about the application, but all it needs to do is change the & to an ? and it works properly, redirecting to https://www.donationcoder.com/Software/Mouser/Updater/?app=Universe

The interesting thing about this is that if I supply the wrong path or no path to the .dcupdate file, it only opens the site to download the DcUpdater, with the following (working) URL: https://www.donationcoder.com/Software/Mouser/Updater. It doesn't open the Universe site because it obviously can't find the site if it doesn't have a .dcupdate file to read.
« Last Edit: July 31, 2008, 03:43 AM by Deozaan »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
i will fix this in next day or two and then try to implement your other ideas through august.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
dcuhelper.zip has now been updated, download from here: https://www.donation...tware/Mouser/Updater

  v1.03.01 - August 1, 2008 - added -t commandline option
              fixed bug in opening dcupdater page
              improved dialog on updater not installed
              if no commandline options are passed it will try to load .dcupdate file in current dir and check for updates

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,777
    • View Profile
    • Read more about this member.
    • Donate to Member
Very nice! It's much improved and works like a charm!

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Here's an excerpt of AHK code from my post-compile script that I use to automatically generate the necessary trout.dcupdate and versioninfo.xml files for my Trout audio player.  You will need Skan's FileGetVersionInfo() function.  Obviously, change paths and other specific information to suit your app and environment.

; Get verion and define paths.
AppName           := "Trout"
Version_String    := FileGetVersionInfo( A_ScriptDir . "\" . AppName . ".exe", "FileVersion" )
Version_Info_Dir  := A_ScriptDir . "\setup"
DcUpdate_Info_Dir := A_ScriptDir . "\setup\trout"

; Generate other needed bits.
myTime := A_Now
FormatTime, Version_Month, %myTime%, M
FormatTime, Version_Day  , %myTime%, d
FormatTime, Version_Year , %myTime%, yyyy

; Generate versioninfo.xml file contents.
Version_Info =
(
<?xml version="1.0"?>
<root>
<Program_Version>%Version_String%</Program_Version>
<Program_Release_Month>%Version_Month%</Program_Release_Month>
<Program_Release_Day>%Version_Day%</Program_Release_Day>
<Program_Release_Year>%Version_Year%</Program_Release_Year>
</root>
)

; Delete and recreate Version_Info file.
FileDelete, %Version_Info_Dir%\versioninfo.xml
FileAppend, %Version_Info%, %Version_Info_Dir%\versioninfo.xml

; Generate .dcupdate file contents.
DcUpdate_Info =
(
<?xml version="1.0" ?>

<Local>

<!-- basic info to display in updater-->
<Label>%AppName%</Label>
<IconFile>%AppName%.exe</IconFile>


<!-- version info of locally installed current version, and simple remote version file -->
<Version>%Version_String%</Version>
<VersionFileRemote>http://skwire.dcmembers.com/apps/trout/versioninfo.xml</VersionFileRemote>


<!-- where to get more info about the app remotely, only queried once an update is discovered -->
<InfoFileRemote></InfoFileRemote>
<WebPage>https://www.donationcoder.com/forum/index.php?topic=16157.0</WebPage>

<!-- ok how to conduct updates; could be: "Run" (download and run program), or "Visit" (visit website), or "Unzip" (download zip and unpack over files) -->
<UpdateMethod>run</UpdateMethod>
<CloseForUpdate>trout.exe</CloseForUpdate>
<UpdateFile>http://skwire.dcmembers.com/apps/trout/trout_setup.exe</UpdateFile>

</Local>
)

; Delete and recreate DcUpdate file.
FileDelete, %DcUpdate_Info_Dir%\%AppName%.dcupdate
FileAppend, %DcUpdate_Info%, %DcUpdate_Info_Dir%\%AppName%.dcupdate

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
Oh nice one bookmarked.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
I had a thought.. without adding much size to dcuhelper.exe i could add a minimialist built in update check into dcuhelper.exe.

In other words, right now what dcuhelper does is if the dcupdater big utility is not installed, it opens the program web page so user can check version themself.

But it wouldnt be hard or add much size to add a really quick and dirty version check into dcuhelper.exe itself, so that it could inform the user when there is a new version and then open the program website, or do nothing if a new version is not ready.

The advantage of this is that it would be more useful to people who don't want to install the larger dcupdater tool and make it viable to use dcuhelper.exe itself as a very lightweight update checker.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
I like this idea.   :D

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
yep me too.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
I'm not proud to say it only took me 11 months to add this feature, but i'm happy to say that i have implemented it, and will upload it in the next few days.

The new version of dcuhelper works as follows:

You bundle dcuhelper.exe (still about 100k) with your executable, and invoke it to check for updates.
As before, if the user has the full dcupdater installed, that will be used to check for updates and manage their installation if any are found.

What's changed is the behavior if the user does NOT have the main dcupdater tool installed.

In the past, the dcuhelper.exe would open the program web page and dcupdater page, where they could manually check to see if an update had been released.

Now, dcuhelper.exe will actually check on it's own if an update is available (note this only works with installs that have a single .dcupdate file and won't recursively check plugin updates).

If dcuhelper detects a new version available (or an error), it will behave as before and open the program web page in the browser for user to download and install the new version manually.

If there is no update, dcuhelper will behave like dcupdater and silently exit without bothering the user.

I hope this new feature will offer people the best of both worlds -- very lightweight update checking for people who don't want a full fledged update downloader and prefer to do things manually, and a full featured update tool for people who prefer an automated solution, and for complicated cases like plugins, etc.  The bottom line is that in the past users HAD to install the main dcupdater tool to get any useful benefit -- whereas now dcuhelper.exe on its own will be good enough for most users.  This should make bundling dcuhelper with your application more clearly a good thing to do.

I'll post the new version in a few days and would appreciate any help testing.
« Last Edit: December 30, 2009, 01:08 AM by mouser »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
I've posted a copy of the new version at:
https://www.donation.../alpha/dcuhelper.zip

Let me know how it works for you.  Remember it should work the same as before except when run on a machine without the main dcupdater program installed on it.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Just a note that i've tested dcuhelper on windows versions from win98 to win7, all working.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
I'll try to find some time to test this new release once I get caught up on NANY and holiday and who knows what else.  =]

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
I like this update a lot!
I'm including it on my new release of GridMove ;)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
anyone care to test and report?

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
I've been using the new version in GridMove since the last release (January 11 or something like that).
I tested it in a virtual machine before and it worked great! ;)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
thanks jgp!  :-*

Markham

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 404
    • View Profile
    • Circle Dock
    • Donate to Member
Mouser,

I've read this thread with interest as I've been toying with the idea of including something along these lines in Circle Dock. However, I have some questions:

1. Circle Dock makes use of Mutexes. Assuming only one installation of the program, when CD starts, it checks for its Mutex and, if already allocated, it switches to the original instance and the second instance terminates. If there are multiple installations (in different folders), multiple instances can be run and each "knows" about the others' presence. Is DCU mutex-aware (as Inno Setup is) ?

2. How are "non-versioned" files (eg text or help files) handled?



Mark