 |
|
 |
Could do with some portability tweaks and steps:
1. Add version.lib to debug+release linker libraries
... If anyone is interested, I can publish the changes I made.
Conrad -
Always do badly to start off, that way when you get the hang of it suddenly, everyone is surprised.
|
|
|
|
 |
|
 |
Hi Alexander,
Thank you example code; I think it is very usefull.
With your code, and with many code-examples in general, I feel that they can be even more of use when programmed more generic; i.e. without any compiler/mfc/vcl kinda dependencies.
You could, for example, use std::string instead of CString and, in the case of your example, leave out any user-interface stuff (don't launch any message boxes, just return the result as an enum or so).
This would allow programmers with a different or no IDE to apply your code much easier.
Keep up the good work!
Best regards,
Maarten Engels
|
|
|
|
 |
|
 |
Dear Alexander,
It’s indeed a very simple and workable solution giving a basic simple framework to implement the “CheckForUpdates” functionality in our products. I have two questions;
1) I presume that “CheckForUpdates” functionality cannot be FORCED in our MFC (desktop based) products. But this I mean all the good products will keep this option turned on while deploying the product on to the customer but the customer later has the choice to disable AUTO – CheckForUpdates on the application launch. Our good product would then allow the customer to trigger the “CheckForUpdates” via a menu item under the Help menu. This is very commonly adapted practice. Now my question was IS IT LEGAL TO ALWAYS DO (FORCEFULLY) CHECKFORUPDATES ON THE APPLICATION LAUNCH?
2) Is CheckForUpdates a ONE-SIDED data flow? Mostly we see that our product READS information from our Product_Website. Can the reverse happen (may be using INTERNETWRITEFILE() of FTP) i.e. Product collects the necessary information (may be a 32 bit encrypted string) and sends that information while making the hand-shaking with the Product_Website. Again I understand all this is possible but my question is – does it violate any LEGAL aspects of the internet security at the customer’s end.
Basically I am trying to loudly discuss – the best mechanism by virtue of which EACH COPY of our PRODUCT communicates back to our Product_Website about many different things – but prominently – whether the license being used is authentic – i.e Is this customer having a VALID License or Pirated?
I wish to get some insights from you on this.
Best regards,
Yogesh Dhakad
|
|
|
|
 |
|
 |
Just one quick addition to rule out common doubt - my product is having a robust ( ) licensing mechanism and this is in-built into the product. Thus the licensing mechanism itself does NOT need to cummunicate to the webserver etc.
To cut it short - my product is designed such that it SHOULD run on a customer's machine that is NOT connected to the internet. I hope you could reply back with some good information / links.
Regards,
Yogesh
|
|
|
|
 |
|
 |
Hi!
I'm not quite sure if I understood you right.
1) I'm not a lawyer, so I can not guarantee that an automatic update check is legal in any country you ship your software. My personal optinion is that if you clearly point this out in your manual there should be no problem. Otherwise you could add a checkbox to your installer and let the user decide wether to use this or not.
2) The data flow is (more or less) one-sided, as ony other HTTP request. You can transfer small portions of data (e.g. software version, application name, even a serial number or better a hash of a serial) using the agent string of the request. You know: When looking at your web log you can see how many users used e.g. IE 5.5 as an agent. Why not transfer "MyApp 1.0" as the agent? But before transferring any personal data using this way you should really inform the user what's going on...
Ciao,
Alex
|
|
|
|
 |
|
 |
Thanks Alex for giving a prompt and satisfying reply.
Regards
|
|
|
|
 |
|
 |
