|
-
Jun 17th, 2007, 04:56 PM
#1
Windows Security Alert
when i connect to the internet, and upload a file using FtpPutFile
the Windows Security Alert comes up telling me my program is blocked,
if i ignore, it does not prevent the file from being uploaded, but
is there any way to programatically to stop it from coming up or adding my program to the exceptions list as i don't really want the user being confronted with this dialog
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jun 21st, 2007, 05:26 AM
#2
Re: Windows Security Alert
looks like i can use the windows firewall API,
got some sample vb script, so i will see if i can convert it to use
vb Code:
Option Explicit
' Set constants
Const NET_FW_PROFILE_DOMAIN = 0
Const NET_FW_PROFILE_STANDARD = 1
' Scope
Const NET_FW_SCOPE_ALL = 0
' IP Version – ANY is the only allowable setting for now
Const NET_FW_IP_VERSION_ANY = 2
' Declare variables
Dim errornum
' Create the firewall manager object.
Dim fwMgr
Set fwMgr = CreateObject("HNetCfg.FwMgr")
' Get the current profile for the local firewall policy.
Dim profile
Set profile = fwMgr.LocalPolicy.CurrentProfile
Dim app
Set app = CreateObject("HNetCfg.FwAuthorizedApplication")
app.ProcessImageFileName = "%PROGRAMFILES%\Outlook Express\msimn.exe"
app.Name = "Outlook Express"
app.Scope = NET_FW_SCOPE_ALL
' Use either Scope or RemoteAddresses, but not both
'app.RemoteAddresses = "*"
app.IpVersion = NET_FW_IP_VERSION_ANY
app.Enabled = TRUE
' Use this line if you want to add the app, but disabled.
'app.Enabled = FALSE
On Error Resume Next
errornum = 0
profile.AuthorizedApplications.Add app
errornum = Err.Number
if errornum <> 0 then Wscript.Echo("Adding authorized application failed with: " & errornum)
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|