Jump to content
  • Advertisement
Sign in to follow this  
Daktor

[Win 32, C++] IWebBrowser2::get_LocationURL

This topic is 2862 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all,

I'm having issues getting IWebBrowser2::get_LocationURL to give a value.

Here's code:

-------------------------------------
wb->Navigate(url, 0, 0, 0, 0);

BSTR url_bstr;
wb->get_LocationURL(&url_bstr);
char *tempChar = _com_util::ConvertBSTRToString(url_bstr);
WCHAR wChar[512];
MultiByteToWideChar(0, 0, tempChar, 511, wChar, 512);
-------------------------------------

wChar is empty.

If I change code to:

-------------------------------------
wb->Navigate(url, 0, 0, 0, 0);

BSTR url_bstr = SysAllocString("www.llll.com");
char *tempChar = _com_util::ConvertBSTRToString(url_bstr);
WCHAR wChar[512];
MultiByteToWideChar(0, 0, tempChar, 511, wChar, 512);
-------------------------------------

then wChar has "www.llll.com"


Any ideas what I've done wrong?

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Ah.. that makes complete sense. I need to hook this into an event that's called each time after it finishes loading instead of calling it immediately after Navigate(..).

Where did you find what a return value of 1 meant? I could not find that.

Share this post


Link to post
Share on other sites
The get_LocationURL documentation say when it returns S_FALSE. As for the numerical value of S_FALSE, mousing over it in a competent IDE is probably the easiest way, otherwise cout-ing it or grepping the headers would get you the value 1.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!