Just what i wanted, but I've extended it on my machine to run a php script on the server to return the latest version (and other available versions) and i've found that InternetReadFile can read things in chunks and not return teh whole file on the first call.
I know this is unlikely with such a small file being loaded, b ut over a very slow dialup you may find that it will not read the whole file.
/**********************************************************/
bool InternetReadWholeFile(HINTERNET hUrl,LPVOID lpBuffer,DWORD dwNumberOfBytesToRead,LPDWORD lpNumberOfBytesRead)
{
DWORD dwRead=0;
BYTE szBuffer[512];
memset(lpBuffer,0,dwNumberOfBytesToRead);
*lpNumberOfBytesRead = 0;
do{
if (!InternetReadFile(hUrl,szBuffer,sizeof(szBuffer),&dwRead))
dwRead = 0;
if (dwRead!=0){
if (*lpNumberOfBytesRead + dwRead > dwNumberOfBytesToRead) return false;//too much data for the buffer
memcpy(&((char *)lpBuffer)[*lpNumberOfBytesRead],szBuffer,dwRead);
*lpNumberOfBytesRead+=dwRead;
}
}while (dwRead != 0 && strchr((char *)lpBuffer,EOF)==NULL);
return strchr((char *)lpBuffer,EOF)==NULL;
}
I used this function instead.
Cheers, John.
|
|
|
|
 |
|
 |
Hi!
First of all: you are right, the original function could loose data. I did some tests and always got enough bytes that include the (very small) text string from the download. But there is no guarantee that this will always work, so I'd suggest to use your code above to replace my original code.
I'll put your code inside the class during the next update - which could take quite a long time... If you do not want me to do this please send a reply.
Ciao,
Alex
|
|
|
|
 |
|
 |
Hi,
No problem at all, I don't mind you using the code, I just wanted to flag it up for people in case they extend it to download a larger file. I scratched my head for a while trying to work out why sometimes it got it all, and othertimes it got very little. But as you say that it is only downloading a very small file so unless they're using a wet peice of string for their internet connection then the function will always return the full line.
Cheers, John.
|
|
|
|
 |
|
 |
Hi Alex!
This source code is nice and easyes for use! I use this code in my application! It absolutely FREE for use (Web Update Wizard - cost 129 $ for single application??? What is this?). Thanks for this excellent class. More commercial products using the similar method for update check!
Thanks, Krasimir Stoychev!
|
|
|
|
 |
|
 |
Run-Time Check Failure #2 - Stack around the variable 'szBuffer' was corrupted. (VC7 assert)
the function doesn't check the max len (512) of the buffer before adding "\n"
Change the line:
szBuffer[dwRead] = 0;
with:
szBuffer[ (dwRead<512 ? dwRead : 511)] = 0;
Juande
|
|
|
|
 |
|
 |
The subject says it all. If you would like something more comprehensive, but low cost, which can download and install the updates (and much more), yet only needs a single DLL call to build into your software and runs on any isp / webserver, please check out the Web Update Wizard at http://www.PowerProgrammer.co.uk.
(I hope no one is offended by this plug - it seems relevant given the subject matter of this article.)
Thank you.
Pete
|
|
|
|
 |
|
 |
...and for only $400 you can have all that!!
|
|
|
|
 |
|
 |
Not clear what your point is, but assume you don't like the plug!
Please consider what the Web Update Wizard does and compare it to alternatives such as Installshield's. The Web Update Wizard can be used on any number of projects for a (1 developer) cost of $400. Installshield's service starts more expensive, is recurrent, and depends on their servers.
The Web Update Wizard is clearly not for everyone, but it does represent a cost-effective route to delivering this functionality with little effort and at low cost, and existing users are enthusiastic. $400 = 1 developer day? See if you can write something like the Web Update Wizard in 1 day - if you can then clearly you don't need the Web Update Wizard. Otherwise, surely it's worth consideration?
I will not add any more to this thread, whatever comes below this posting. I posted the plug because it was relevant to viewers who might be interested in adding 'update over the web' to their apps. I am sorry if this has offended anyone - that was not the intention.
|
|
|
|
 |
|
 |
What about the Gnucleus method for updating? It offers the same solution and is completely free. There's even a tutorial here on CodeProject: http://www.codeproject.com/useritems/gnucleus.asp
Sean O'Brien
|
|
|
|
 |
|
 |
