Show / Hide Table of Contents

MSDN.WhiteKnight - Stack Overflow answers

Ответ на "Добавление исключения адресов в свойства обозревателя с помощью С++"

Answer 894595

Link

Используя Security Zones API:

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <Urlmon.h>


int main(int argc, char **argv)
{
    IInternetSecurityManager *pSecurityManager = NULL;
    HRESULT hResult = S_OK;

    CoInitialize(NULL);
    hResult=CoCreateInstance( CLSID_InternetSecurityManager,  NULL, 
                              CLSCTX_INPROC_SERVER, IID_IInternetSecurityManager,
                              (void **)&pSecurityManager );

    if (SUCCEEDED(hResult))
    {
        hResult=pSecurityManager->SetZoneMapping(
          URLZONE_INTRANET, L"https://example.com", SZM_CREATE 
          );

        if(SUCCEEDED(hResult)) wprintf(L"Done!\n",(UINT)hResult);
        else wprintf(L"SetZoneMapping failed: 0x%x\n",(UINT)hResult);

        pSecurityManager->Release();
    }
    else{
        wprintf(L"CoCreateInstance failed: 0x%x\n",(UINT)hResult);
    }


    getchar();
    return 0;
}

Content is retrieved from StackExchange API.

Auto-generated by ruso-archive tools.

Back to top Stack Overflow answers (published from sources in GitHub repository). Copyright (c) 2020, MSDN.WhiteKnight. Content licensed under BSD 3-Clause License.
Generated by DocFX