|
nabilssorial wrote:
thanks for reply
this code :
i try to use bitmap in resource "IDB_1" by LoadImage
//Global ....
HANDLE img; //=NULL;
INLINEIMAGEINFO imgInfo;
for the first time in wm2k3 the picture is display for 1 seconds then disappear, after reading this thread (change break to return) the function working properly. here's mine :
LRESULT CMyApp::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_NOTIFY:
NM_HTMLVIEW * pnmHTML = (NM_HTMLVIEW *) lParam;
LPNMHDR pnmh = (LPNMHDR) &(pnmHTML->hdr);
CString strReg = _T("register");
switch(pnmh->code)
{
case NM_INLINE_IMAGE:
CString strSrcText = pnmHTML->szTarget;
DWORD dwCookieValue = pnmHTML->dwCookie;
CBitmap* pBitmap;
if (! m_imagesCache.Lookup(strSrcText, (CObject*&)pBitmap)) {
::SendMessage(m_hwndHtml, DTM_IMAGEFAIL, 0, (LPARAM)&dwCookieValue);
return (LRESULT)1;
}
INLINEIMAGEINFO imageInfo;
imageInfo.dwCookie = dwCookieValue;
imageInfo.bOwnBitmap = FALSE;
imageInfo.hbm = (HBITMAP)(*pBitmap);
CSize size = pBitmap->GetBitmapDimension();
imageInfo.iOrigWidth = size.cx;
imageInfo.iOrigHeight = size.cy;
::SendMessage(m_hwndHtml, DTM_SETIMAGE, 0, (LPARAM)&imageInfo);
CString data;
data.Format(L"Image width=%d, height=%d, pBitmap=%p, pic name=%s", size.cx, size.cy, pBitmap, (LPCTSTR)strSrcText);
return (LRESULT)1;
}
}
return CView::WindowProc(message, wParam, lParam);
}
Riki Risnandar
|
|
|
|
|
riki_risnandar wrote:
....
case NM_INLINE_IMAGE:
CString strSrcText = pnmHTML->szTarget;
DWORD dwCookieValue = pnmHTML->dwCookie;
CBitmap* pBitmap;
if (! m_imagesCache.Lookup(strSrcText, (CObject*&)pBitmap)) {
::SendMessage(m_hwndHtml, DTM_IMAGEFAIL, 0, (LPARAM)&dwCookieValue);
return (LRESULT)1;
}
INLINEIMAGEINFO imageInfo;
thanks for reply
but I have one Question:
what is "m_imagesCache" Object??
and what initial values set to it to use it?
thanks again,
Nabil Samir
|
|
|
|
|
in source code that included ini this article:
CMapStringToOb m_imagesCache;
which means its the variable to stored the bitmap files to prepare the images on htmlview.
the initial values is set on 'RegisterHtmlImage' function and deleted in 'DeleteHtmlImages' function.
Riki Risnandar
|
|
|
|
|
the problem still exist
realy I use eMbedded Visual C++ 4.0
and emulator for pocket pc 2003
and don't use MFC
and I am sure that Image still loaded because
it is global and i use it again in other things
but after the html appear, i think, it makes refresh
from itself so images disappear
i don't use MFC so i can't use your solution(CMapStringToOb)
when i test the example (html control) in eMbedded Visual C++ 3.0
it works well but in emulator for pocket pc 2002 only
and not work (same example with eMbedded Visual C++ 3.0) in emulator for pocket pc 2003
so can anyone help me?
thanks.
Nabil Samir
|
|
|
|
|
Modify your code as below:
case NM_INLINE_IMAGE:
CString strSrcText = pnmHTML->szTarget;
DWORD dwCookieValue = pnmHTML->dwCookie;
CBitmap* pBitmap;
if (! m_imagesCache.Lookup(strSrcText, (CObject*&)pBitmap)) {
break;
^^^^^
//::SendMessage(m_hwndHtml, DTM_IMAGEFAIL, 0, (LPARAM)&dwCookieValue);
//return (LRESULT)1;
}
....
It will be work ok.
|
|
|
|
|
What kaubeu said was right! I got the key!
|
|
|
|
|
HTML control works well on 2000 emulator but the content is not diplayed on BE300 - MIPs Pocket PC (Windows CE 3.0) device.
Any reason why?
Best regards.
biswa.
|
|
|
|
|
Hi,
I am working on the this control. I observed it is caching the content from the previous page.I want to prevent the caching. My application is working under WinCe3.0 (ARM)
Thanks
|
|
|
|
|
Hi,
Can anyone provide a working sample of the HTML Viewer program that compiles with the new .NET CF? Any ideas or code samples wil be greatly appreciated!
|
|
|
|
|
Hi,
Did you able to get a solution for this. I could able to running this application with htmlview control in CE3.0successfully , but not displaying anything in CE4.2. I have all the components for CE4.2 like htmlview.dll, asform.dll etc...).
Please let me know how did you solve this problem.
|
|
|
|
|
Dear All,
How to get the redirected URL or Curent URL from the HTML Viwer/Container ?
Suggestions are most welcome !!!
Regards,
AKS
|
|
|
|
|
this code is really cool, it works and i even loaded HTML and Graphic-files from the local file system.
No I am planning to show WWW-content in the sHTMLView.
Has anybody ever tried that?
Do you have any hints for me?
Are there built-in features that I can use?
thx, Daniel
|
|
|
|
|
in your sample code, you always read images from a resource in the evc-program.
could I also read a image from a file? How would I do that? Would VOImage be helpful?
see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppc2k/html/ppc_viewer.asp
and http://www.voscorp.com/asp/PPC/Dev/VOImage/default.asp
thx, Daniel
|
|
|
|
|
|
thx. i got it working. i just needed VOImage.h and .cpp (http://www.voscorp.com/ASP/PPC/Dev/default.asp) and these lines of code:
//in STHTMLDialog.cpp:
#include <htmlctrl.h>
#include "VOImage.h"
CVOImage img;
//...
case NM_INLINE_IMAGE:
HDC dc = ::GetDC(this->m_hWnd);//org: GetDC(hWnd)###
if(img.Load(dc, pnmHTML->szTarget)) //wahrscheinlich steht in szTarget der Dateiname
{
INLINEIMAGEINFO imgInfo;
imgInfo.dwCookie = pnmHTML->dwCookie;
imgInfo.iOrigHeight = img.GetHeight();
imgInfo.iOrigWidth = img.GetWidth();
imgInfo.hbm = img.Copy();
imgInfo.bOwnBitmap = FALSE;
::SendMessage(m_hwndHtml, DTM_SETIMAGE, 0, (LPARAM)&imgInfo);
//CString data;
//data.Format(L"Image width=%d, height=%d, pBitmap=%p, pic name=%s", img.GetWidth, img.GetHeight, img.Copy(), (LPCTSTR)pnmHTML->szTarget);
}
else
::SendMessage(m_hwndHtml, DTM_IMAGEFAIL, 0, pnmHTML->dwCookie);
::ReleaseDC(this->m_hWnd, dc);
break;
}
/* the source of the HTML-file can be something like this:
-> they all work */
thx, Daniel
|
|
|
|
|
Hi All,
It is very slow if you have a path like . You guys have any ideas why this is so.
Thanks a lot,
Kevin
|
|
|
|
|
its very strange, but i had the experience that reading images from files gets VERY slow the first time, when the path is longer than 30 characters. Just keep the path and the filename short. It took me more than a week to find that out....
thx, Daniel
|
|
|
|
|
I wanna scroll page that is made by HTML control
for example..down 1 line or down 1 page...
How do I can be?..
|
|
|
|
|
::SendMessage(hwnd,WM_VSCROLL,SB_PAGEUP, 0); //for page up
::SendMessage(hwnd,WM_VSCROLL, SB_PAGEDOWN, 0); // for page down
|
|
|
|
|
sorry !
where can add this code ?
WindowProc(......) or some where ?
i use WM_KEYDOWN but no message to receive !
|
|
|
|
|
I cant get that to work either... by hwnd you mean the variable "m_hwndHtml"??
I tried to test it at the bottom of the SetHtml() function, and it didnt work
thanks
--Ben
|
|
|
|
|
HTML control has its own scrollbar and it won't handle any WM_VSCROLL/WM_HSCROLL messages. (If you set the control style to display scrollbar and its content is too long to display - it will display another scrollbar inside the client area and it won't response the outer scrollbar)
You can simulate scolling by using anchor
1.add anchor to the begining of the line
<code>
<A NAME='line1'>line1</A><BR>
<A NAME='line2'>line2</A><BR>
<A NAME='line3'>line3</A><BR>
</code>
2.when you want to scroll just call
<code>
::SendMessage(m_hwndHtml, DTM_ANCHOR, 0, L"line3");
</code>
|
|
|
|
|
I thought of that, but that of necessity contaminates the source document. It's reminiscent of the way Notepad inserts conditional CR's for its linewrap, (or used to in the old days). That seems to be a pretty poor substitute for the real thing.
You're saying that there is a scrollbar control included in the htmlview control, but it is not accessible to the applications programmer?
I've tried the same thing, and I know I have the right handle, because it works for ShowWindow. However, the handle that works for ShowWindow has no child windows according to ::GetWindow(hHTMLCtrl, GW_CHILD);
Using that very handle that the control is Created with, I can Hide the window, by a MessageBox option, then likewise Show it again. But I can't Scroll it, Cut text, Paste text, or even GETTEXTLENGTH, even though the control was originally populated with SETTEXT.
Very puzzling.
|
|
|
|
|
Can the HTMLCtrl handle forms?
How can I do that?
|
|
|
|
|
Yes, when you receive the NM_HOTSPOT message, you get the form post data from (NM_HTMLVIEW*)lParam->szData (a character array).
|
|
|
|