如何比较strstr(LPCWSTR,CHAR*);

suk*_*mar 2 c c++ winapi visual-c++

LPCWSTR location_url;
m_spWebBrowser->get_LocationURL((BSTR*)&location_url);
Run Code Online (Sandbox Code Playgroud)

我如何LPCWSTRconst char *in 比较strstr

例:

if(strstr((location_url, ".html"))
Run Code Online (Sandbox Code Playgroud)

sim*_*onc 5

您也可以将目标扩展名设为宽字符串并使用wcsstr

wchar_t* ext = L".html";
if (wcsstr(location_url, ext))
Run Code Online (Sandbox Code Playgroud)