Embed Windows Internet Explorer

Richard Webb richard.webb at boldonjames.com
Thu Dec 19 09:36:57 PST 2013


On 18/12/2013 20:48, Andre wrote:
 > => myURL.bstrVal = SysAllocString(cast(const(wchar*))url);


Looks like the problem there is casting a string to a wchar* - I guess 
the resulting BSTR will contain garbage instead of the intended value.


 >
 > It only works with statement:
 > myURL.bstrVal = cast(wchar*)"http://www.google.de";
 >


Treating a wchar* as a BSTR might cause unexpected things to happen - 
converting the string to a wchar* and then passing that to 
SysAllocString would be safer.


More information about the Digitalmars-d-learn mailing list