Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to make an HTML viewer Control and show HTML FILE

94 views
Skip to first unread message

roger

unread,
May 10, 2001, 6:52:43 AM5/10/01
to
I have read the MSDN but I still can't show a HTML format file.
I thought the problem may be revalent to "SendMessage", maybe.
You could tell me how to correct the code or tell me how to get the WinCE IE
sample code.
Please help me. THANKS.

The followings is part of my code.
.....
......
TCHAR content[]=TEXT("<html><head><title>hi</hi></head><body>good
day</body></html>");

BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND htmlview;

g_hInstHTMLCtrl = LoadLibrary(TEXT("htmlview.dll"));
InitHTMLControl (hInstance);

htmlview = CreateWindow(DISPLAYCLASS, szTitle, dwStyle,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL,
hInstance, NULL);

SendMessage(htmlview,WM_SETTEXT,0,0);
SendMessage(htmlview,DTM_ADDTEXT,(WPARAM)(BOOL) false,(LPARAM)(LPSTR)
content);
SendMessage(htmlview,DTM_ENDOFSOURCE,0,0);

if (!htmlview)


return FALSE;
}

ShowWindow(htmlview, nCmdShow);
UpdateWindow(htmlview);
}


TGoggin

unread,
May 13, 2001, 8:44:41 PM5/13/01
to
Hi,

Just at a first read-through, you're using DTM_ADDTEXT, but you're passing a
Unicode string.

Try DTM_ADDTEXTW instead and let me know how it works?

HTH,

--
Terence "Dr. CE" Goggin
Information Appliance Assoc.
Windows CE Development and Consulting
terencegoggin AT hotmail DOT com

"roger" <ro...@neovue.com> wrote in message
news:#kWXR9T2AHA.2080@tkmsftngp02...

Lukasz Szydlowski

unread,
May 14, 2001, 10:41:22 AM5/14/01
to
Hi,

I am using MFC. All what I'm sending You is one function belowed:

int CHTMLCtrl::SetHTMLSource()
{
int iCurr = 0, iEndLine, iTemp, iLength = m_strSource.GetLength ();
char * pcLine;

m_wndHTML.SendMessage (WM_SETTEXT, 0, (LPARAM)(LPCTSTR) "");

while (iCurr < iLength)
{
if ((iEndLine = m_strSource.Find (13, iCurr)) != -1)
{
}
else
{
iEndLine = iLength;
}
pcLine = new char [iEndLine - iCurr + 1];
for (iTemp = 0; iTemp < iEndLine - iCurr; iTemp++)
{
*(pcLine + iTemp) = (char) m_strSource.GetAt(iCurr + iTemp);
}
*(pcLine + iTemp) = 0;
m_wndHTML.SendMessage (DTM_ADDTEXT, FALSE, (LPARAM)(LPSTR) pcLine);
delete [] pcLine;
iCurr = iEndLine + 2;
}
m_wndHTML.SendMessage (DTM_ENDOFSOURCE, 0, 0);
return 1;
}

as you see there is m_wndHTML varible. It's a member of CHTMLCtrl class,
whitch derived from CWnd. You can exchange all lines contained calling to
this member, with API's functions containde hWnd. Another member belongs to
CHTMLCtrl is m_strSource witch is CString. I place HTML Source here, before
call function.

If you had any problem (with my english more, I think), send my a line to
lszyd...@box43.pl.

Lukasz.


"roger" <ro...@neovue.com> wrote in message
news:#kWXR9T2AHA.2080@tkmsftngp02...

roger

unread,
May 15, 2001, 11:29:17 PM5/15/01
to
thank you!

TGoggin

unread,
May 26, 2001, 7:20:45 PM5/26/01
to
You're most welcome :) glad it helped.

--
Terence "Dr. CE" Goggin
Information Appliance Assoc.
Windows CE Development and Consulting
terencegoggin AT hotmail DOT com

"roger" <ro...@neovue.com> wrote in message

news:uvIeZhb3AHA.2052@tkmsftngp03...

0 new messages