 |
|
 |
Thanks for submitting this very informative and well written article.
Sometimes it's hard to find info on some of Microsoft's controls, this one included, so this article is nice to have.
|
|
|
|
 |
|
 |
Thanks for the code for the print preview. That made my life easier.
Now I have a problem related to a previous questions about scroll bars.
I'm loading the window with an HTML data stream (from an XSLT transformation). The problem I have is it only seems to load the visible part when it comes to scrolling. The scroll bars are not active and if I scroll the window up, the bottom is not filled with the data from the stream. The print preview has the full data, so the document has it. I must be doing some simple thing wrong but I don't know what.
Frank
|
|
|
|
 |
|
 |
If you open it in IE, what can you see in the print preview window? Any scroll bar problem?
Frank
|
|
|
|
 |
|
 |
Stranger and stranger.
The browser doesn't look at a file or website but at string generated from an XML file and an XSLT file. The output is formated as HTML and sent to the browser as a stream.
One odd thing I just saw is that when I do a print or print preview, the output is exactly what I expect. When you asked if the output was ok in IE, I switched that code to do a save as to look at the stream data. What I got is not what was shown in the print. To open the browser, I found I needed to have a document before I could connect it to the stream. I picked the XSLT file because I know it will always be present in the system. What was saved was the XSLT file and not the HTML though the HTML is what is printed????
I have opened a regular HTML file and the scroll still doesn't work.
I have been reading and there seems to be something about Active Containers needing to be told how to scroll. I haven't had a chance to go too deeply into this idea yet.
Frank (the other)
|
|
|
|
 |
|
 |
As an addendum, when you use the cursor to mark text in the window and drag it below the bottom, the window scrolls and displays the text below. If you do a scrollwindow, the window text moves up but the bottom of the text is cut off in mid line and nothing below it appears.
Frank
|
|
|
|
 |
|
 |
In internet explorer, when I hit print preview it is exanpded to full screen.
When I do the print preview here, it is restricted to a percentage of my dialogue size - quite small actually.
What steps can I take to maximise it's position to the screen size so that it is consistent with Internet Explorer behavior?
Andrew
|
|
|
|
 |
|
 |
• When you see the full screen, drag the caption of the window and you will discover what’s under the hood.
• Set the window position and size. Call CWnd::GetWindowRect to get the main window’s size and position; then call CWnd::SetWindowPos to set the preview window’s size and position.
|
|
|
|
 |
|
 |
I am not sure what you are telling me to do.
I added this code which is more of a dodgy fix as I don't like relying on class names:
static CString IE_PPREVIEWCLASS = _T("Internet Explorer_TridentDlgFrame");
void CMyHtmlView::DoPrintPreview()
{
HWND HWND_PP, HWND_FG ;
TCHAR szClassName[256] ;
DWORD t1, t2 ;
ExecWB(OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_PROMPTUSER, NULL, NULL);
HWND_PP = NULL ;
t1 = ::GetTickCount();
t2 = ::GetTickCount(); // Extra line required for 'while' rearrangement.
while (HWND_PP == NULL && t2 - t1 <= 6000) // if found or Timeout reached...
{
HWND_FG = ::GetForegroundWindow(); // Get the ForeGroundWindow
::GetClassName(HWND_FG, szClassName, sizeof(szClassName) );
if (lstrcmp(szClassName, IE_PPREVIEWCLASS) == 0) // Check for Print Preview Dialog
HWND_PP = HWND_FG ;
theApp.PumpMessage();
t2 = ::GetTickCount();
}
if (HWND_PP != NULL)
::ShowWindow(HWND_PP, SW_MAXIMIZE); // maximize the Dialog
}
This seems to work for me. I don't understand how you are telling me to use ::SetWindowPos when I need a handle to the print preview window to begin with, no?
Also, with my fix, it shows maximised (after an initial display at the smaller size) when the user clicks my print preview button. But if they right-click the CHtmlView object and choose Print Preview from there it still shows small size.
Is there a better way to do this?
Andrew
|
|
|
|
 |
|
 |
and, how to do preview with WebBrowser Control when it's a child control?
|
|
|
|
 |
|
 |
The Print Preview window in the WebBrowser Control is designed as a modal dialog box, and we probably cannot change it. When the WebBrowser Control is a child control, the Print Preview modal dialog box will pop-up from the container of the WebBrowser Control.
|
|
|
|
 |
|
 |
When I open a html ,which has a Applet, by the WebBrowser Control (the Control is hosted in a Dialog-based Application ) ,I got some error
("Free block 0x**** modified after it was freed")
What's the reason ?
colin
|
|
|
|
 |
|
 |
