CWebView::GetNavigationTime Method  
 
BOOL GetNavigationTime(
  LPDWORD lpdwElapsed,  
  LPBOOL lpbNavigating  
);

The FunctionName method returns the elapsed time for the last navigation.

Parameters

lpdwElapsed
A pointer to an unsigned integer which will contain the number of milliseconds elapsed since the current navigation has started.
lpbNavigating
A pointer to an integer which is updated when the method returns. It will contain a non-zero value if the browser is in the process of navigating to a new location. If the browser has completed navigation or the last navigation was canceled, this value will be zero.

Return Value

If the method succeeds, the return value is non-zero. If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The GetNavigationTime method measures how long the most recent navigation has taken, reported in milliseconds. If a navigation is currently in progress, the elapsed time represents the duration since the navigation began. If the navigation has already completed, the elapsed time represents the total duration of that navigation. If no navigation has occurred, the elapsed time will be zero.

This method can be used for diagnostics, performance monitoring, or implementing application-level timeouts. For example, an application may track whether a page is taking unusually long to load and decide to cancel the navigation, notify the user, or retry the request. Combined with GetNavigationStatus, it provides a way to determine both the state and timing of navigation operations.

Typical usage scenarios for this method include:

  • Measuring page load times for performance profiling or telemetry.
  • Implementing a custom navigation timeout by checking the elapsed time in a periodic timer.
  • Providing user feedback, such as displaying how long a page has been loading.
  • Logging navigation duration along with success or failure status for diagnostic purposes.

The lpbNavigating parameter indicates whether a navigation is currently in progress when the method is called. This allows developers to distinguish between a completed navigation (where the elapsed time is final) and an in-progress navigation (where the elapsed time is still increasing).

It is important to note that the reported time is based on the browser's internal navigation start and completion timestamps. It reflects the overall duration of the navigation process as observed by the browser, not fine-grained network-level timings such as DNS lookup, TCP connection, or TLS handshake. For most application scenarios this high-level timing is sufficient to evaluate page load performance and detect unusual delays.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cshtmv12.lib

See Also