Visit the HTML file in the resource

xiaoxiao2021-03-06  64

Embed HTML in the program, then make it displayed, it is often possible to reach the beautiful interface effect that the VC cannot be implemented, and the web page can be displayed, flash, words, and more. 1. Import the HTML file into the RC resource. It is recommended to name the resource file name to the same name. The HTML path is similar to the following: res: // c: / documents% 20and% 20Settings / Administrator / desktop /Process_htmlForm/testhtml/debug/testml.exe/html1.htm; then call NaviGate or NaviGate2 method display, code: cstring StrPath; strpath = resourcetourl (_t ("html1.htm")); NaviGate2 (strpath, null, null); =========================================================================================================================================================================================================================================== LPCTSTR lpszURL) code is as follows: CString m_strURL; hINSTANCE hInstance = AfxGetResourceHandle (); ASSERT (hInstance = NULL); LPTSTR lpszModule = new TCHAR [_MAX_PATH]; if (GetModuleFileName (hInstance, lpszModule, _MAX_PATH!)) {m_strURL.Format (_T ("Res: //% s /% s"), lpszmodule, lpszurl;} delete [] lpszmodule; return m_strull; 3. Manipulating HTML first imports IE type library, as follows: #pragma Warning (Disable: 4192) #pragma WARNING (Disable: 4049) #import "c: /winnt/system32/mshtml.tlb" program can dynamically change the page content through DHTML, but the element required to be changed must have an ID, the page is imported, and the page is obtained by the following method. Element: mshtml :: htmldocument2ptr pdoc (gethtmlDocument ()); mshtml :: htmlelementptr e (pdoc-> getAll () -> ITEM (_T ("SomeElement")))))); E-> Putinnertext (_t ("" "))); // Ore-> PutinnerHTML (_T (" sometext ))); Related Links: http: //www.codeguru.com/cpp/in/ieprogram/Article.php/c4377/

转载请注明原文地址:https://www.9cbs.com/read-111535.html

New Post(0)