|
I used this HTMLCTRL class in one of my program. it works fine for me even now. When I tested, I used following code fregment:
CString str2, str = "<html><head></head><body><table>";
for ( int i=1; i<=6000; i++ ){
str += "<tr>";
for ( int j=1; j<=6; j++ ){
str2.Format("%d %d", i, j);
str += "<td>" + str2 + "</td>";
}
str += "</tr>";
}
str += "</table></body></html>";
UpdateHTMLContent(str);
It crashed!.
Why??? Only today I found out:
Change:
pHTMLDoc2->clear();
pHTMLDoc2->close();
hr = pHTMLDoc2->write(pSafeArray);
to:
hr = pHtmlDoc2->open( CComBSTR("text/html"),
CComVariant(CComBSTR("_self")),
CComVariant(CComBSTR("")),
CComVariant((bool)1),
&lpdRet);
hr = pHtmlDoc2->write(psa);
hr = pHtmlDoc2->close();
lpdRet->Release();
it works now.
Sure you need define these variables. You know that if you are reading this article.
---
Herbert Yu
Are you sure the speed of computer industry is proper? Are you sure the software you released is a bug free one?
|
|
|
|
|
Thank you.
We aknowledged this problem some weeks ago, so we have solved it also.
I should have readen this before and we could avoided some work.
Now, we are focusing our way to insert HTML in another way, and we don't need to regenerate all the web page for each modification.
Once again, thank you for your feedback.
|
|
|
|
|
> We aknowledged this problem some weeks ago, so we have solved
> it also.
Could you post your solution here, or send me an email to me at yuhaian(at)hotmail.com with [HTMLCTRL] somewhere in subject line? (Too many spam emails)
> I should have readen this before and we could avoided some work.
That's importance of communication
> Now, we are focusing our way to insert HTML in another way, and
> we don't need to regenerate all the web page for each
> modification.
Could you give me a little more information on "another way"? Using COM?
> Once again, thank you for your feedback.
Always welcome.
---
Herbert Yu
Are you sure the speed of computer industry is proper? Are you sure the software you released is a bug free one?
|
|
|
|
|
Thanks for the good article.
Actually, I used CHtmlView to get my Web Browser to load my page instead of a dialog.
I want to catch the event that user double-click onto my page or scrolling down, or intervene to see the text user select and drag out from my page.
But I could not know how to do it.
If you can advice some tips then it would be really appreciated
Thanks
Hung
|
|
|
|
|
Why this error im visual C++ .Net
syntax error : 'ATL::CComPtr<t>' should be preceded by ':'
public
CComPtr<iwebbrowser2> m_pBrowserApp;
Visual C++ MFC, ATL, php
|
|
|
|
|
|
1. Please tell me and give source code
i want to customize the browser ctl, so that
i can prevent (images,video clips, Activex ctl etc component) download,in MSDN it is given that it can be done by implementing the Ambient property , but complete detail i not get
2. i am using VC++ 6.0 , and (MSDN and In this VC Libraries) i not found the <iphlpapi.h> and <iphlpapi.lib> please tell link from where i download the SDK which contain this , i want that the our DNS server address programetically using GetNetworkParams
Thanks,
charanjetreport_gi@rediffmail.com
ekodeveloper@yahoo.com
|
|
|
|
|
I'm completely absorbed by my work and very busy, but of course I want to try to help you.
I suppose that as me you are not a native english speaker so I'll rewrite the questions again in order to know if I've understood them well:
1. you want to avoid videoclips and other similar stuff to appear in your control, you've searched the MSDN and you think that the Ambient property will do it, but you don't know how to do it.
2. You use VC++6, and you want to use GetNetworkParams in order to get your DNS server address programatically?
well, tell me if this is true, then I'll try to help you.
Hope you to understand, I'm not a native english speaker.
|
|
|
|
|
Thanks for response,
The question are refined now:-
1.As you know IE or Any browser use HTTP Connection they first download the main page and then links in them , our Internet connection is slow and i want to be be it fast browser so i want that HTML page text content is dowloaded and rendered and stop at that moment as gif's or Jpeg files eat the time to download , i am using IE ctrl in my application to atomate for some purpose, i tried to stop in OnNavigateComplete2WebBrowser but it not work , i found article in MSDN in (Reusing the WebBrowser Control) and found the following section i copied from MSDN
(Download Control:-
Hosts can control certain aspects of downloading, such as frames, images, Java, and so on, by implementing an ambient property defined as DISPID_AMBIENT_DLCTL. When the host'sIDispatch::Invoke method is called with dispidMember set to DISPID_AMBIENT_DLCTL, it should place zero or a combination of the following values in pvarResult...)
2.i am writing direct mailer, so it need MX record finding , that is done if you have you DNS Server address known , i hear that GetNetworkParam works but in online MSDN it is given to include "iphlpapi.h" and this and "iphlpapi.lib" but these i not find in our VC++ 6.0 Enterprise edition library.
3.How to scroll data in CScrolView window greater than 32k lines , i tried by bypassing the Scrollmsgs using hooks,it works but not smoothly , as VC++ binary editor|RichEdit scroll > 32k
i Hope,you have better understanding about my questions now
|
|
|
|
|
Links like this work:
a href='http://www.microsoft.com'>Go to Microsoft
However, when I try a local link like this
a href='index.html'>test
I just get a clean page that says blankindex.html.
I also noticed that when you hover over the test hyperlink the destination says about:blankindex.html.
If I change the link to
a href='file://index.html'>test it simply goes to a completely blank page.
Any thoughts?
|
|
|
|
|
this has nosense... I can only think about a path issue: even if your application is installed in the same directory this gives you no guarantee that this will work, I think.
Hope that helps...
|
|
|
|
|
Let me try to show you what is wrong.
Take your demo project - and change the CHTMLSampleDlg::OnButton1() code to:
// Preparing the HTML page to be shown...
csHTML.Format("<html><body bgcolor=\"7AA1E6\" leftmargin=\"0\" topmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" oncontextmenu=\"return false\"><table width=\"100%%\" bgcolor=\"7AA1E6\" align=\"left\" cellspacing=\"6\"><tr><td bgcolor=\"D6DFF7\" bordercolor=\"#FFFFFF\"><table width=\"100%%\"><tr><td bgcolor=\"#FFFFFF\"><img src=\"rang.png\" width=\"16\" height=\"16\"> Actual value</td></tr><tr><td><font size=\"2\">Now the value is: <b>%i</b>.</font></td></tr></table></td></tr></table><a href=index.html>click here</a></body></html>",
m_iCounter);
You should notice that the only thing I've done here was add a hypertext link to a local file in my project directory called index.html.
I have also made the changes you recommended in the thread "Viewing html pages in CHTMLCtrl???" by updating the OnDocumentComplete and SetNewHTMLContent functions.
When I click on the link - it pops up a blank page with the text "blankindex.html".
If I examine the URL that was actually processed by setting break points, it shows "about:blankindex.html".
Perhaps now you can see what is happening?
I have tried running this on Windows NT, 2000, XP and IE version 5 and 6.
It does the exact same thing no matter what.
If I set the url to "file://c:/pathtofolder/index.html" it works - but that is not going to work in the long run.
Johnny
|
|
|
|
|
There is a function that returns the path of your application, if you don't want to use a predefined full path (I don't understand why, and I don't want to understand it... (Most of the times one has no idea about the motivations of the person who asks so...))
If you want, you can create during the run time of your app the full path by using this function.
Sorry, but I cannot remember it now... but I'm sure that if you ask it into the Visual C++ forum you'll get the answer in five minutes...
Hope this helps...
sorry for the latency answering that, but I'm "overworked"...
|
|
|
|
|
I'm having the same problem and more, when I use IHTMLDocument::Write method, after I can't navigate to a link and I can't get the html text using IHTMLDocument::Read method.
If you have alredy found any solution, please let me know.
Slivinskis
|
|
|
|
|
I used CHtmlCtrl in my application.
When I try to open a ".pdf" or a ".doc" file, I have repaint problems. I.e. if there is another dialog on the CHtmlCtrl, It seems that it doesn't correctly invalidate the rect.
Can anyone help me?
Thx
Popy
-----------------------
popy@popyweb.com
http://www.popyweb.com
|
|
|
|
|
|
Hi, I wrote a program using the control on a win2k machine and it worked like charm, even without the hidden control workaround.
When I built it on a winxp home machine, it crashes at runtime, just when it's trying to create the control, and it dumps me into assembly, so I can't tell where the problem is.
I even tried incorporating the hidden control in the xp build,
but it still crashed.
Any ideas?
BTW, the control is in a modal dialog window, called from a
doc/view style application.
Have no fear of perfection - You will never reach it
|
|
|
|
|
I have already switched back to using the web browser control.
On control creation, I create a temporary html file in the windows temp directory and then I delete it after control destruction.
This enables me to display variable html code "without" having to navigate to a specific file.
Have no fear of perfection - You will never reach it
|
|
|
|
|
I've tested it under win xp pro and it works perfectly... the fact that it don't work under win xp home is possibly due to the fact that some functions used are not accepted in that OS (functions or parameters to functions) you can take a look at it by using the rational purify plus from IBM. This program will tell you what is happening.
|
|
|
|
|
Increase the size of HTML content, it will crash on both OSs.
See my new post in the begining.
Hope helps.
---
Herbert Yu
Are you sure the speed of computer industry is proper? Are you sure the software you released is a bug free one?
|
|
|
|
|
I got some build errors in VS .NET 2003. I thought I'd mention them and the solution in case anyone else sees them. (Strangely, I can build the HtmlCtrl demo project without any build errors, so this will not be a problem for everyone using VS .NET 2003 and CHtmlCtrl.)
HtmlCtrl.cpp(120) : error C2065: 'IHTMLDocument2Ptr' : undeclared identifier<br />
HtmlCtrl.cpp(120) : error C2146: syntax error : missing ';' before identifier 'pHTMLDoc2'<br />
HtmlCtrl.cpp(120) : error C2065: 'pHTMLDoc2' : undeclared identifier<br />
HtmlCtrl.cpp(122) : error C3861: 'pHTMLDoc2': identifier not found, even with argument-dependent lookup<br />
...
I found that by putting "using namespace MSHTML" at the beginning fixed those errors but created an ambiguity error later. A better solution was to put the following at the beginning of the file:
using MSHTML::IHTMLDocument2Ptr;<br />
using MSHTML::IHTMLElementPtr;<br />
using MSHTML::IHTMLElement2Ptr;
------------------------------------------
The ousted but stubbornly non-dead leader reportedly released an audiotape this weekend, ending by calling on Iraqis to, quote, "resist the occupation in any way you can, from writing on walls, to boycotting, to demonstrating and taking up arms." adding, "you know, pretty much anything I used to kill you for." - The Daily Show
|
|
|
|
|
Thank you for your feedback.
I've not been able to test this code under .NET and I won't do until the second quarter of the next year.
So this is a problem that I won't expect... soon I'll try to update the article with your fix and with the question of dom_beau answered also.
Thank you again!
|
|
|
|
|
Hello!
Probably I missed something... I succeeded to run your demo and I succeeded to include such a control in my own software. But I tried to set this html content:
<a href="http://www.microsoft.com">Go to Microsoft</a>
As expected, I saw an hyperlink in the window but when I clicked on it, the page loaded then disappeared.
I did not catch any message or anything else. All the code is in the OnInitDialog. I tried with "navigate()" too but I obtain the same result.
If I did not see the page (even for half a second), I could beleive no communication is possible but I saw the page. So I guess there is a refresh somewhere that redraw my control. Do you know it can be?
Thanks!
DB
Dominique Beauchamp, Ph.D.
|
|
|
|
|
The problem is that in the CHTMLCtrl class there's the function:
void CHTMLCtrl::OnDocumentComplete(LPCTSTR lpszURL) This function sets again the content in order to ensure it is shown... if you doesn't use that function the code that you force to be in your HTMLCtrl won't be shown.
You can place a breakpoint there in order to see the behaviour...
change the OnDocumentComplete function in the CHTMLCtrl class to:
CHtmlView::OnDocumentComplete(lpszURL);
m_bHTMLDocumentLoadedOK = true;
if (m_bForceContent)
{
m_bForceContent = false;
this->SetHTMLInDocument();
} Add this at the end of SetNewHTMLContent function in the same class:
m_bForceContent = true; and declare that variable as global in the definition of the class...
bool m_bForceContent;
this should do the trick for you...
hope this helps...
|
|
|
|
|
Hello Joan!
Thanks, the modifications work fine! I suggest you to include them in your project code.
By the way, I don't see any memory leak when I omit to declare a dummy and hidden CHTMLCtrl, as you suggested in your document. What's up?
DB
Dominique Beauchamp, Ph.D.
|
|
|
|