1, download htmlayoutsdk, put in workspace.
Sdk:http://www.terrainformatica.com/htmlayout/htmlayoutsdk.zip
2,VS Create the Win32 project.
3, introduce HTMLAYOUTSDK's include and Lib.
Include: Project Right-click, select Properties, select C + +, select General, append include directory to introduce HTMLAYOUTSDK.
LIB: Project right-click, select Properties, select Connector, select General, additional library directory to introduce htmlayoutsdk Lib directory.
4, place the Htmlayout.dll file in the Htmlayoutsdk\bin directory under the project directory: D:\c_workspace\Win32Html\Win32Html
5. Introduce the header file.
#include "behaviors/notifications.h"< htmlayout_behavior.hpp>#pragma comment (lib, "HTMLayout.lib")
6, Overwrite lresult CALLBACK WndProc (HWND hwnd, UINT message, WPARAM WPARAM, LPARAM LPARAM) function:
////functions: WndProc (HWND, UINT, WPARAM, LPARAM)////Purpose: Processes the message of the main window. ////wm_command-Processing Application Menu//WM_PAINT-Draw the main window//Wm_destroy-Sends an exit message and returns////LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM WPARAM, LPARAM LPARAM) {intWmid, wmevent; Paintstruct PS; HDC hdc; LRESULT LRESULT; BOOL bhandled; //Htmlayout +//Htmlayout could be created as separate window//using the CreateWindow API. //Attaching Htmlayout functionality//To the existing window delegating Windows message handling to//htmlayoutprocnd function.LResult = HTMLAYOUTPROCND (Hwnd,message,wparam,lparam, &bhandled); if(bhandled)returnLResult; Switch(message) {//htmlayout------------------------------Beg CaseWm_create:htmlayoutloadfile (hwnd,_t ("hello.htm"));//hello.htm need to be placed in the same directory as EXE, remember to copy the DLL also past Break; //htmlayout------------------------------End CaseWm_command:wmid=LoWord (WParam); Wmevent=HiWord (WParam); //Analysis Menu Selection: Switch(wmid) { CaseIdm_about:dialogbox (HInst, Makeintresource (Idd_aboutbox), hWnd, about); Break; CaseIdm_exit:destroywindow (HWND); Break; default: returnDefWindowProc (hWnd, message, WParam, LParam); } Break; CaseWM_PAINT:HDC= BeginPaint (HWnd, &PS); //TODO: Add any drawing code here ...EndPaint (HWnd, &PS); Break; CaseWm_destroy:postquitmessage (0); Break; default: returnDefWindowProc (hWnd, message, WParam, LParam); } return 0;}
7, create a new HTML file, file name hello.htm
Feel free to write some content:
<body>
8, run:
Win32 the simplest Htmlayout graphical interface demo