PDA

View Full Version : ppc html interface


Nicknack
08-22-2009, 01:40 PM
here is the basic structure to display some html in your forms:
#declare InitHTMLControl "htmlview.dll" InitHTMLControl 1 1
#define DTM_ADDTEXTW (WM_USER+102)
#define DTM_ENDOFSOURCE (WM_USER+104)

func WndProc(hWnd$, Msg$, wParam$, lParam$)
case (Msg$)
WM_COMMAND:
wmId$ = LOWORD(wParam$);
wmEvent$ = HIWORD(wParam$);
case (wmId$)
401: // Exit
PostMessage(hWnd$, WM_CLOSE, 0, 0);
return (false);
end;

end;
return (true);
end;

func WinMain
Global(f$, htmlview$);

//init html control
InitHTMLControl(HInstance%);
f$ = NewForm("MyForm", "MyFormClass", &WndProc);

//create child window for html
htmlview$ = NewControl(10, "DisplayClass", NULL, null, WS_VISIBLE|WS_CHILD, f$, 0,0,240,320);
SetFocus(htmlview$);

n$ = NewMenu(f$, "File", 400);
NewMenuItem(n$, -1, "Exit", 401);

ShowWindow(f$, SW_SHOW);
SetForeGroundWindow(f$);

//send html formatted text
SendMessage(htmlview$,DTM_ADDTEXTW,0,"<b>Hello World</b><br><a href='localhost'>haha</a>");
//send end of html source
SendMessage(htmlview$,DTM_ENDOFSOURCE,0,0);

return (true);
end;

although it is not a big job, links and images are not handled by my prog yet, but there are good articles in the web if you are further interested: first (http://www.codeguru.com/cpp/w-p/ce/controls/article.php/c6813/), second (http://www.codeguru.com/cpp/w-p/ce/controls/article.php/c9379) and a german one (http://www.pshsoft.net/pshsoft/de/article.php?id=2) ;)
I use the htmlview.dll, there is also another interface, called IWebBrowser2 or Webbrowser Control. not sure if that one is more common or better.
hopefully interesting for someone, should be tested with PPL 2.0 and WM 6.5 some day.

Nicknack
08-24-2009, 08:52 PM
where is this "windows ce toos" directory located? htmlview.dll is a standard WM library, so you should find it in your windows directory ;)