Article ID: 182490
Article Last Modified on 3/16/2005
m_WebBrowser.Navigate2(pUrl, NULL, NULL, NULL, NULL);Navigate(2) expects a pointers to VARIANTs. The access violation is due to the fact that the WebBrowser control is trying to write to the memory pointed to by one of these parameters. When you pass NULL for one or more of these parameters, the WebBrowser control tries to write to the NULL memory. This causes the access violation.
VARIANT vtEmpty; vtEmpty.vt = VT_EMPTY;However, using the compiler's native support for OLE is usually much easier. Use the following code to take advantage of the compiler's native support.
_variant_t vtEmpty; // nothing further neededIf you are using MFC, the COleVariant class can be used to created an empty VARIANT. The default constructor for COleVariant sets the type of the VARIANT to VT_EMPTY. Here is the MFC code:
COleVariant vtEmpty;Then, you pass the vtEmpty variable to the Navigate or Navigate2 method like so:
m_WebBrowser.Navigate2(pUrl, &vtEmpty, &vtEmpty, &vtEmpty, &vtEmpty);
Additional query words: 0xC0000005 shdocvw.dll
Keywords: kberrmsg kbbug kbfix kbie500fix kbfaq KB182490