View Full Version : wucheck return value in VB6
k4plus
09-24-2010, 12:29 PM
Hi,
I can't seem to find an answer to this question anywhere...I'm using the shellexecute API to run wucheck from my VB6 program but I can't find a way to retrieve the return value that indicates whether there is a new version of my program available or not. The return value from shellexecute simply tells me whether it was able to run wucheck ok.
Thanks for your help.
Wole.
linder
09-25-2010, 03:19 AM
Wole,
In Windows, if you use ShellExecuteEx, you have to "wait" for the launched application to retrieve the return value from that app. You have to use the WaitForSingleObject Windows API to wait and then GetExitCodeProcess to retrieve the exit code.
BTW, this is not only for wupdate.exe or wucheck.exe. This is for all Windows applications.
Does this help?
Friedrich
k4plus
10-04-2010, 07:05 AM
Hi Friedrich,
All my research confirms what you said but not being the hottest Windows API programmer around, I chose to do the following instead:
1. Write a short function on the webserver than hosts my updates. This opens the 'program updates manifest file', reads the version information and returns whatever it finds; it literally took just 5 minutes to write this!
2. Call that webserver 'api' from my desktop application using code that I already have written and tested that does http GETs and POSTs. This gives me the version number available.
3. Check it against the version number of the currently running application, and voila, my very own, homegrown wucheck :).
4. If the programme needs updating and the user chooses to do so, I then simply shellexecute wupdate.exe to do the 'heavy lifting' and exit my app.
Works for me and was easier to implement due to having code already available to do most of it anyway.
Thanks for your help. I just thought to document the route I took in case it helps anyone else.
Regards,
Wole.
linder
10-04-2010, 07:44 AM
Hello Wole,
I have not written any VB code for more than 10 years now, so unfortunately, I do not have a good ShellExecute/Wait function for VB available.
But the following link demonstrates how to use ShellExecuteEx and the "Wait" option:
http://files.codes-sources.com/fichier_fullscreen.aspx?id=41441&f=Compiler%5CModMain.bas&lang=en
Friedrich
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.