Does Gnucleus allow users without Admin rights to securely update to Program Files folder etc? Only Web Update Wizard does do this! Most corporates tie down Program Files / Windows folders etc. and a process running in the user's security context will not be able to update itself or anything else in these locations.
|
|
|
|
 |
|
 |
That feature wouldn't be too hard to implement, and would only matter on nt/xp systems. I hardly think that's worth $400 for a single developer. Please, advertise elsewhere.
Sean O'Brien
|
|
|
|
 |
|
 |
Clearly there are people out there who disagree with you Sean.
Over and definitely out. (Sorry you feel so strongly about this issue!)
|
|
|
|
 |
|
 |
free advertising on CP is a no-no
How do I print my voice mail?
|
|
|
|
 |
|
 |
I've already apologised for any offense caused by my posting. What more can I do?
I am not an axe murderer, I am kind to children and old ladies. Give me a break!
I had thought this thread was well and truly put to bed, but I guess there are self-appointed net police popping up all the time. Perhaps they should read the whole thread though? That is, as already stated, I have already sincerely apologised, and in addition some (in my opinion) wholly reasonable people have stated that the posting at least helped increase their awareness of the range of available options.
To complete my punishment, I am slitting my wrists as I type this.... Happy?
|
|
|
|
 |
|
 |
peterboulton wrote:
I've already apologised for any offense caused by my posting
Yeah your right...so I suppose I should appologize
My sincere appologies
However I didn't really mean my remark to come across like it obviosuly did...I would make shameless plugs too (if I had a product to push). It was more of a tisk tisk kinda remark...and the fact you appologized helped...I hate it when people post ads in the forums and just ignore criticism...
When I read posts i'm 99% of the time looking for FREE answers to a problem, not some commercial bulls*it...i'm a very impatient programmer, wanting answers now
peterboulton wrote:
I am not an axe murderer, I am kind to children and old ladies. Give me a break!
<br/> There you go
A bit of HTML humor to lesson any grief I may have caused you...(it's even xhtml compliant)
peterboulton wrote:
wholly reasonable people have stated that the posting at least helped increase their awareness of the range of available options
IHMO just don't do it again (this way)...there are much better ways to do it...like the old advertising adage goes...one negative customer is worse than something...something...
Personally I have looked into doing what you have done I just haven;'t gotten around to it yet... so it wouldn't be much good to me, but obviously some people appreciated it!!!
If you want to advertise a product like yours on CP do like I will eventually do...have a link inside your sig and become highly active in the CP community...look at Mike Dunn for an example...he's helpful, knowledgable, written tons of high quality articles and every time he makes a post he makes an incognito plug for his products
He's a smart dude...
What you could do is post the LCS code (w/ LCS tutorial) you use to differentiate your two files as an article on CP (there are already a few, so read them and make yours better)
That'll guarunteed get people checking out your product and it's considered ethical on CP (so i've noticed)
Anyways man, I appologize for any feelings I may have disturbed and I really didn't mean it that way, it was just me browsing the bowels of CP at 4 in the morning with nothing else to do...
Cheers
How do I print my voice mail?
|
|
|
|
 |
|
 |
To end this discussion:
First of all I'm not too happy to have an advertisement in this article. I think that my class and the promoted product focus completly different developers. And if it's worth 400 $ or not is up to you...
Ciao,
Alex
|
|
|
|
 |
|
 |
Alex,
I am truly sorry for any offense caused to you or any readers of your contribution. What more can I say?
Pete
|
|
|
|
 |
|
 |
I found the plug and the link to Gnucleus Tutorial (Part 1) very helpful. I think the shamless plug was great because I found out alot about Free and Commercial products.
I have products to deploy and I need help doing it.
|
|
|
|
 |
|
 |
I agree with Tony. I found the article informative, although my needs exceed the limitations of the class. I didn't mind Peter's plug. If my project had double or triple the users, then $400 would indeed be a reasonable price to pay. Damn, I got off topic.
The point was that I, like Tony, gained a lot of information here today from the article and more importantly, some alternatives mentioned in this thread.
|
|
|
|
 |