다음을 통해 공유


Replacement of the WinInet User Interface (Windows CE 5.0)

Send Feedback

The Resources and Resource Editors are used to make simple changes to the text strings in Windows CE dialog and message boxes and to create new dialog boxes.

However, there may be situations where you need to change not only the content of a system message, but the actions taken in response to a message. For example, instead of presenting a dialog box that requires a user to choose an action, you may want the system to take a predetermined action and provide a message to the user. The replaceable user interface component of WinInet enables you to write code that intercepts WinInet messages and handles them appropriately for a particular user scenario. You do this by modifying and recompiling the dynamic link library file, wininetui.lib. Source code for the wininetui library is located in the Public\IE\Oak\Wininetui folder. Source code for a sample custom user interface is located in %_WINCEROOT%\Public\IE\Oak folder.

Your custom error- and message-handling code is implemented through the IsDialogBoxHandled Callback Function (WinInet) and the IsMessageBoxHandled Callback Function. Before WinInet opens a message or dialog box, it calls the appropriate callback function with a handle to the parent window for the message or error. If the function returns ERROR_CALL_NOT_IMPLEMENTED, WinInet proceeds with its own message or dialog box.

To implement IsDialogBoxHandled for handling errors related to the security certificate

  1. Determine the size of the buffer that will store the security flag that is returned by the InternetQueryOption function.

    1. Declare a DWORD variable to hold the buffer size and initialize the DWORD variable to zero.

      DWORD dwBufferLength=0;
      
    2. Call InternetQueryOption and pass NULL for the address of the buffer.

      InternetQueryOption (NULL,INTERNET_OPTION_SECURITY_FLAGS,NULL,&dwBufferLength);
      
  2. Allocate memory for the buffer.

    lpBuffer=new char[dwBufferLength];
    
  3. Call InternetQueryOption again by passing INTERNET_OPTION_SECURITY_FLAGS in dwOption and receive the security flag in lpBuffer.

    InternetQueryOption (NULL,INTERNET_OPTION_SECURITY_FLAGS,(LPVOID)lpBuffer,&dwBufferLength);
    
  4. If the user wants to continue,

    1. Call the InternetSetOption function and pass the security flag received in lpBuffer parameter of InternetQueryOption.

      For example, if DLG_FLAGS_INVALID_CA is returned, then call InternetSetOption and pass DLG_FLAGS_IGNORE_INVALID_CA.

      DLG_FLAGS_IGNORE_INVALID_CA dwFlag;
      InternetSetOption(NULL, INTERNET_OPTION_SECURITY_FLAGS, (LPVOID)dwFlag, sizeof(dwFlag));
      
    2. Return ERROR_SUCCESS.

      Note   If the user wants to cancel, return ERROR_CANCELLED.

    The following list shows the possible security flags returned by InternetQueryOption:

    • DLG_FLAGS_INVALID_CA (0x01000000)
    • DLG_FLAGS_SEC_CERT_CN_INVALID (0x02000000)
    • DLG_FLAGS_SEC_CERT_DATE_INVALID (0x04000000)
    • DLG_FLAGS_SEC_CERT_REV_FAILED (0x00800000)

    The following list shows the values to pass in the dwFlag parameter of InternetSetOption

    • INTERNET_FLAG_IGNORE_CERT_CN_INVALID
    • INTERNET_FLAG_IGNORE_CERT_DATE_INVALID
    • INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS
    • INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP
    • SECURITY_FLAG_IGNORE_UNKNOWN_CA
    • SECURITY_FLAG_IGNORE_REVOCATION

    For more information about INTERNET_FLAG_IGNORE_XXX flags, see API Flags.

    For more infomation about SECURITY_FLAG_IGNORE_XXX flags, see Option Flags.

See Also

WinInet OS Design Development | Resources and Resource Editors | WinInet Overview

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.