how to get the VARIANT type URL as a CString from OnDocumentComplete in webbrowser2
-
how to get the VARIANT type URL as a CString from OnDocumentComplete in webbrowser2
void MyDialog::OnDocumentCompleteExplorer1(LPDISPATCH pDisp, VARIANT FAR* URL) { }
"URL" here contains the url that has been completed. but it is a variant type. i want to as a CString type so that i can check it. i tried casting but it doesnt work. does anyone knows how to do it? - MFC style - winxp - vc6.0 thanks in advance! -
how to get the VARIANT type URL as a CString from OnDocumentComplete in webbrowser2
void MyDialog::OnDocumentCompleteExplorer1(LPDISPATCH pDisp, VARIANT FAR* URL) { }
"URL" here contains the url that has been completed. but it is a variant type. i want to as a CString type so that i can check it. i tried casting but it doesnt work. does anyone knows how to do it? - MFC style - winxp - vc6.0 thanks in advance!you can use the
V_BSTR
macro to get it done. the macro returns aBSTR
that you can use to obtain aCString
. something like this may help/work:BSTR bstrUrl = V_BSTR(URL); CString cstrUrl(bstrUrl);
-
how to get the VARIANT type URL as a CString from OnDocumentComplete in webbrowser2
void MyDialog::OnDocumentCompleteExplorer1(LPDISPATCH pDisp, VARIANT FAR* URL) { }
"URL" here contains the url that has been completed. but it is a variant type. i want to as a CString type so that i can check it. i tried casting but it doesnt work. does anyone knows how to do it? - MFC style - winxp - vc6.0 thanks in advance!awah wrote:
"URL" here contains the url that has been completed. but it is a variant type.
A variant type has many different subtypes, one of which is a BSTR. For example:
COleVariant vtURL(URL, VT_BSTRT);
CString strURL = V_BSTRT(&vtURL);Or:
CString strURL(V_BSTR(URL));
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
awah wrote:
"URL" here contains the url that has been completed. but it is a variant type.
A variant type has many different subtypes, one of which is a BSTR. For example:
COleVariant vtURL(URL, VT_BSTRT);
CString strURL = V_BSTRT(&vtURL);Or:
CString strURL(V_BSTR(URL));
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne