Support Forums > WinFBX - Windows Framework for FreeBASIC

CWinHttpRequest

(1/2) > >>

Paul Squires:
Hi Jose,

I have been thinking of adding an automated check for new WinFBE version. Your code below works perfectly but it does trigger Windows UAC so I have to click yes to continue. The file does download perfectly but obviously I don't want to have the user have to click all the time. Any thoughts? Maybe a setting or additional info that needs to be set?

Thanks,
Paul


--- Code: ---'#CONSOLE ON
#include once "windows.bi"
#include once "Afx/CWinHttpRequest.inc"
#include once "Afx/CStream.inc"
using Afx

' // Create an instance of the CWinHttp class
DIM pWHttp AS CWinHttpRequest

' // Open an HTTP connection to an HTTP resource
pWHttp.Open "GET", "https://www.planetsquires.com/winfbe_version.txt"

' // Send an HTTP request to the HTTP server
pWHttp.Send

' // Wait for response with a timeout of 5 seconds
DIM iSucceeded AS LONG = pWHttp.WaitForResponse(5)

DIM st AS STRING = pWHttp.GetResponseBody
' // Open a file stream
DIM pFileStream AS CFileStream
IF pFileStream.Open("winfbe_version.txt", STGM_CREATE OR STGM_WRITE) = S_OK then
   pFileStream.WriteTextA(st)
END IF

PRINT
PRINT "Press any key..."
SLEEP

--- End code ---

Josť Roca:
In my computer it doesn't trigger the UAC.

Paul Squires:
Hmmmm.... interesting.

Paul Squires:
If I set my UAC to the lowest setting then I don't get the notification but if I set it to any other level then it triggers.

Paul Squires:
Believe it or not, but it is the name of the EXE that is the problem. I named my test source code file "CheckForUpdate.bas". The resulting EXE automatically triggers the UAC. I guess EXE's named "CheckForUpdate.exe" must have special status. Anyway, seems to be working okay now that I am using a different filename.

Navigation

[0] Message Index

[#] Next page

Go to full version