Probably you are freeing memory twice.
Frank
|
|
|
|
 |
|
 |
Thanks for your reply!
I agree with you.But I havn't writen any code relating free memory.
The code is:
//DialogDlg.h
/*CExplorer1 is the file on the WebBrowser Control,it is created by the MFC Wizard when I select to insert a ActiveX Control
*/
CExplorer1 m_browser;
//DialogDlg.cpp
BOOL CDialogDlg::OnInitDialog()
{
...
m_browser.Navigate(
_T("file:///D:/MyProgram/Applet/htmldlg/HtmlDlg/UseHtmlDlg/WelcomeApplet.html"), NULL, NULL, NULL, NULL);
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}
colin
|
|
|
|
 |
|
 |
Hi,
When I run the WBP.exe application, the ZoneAlarm (version 6.0.667.000) firewall says:
1. WBP MFC application is trying to access the trusted zone
Application: WBP.EXE
Destination IP: 127.0.0.1 port 1096
Allow Deny
2. If I choose "Allow" then it asks again :
WBP MFC application is trying to access the trusted zone
Application: WBP.EXE
Destination IP: 213.157.178.1 DNS
Allow Deny
3. If I choose "Allow" then I finally see the
www.codeproject.com web page displayed correctly.
4. But what bothers me much more, is this:
If I close and then run again WBP.exe, then ZoneAlarm tells me that WBP.exe is trying to access the trusted zone on another port(??), like this:
WBP.exe is trying to access the trusted zone
Application: ResizableDialog.exe
Destination IP: 127.0.0.1 port 1132
Why are the TCP/IP ports used by the web browser control seem to change each time I run the application ?
First 1096, then 1132, then 1157 and so on...
What is the Microsoft web browser control
doing on my loopback address ??
The reason must be somewhere inside the internal details of the web browser control. But where ?
Please tell me if, on your computers, you are also noticing this behaviour.
I use the Internet Explorer 6.0 SP1 browser. I have also applied all the security updates/patches from the Microsoft web site. I have no spyware, I can navigate the Internet without any problem of any kind.
Thank you.
Alexandru
|
|
|
|
 |
|
 |
Hello
i am working on a SDI Application derived from the CHtmlView class . I want to add a browser object , like we have in the recent versions of Microsoft Word , under the scrollbar , and works something like NextPage and PreviousPage , i also want to do exctly the same thing .
Can anybody help me with some idea .
Thanks in advance .
can also mail me on --
dhawan_boss@yahoo.com
regards
|
|
|
|
 |
|
 |
1. You need to custom the vertical scroll bar in CHtml class to add buttons you wanted. I am not sure if it was doable because the scroll bar is part of the web browser control, not CView's.
2. There is no page definition in regular html file. That is to say even you created your buttons in the scroll bar, how do you change “pages”? MS Word inserts additional info to the html file. You have to resolve this problem.
|
|
|
|
 |
|
 |
I want to load the webBrowser on a tab control. then I need to use a function ShowWindow(SW_HIDE) but after calling m_wndBrowser.ShowWindow(SW_HIDE); webbrowser object is deleted.. and I can;t see it anymore by calling ShowWindow(SH_SHOW); What should I do.. plz help me
|
|
|
|
 |
|
 |
I too have the same problem !
Did you manage to figure out a solution?
Anyone?!
Thanks
Chris
|
|
|
|
 |
|
 |
Its a bug in microsoft's web browser control.
Instead of using "ShowWindow(SW_HIDE)" use "::ShowWindow(browser.GetSafeHwnd(), SW_HIDE);" where "browser" is your webbrowser control.
For details see: http://support.microsoft.com/kb/q182111/
|
|
|
|
 |
|
|
 |
|
 |
Your Code was well commented, and helped me figure out an issue that has been plaguing me for some time now.
Thanks!
|
|
|
|
 |
|
 |
CHtmlView
How can implement the text box and link the corresponding content of the text box(like Internet Explorer,link connected corresponding textbox content(www.google.com))
|
|
|
|
 |
|
 |
Cheers
"No one can earn a million dollars honestly."
- William Jennings Bryan (1860-1925)
"Make everything as simple as possible, but not simpler."- Albert Einstein (1879-1955)
"It is dangerous to be sincere unless you are also stupid."
- George Bernard Shaw (1856-1950)
|
|
|
|
 |
|
 |
I have a html page in resouce file, how to navigate the Browser control to load it at start up?
wefergrtgrtvrtrt rtrtb brt
|
|
|
|
 |
|
 |
I notice IE has a direct print button in the tool bar. I am trying to implement direct print (no dialog box) on a CHtmlView object. If anyone can help me it would be great!
|
|
|
|
 |