現(xiàn)在經(jīng)常使用瀏覽器控件內(nèi)嵌網(wǎng)頁,所以這種用法也多起來了。
1.如圖在下面添加資源:

2. 以VIEW CODE 方式編輯資源文件***.rc :
IDR_HTML1 HTML "res\\a.htm"
將其中資源名稱宏 IDR_HTML1這個格式的換成你自己習(xí)慣的名字。比如上面我改成a.htm
可以把resource.h 中對應(yīng)宏定義刪掉。
#define IDR_HTML1 203 刪掉。
而在使用上:m_strMainURL(L"res://%s/main.htm"),
CPath pathFile;
::GetModuleFileName(NULL, pathFile.m_strPath.GetBuffer(MAX_PATH * 2), MAX_PATH * 2);
pathFile.m_strPath.ReleaseBuffer();
m_strNavigateURL.Format(m_strMainURL, pathFile.m_strPath);
::GetModuleFileName(NULL, pathFile.m_strPath.GetBuffer(MAX_PATH * 2), MAX_PATH * 2);
pathFile.m_strPath.ReleaseBuffer();
m_strNavigateURL.Format(m_strMainURL, pathFile.m_strPath);