CHtmlView and OnChar

I created an  SDI app with CHtmlView as my view class, but cannot recieve 
WM_CHAR messages, or any keyboard or mouse messages for that matter. I tried 
routing them thru both the View and Main Frame class but it still doesn't 
work.  Could someone please tell me if there is a way to use these messages 
with CHtmlView.

Thanks in advance. 


0
2/25/2005 12:34:21 AM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
801 Views

Similar Articles

[PageSpeed] 39

Trap WM_CHAR in PreTranslate method.

0
2/25/2005 4:29:07 AM
This particuler ActiveX control that is hosted in CHTMLView does not work as
you expect with PreTranslateMessage or trapping WM_CHAR etc. There are
couple of ways to do this. One is to automate the control and listen to
specific events like htmlelement clicked etc or subclass a specific window
which allows this. Paul Dilascia showed the second technique in MSDN/MSJ
some time ago to trap the right click. You can either google the newsgroup
or search MSDN for that particular article.

--
Ajay Kalra [MVP - VC++]
ajaykalra@yahoo.com


"abe froman" <cracker1234@optonline.net> wrote in message
news:rsuTd.4363$Kf4.2297@fe09.lga...
> I created an  SDI app with CHtmlView as my view class, but cannot recieve
> WM_CHAR messages, or any keyboard or mouse messages for that matter. I
tried
> routing them thru both the View and Main Frame class but it still doesn't
> work.  Could someone please tell me if there is a way to use these
messages
> with CHtmlView.
>
> Thanks in advance.
>
>


0
ajaykalra (6842)
2/26/2005 3:41:29 AM
Ajay,

How to listen to htmlelement clicked event ?
Are there any article for that ?

Thanks

Mike J


"Ajay Kalra" <ajaykalra@yahoo.com> wrote in message 
news:uECAOU7GFHA.4084@TK2MSFTNGP14.phx.gbl...
> This particuler ActiveX control that is hosted in CHTMLView does not work 
> as
> you expect with PreTranslateMessage or trapping WM_CHAR etc. There are
> couple of ways to do this. One is to automate the control and listen to
> specific events like htmlelement clicked etc or subclass a specific window
> which allows this. Paul Dilascia showed the second technique in MSDN/MSJ
> some time ago to trap the right click. You can either google the newsgroup
> or search MSDN for that particular article.
>
> --
> Ajay Kalra [MVP - VC++]
> ajaykalra@yahoo.com
>
>
> "abe froman" <cracker1234@optonline.net> wrote in message
> news:rsuTd.4363$Kf4.2297@fe09.lga...
>> I created an  SDI app with CHtmlView as my view class, but cannot recieve
>> WM_CHAR messages, or any keyboard or mouse messages for that matter. I
> tried
>> routing them thru both the View and Main Frame class but it still doesn't
>> work.  Could someone please tell me if there is a way to use these
> messages
>> with CHtmlView.
>>
>> Thanks in advance.
>>
>>
>
> 


0
Mike
3/2/2005 9:03:08 AM
You can search the usual at codeguru and codeproject. Essentially you are
automating IWebBrowser2 (this is embedded in CHTMLView). The book by Scott
Roberts about IE5 programming describes the object model and its usage in
MFC/ATL very well.

--
Ajay Kalra [MVP - VC++]
ajaykalra@yahoo.com


"Mike J" <cannotbeanywhere(at)hotmail.com> wrote in message
news:#ZKKsawHFHA.896@TK2MSFTNGP10.phx.gbl...
> Ajay,
>
> How to listen to htmlelement clicked event ?
> Are there any article for that ?
>
> Thanks
>
> Mike J
>
>
> "Ajay Kalra" <ajaykalra@yahoo.com> wrote in message
> news:uECAOU7GFHA.4084@TK2MSFTNGP14.phx.gbl...
> > This particuler ActiveX control that is hosted in CHTMLView does not
work
> > as
> > you expect with PreTranslateMessage or trapping WM_CHAR etc. There are
> > couple of ways to do this. One is to automate the control and listen to
> > specific events like htmlelement clicked etc or subclass a specific
window
> > which allows this. Paul Dilascia showed the second technique in MSDN/MSJ
> > some time ago to trap the right click. You can either google the
newsgroup
> > or search MSDN for that particular article.
> >
> > --
> > Ajay Kalra [MVP - VC++]
> > ajaykalra@yahoo.com
> >
> >
> > "abe froman" <cracker1234@optonline.net> wrote in message
> > news:rsuTd.4363$Kf4.2297@fe09.lga...
> >> I created an  SDI app with CHtmlView as my view class, but cannot
recieve
> >> WM_CHAR messages, or any keyboard or mouse messages for that matter. I
> > tried
> >> routing them thru both the View and Main Frame class but it still
doesn't
> >> work.  Could someone please tell me if there is a way to use these
> > messages
> >> with CHtmlView.
> >>
> >> Thanks in advance.
> >>
> >>
> >
> >
>
>


0
ajaykalra (6842)
3/2/2005 11:26:25 AM
Reply:

Similar Artilces:

CHtmlView and OnChar
I created an SDI app with CHtmlView as my view class, but cannot recieve WM_CHAR messages, or any keyboard or mouse messages for that matter. I tried routing them thru both the View and Main Frame class but it still doesn't work. Could someone please tell me if there is a way to use these messages with CHtmlView. Thanks in advance. Trap WM_CHAR in PreTranslate method. This particuler ActiveX control that is hosted in CHTMLView does not work as you expect with PreTranslateMessage or trapping WM_CHAR etc. There are couple of ways to do this. One is to automate the control and li...

CHtmlView
We have a CHtmlView with two fames in a MFC application. <html> <frameset cols="30%,70%"> <frame name="menu" ...> <frame name="detail" ...> </frameset> </html> on the menu frame there are some links. when you click the link, we use Navigate2() to request a .jsp page and put it in the detail frame. I know CHtmlView::GetReadyState()==READYSTATE_COMPLETE means the view is at ready state. I want to know when the detail frame is ready. I tried GetReadyState(). It didn't work. It always return me READYSTATE_COMPLETE ...

Painting of CHtmlView !!!
Hello All I am showing dialog when clicked on link of HTML page navigated inside CHtmlView. After closing dialog, the browser( CHtmlView ) does not paint itself properly. I did everything to solve this problem including Send Paint message, InvalidateRect, WM_ERASEBKGND, UpdateWindow and RedrawWindow. But all solutions did not help me. So MFC Gurus, Please help me to solve this problem of painting of CHtmlView. ...

CHTMLView help needed
I have a CHTMLView and I want to save the output from it as a bitmap (or some other image type) file. Does anyone know how to render the content of the view to an image file (IE5.5 and up)? The normal standard Windows GDI based approach doesn't seem to work because it only gets the area of the view that is visible and includes the view's scroll bars in the output. Is there away to get cleaner output rendered to an impage file that doesn't have the scroll bars and shows the whole content, not just what is currently visible onscreen? ---------------------------- I know one of you ...

Problems with CHtmlView
My application uses the CHtmlView control in order to show html pages and to navigate within different pages. Those pages have internal calls (using the APP protocol) that the main application processes in order to show new pages (in the BeforeNavigate2 function). To show each page, the application writes the html code into a temporary file and calls the Navigate2 function with the temporary file name. The application works correctly but I have two problems that I don't know how to solve: 1. Some html pages contain a flash movie that calls a JavaScript function that calls my applicatio...

How to force CHtmlView refress()?
Hi, I have to use CHtmlView for browsing the html page with dialog. I have tow dialogs: First dialogs view the html page with the images, when I click on one image, this will popup up second dialog(a new dialog) to list details about this image, I have some processing with the second dialog, when it finished I will close the dialog and go to first dialog again, before (or also for after) I close the second dialog I do refresh for with the page on first dialog by calling m_myHtmlControl.refresh() or also for m_myHtmlControl.refresh2(3,NULL,NULL.NULL) ; But this cause system error. How...

CHtmlView bug ?
Hi, I created a simple MDI application, using CHtmlView as the view class. I guess I found a problem. When I open an Excel file inside the view, I see an Excel.exe is running, using task manager. But after I close that view, the Excel.exe is still running until the whole application is closed. Is there some way to fix the bug ? Or it's not a bug ? Thanks in advance Jeff ...

sample chtmlview
I'm looking for a sample using CHtmlView, where the application hosting the view needs to access the DHTML elements (specifically I'm trying to create an MRU kind of like VS.NET does). I've found lots of posts from helpful people saying "just get a pointer to IHTMLDocument2", but I'm too new at this, I could really use some samples! Thanks in advance. Nate Hekman ...

About CHtmlView
Somthing about CHtmlView, using CHtmlView class as a browser in my application, but doesn't have auto complete feature for edit controls that appears inside web page like Internet Explorer. Would like to enable this feature. As well as how can I enable feature by which it could use cookies of Internet Explorer. You can do that implementing the IDocHostUIHandler interface and its GetHostInfo method by setting the dwFlags to a value that contains the DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE flag. See MSDN Article Q236312, "HOWTO: Disable the Default Pop-up Menu for CHtmlView&quo...

Change Data of CHtmlView
Hello! I created a new SDI programme in vc++ 2003, which acts as a little browser. Works fine. Additionally I generate HTML dynamically which I want to send to my CHtmlView. For example <html> <body><b>Hi USER</b></body> </html> The whole html document must be sent, also the head, but I couldn't find any good solution. I have found nothing useful in google groups, etc Do you have a piece of code for me which can help me. By the way: Where can I dump the whole html-data into a file? ;-) Thanks a lot! Maybe this would be useful: http://www.codegur...

CHtmlView again.
Although I call again Navigate2, why the OnDocumentComplete was called at the 1st time? how to set OnDocumentComplete is called for every Navigate2 called? thx again. ...

CHtmlView F5
Hi, how to do the action with code like I press the F5 button to refresh to page? <pixelmana> wrote in message news:ev1Hu$KdDHA.2804@TK2MSFTNGP11.phx.gbl... > Hi, how to do the action with code like I press the F5 button to refresh to > page? Try this: start by adding the F5 key to the apps accelerator table, use the ClassWizard to add a handler for the F5 accelerator command in the CHtmlView, handle the F5 accelerator command by calling either CHtmlView::Refresh or CHtmlView::Refresh2. Jeff... ...

How to print a CHtmlView?
How to print a CHtmlView? Please send a sample code. Thank you. Check this link http://www.codeproject.com/printing/printformview.asp Jibesh.. -- ------------------------------------------------------------------------- FIGHT BACK AGAINST SPAM! Download Spam Inspector, the Award Winning Anti-Spam Filter http://mail.giantcompany.com "Renato Tegon Forti" <renato@dynamic-e.net> wrote in message news:OY%232riUnDHA.1676@TK2MSFTNGP09.phx.gbl... > How to print a CHtmlView? > > Please send a sample code. > > Thank you. > > ...

CHtmlView zoom in/out images
I am using CHtmlView.Navigate2 to to use the web viewer features inside of my application. This way I can have a simple viewer. This it is working but some browser features are not available, for example I want zoom in/out images. Directly in browser this works well but when from my application show the image but it is not possible zoom in/out the image. It is possible enable these features? Thanks & Regards, Rui ...

CHtmlView and MK_XBUTTON1
I have a working html control and would like to capture mouse clicks. Implementing OnMouseActivate gives me this information for left and right clicks. However, the messages for the buttons MK_XBUTTON1 and MK_XBUTTON2 (from a 5-button mouse) are both given the same message (523) and I don't know how to distinguish them. Any ideas? Thank you all. "Alexander" <the44secs@yahoo.com> ha scritto nel messaggio news:bf665da5-ed00-40eb-becb-089f9420ff17@v1g2000pra.googlegroups.com... >I have a working html control and would like to capture mouse clicks. > Implementing OnMo...

frames and CHtmlView
Hello, I managed to get the body of the HTML-Document. But how can I get the body of the frames if frames exist? Example <html> <frameset cols="... <frame src="./top.html"> I want to get the content of top.html and re-set it. Do you have some hints? Please, Thanks, Karsten Query IWebBrowser2 from the frame element. "Karsten Jung" <kenduron@web.de> ???? news:1134132331.411140.144780@g49g2000cwa.googlegroups.com... > Hello, > > I managed to get the body of the HTML-Document. > > But how can I get the body of the frames if fr...

chtmlview and xml
Hi, From withing a CHtmlView If I navigate to an xml file everything is fine, it reads the xsl file from within the xml if I use IPersistStreamInit to read the same xml info from memory it doesn't use the xsl inside. is it me that are doing wrong or is it so that I can't use IPersistStreamInit with xml? thanks /Niklas Hello Niklas, Thanks for your post. I'd like to share the following information with you: As you know, .xsl is a style sheet which describes how to present an XML file in browser. When we loading an xml file in CHtmlView, it will not only parse the xml conten...

Events from CHtmlView
If a browser control CHtmlView is embeded in an MFC application, is it possible for the MFC application to get events (e.g., a button click on the HTML page) and other form information from the HTML page ? Vinodh I am not sure about CHtmlView. But this can be done on CHTMLDialog using DECLARE_DHTML_EVENT_MAP. Check the Documentation The other way is a do it the painfull way where you can get the IHTMLDocument object from the webbrowser and search for the individual elements and advise for them for all the events you want. -- ------------------------------ Ashok K Kumar -----------------...

Error or Me in CHtmlView
Okay I don't think I could have possibly done anything wrong... All I did was use MFC AppWizard to create a CHtmlView program skeleton. I run the program, and of course it opens smoothly. Yet, whenever I close it, I get a 0xC0000005 (access violation). I've found the problem in stdcore.cpp (an uneditable file since it's basically the code for an already compiled DLL -- I think). So exactly what's the problem? I don't think Microsoft could have created such a huge flaw. Is it just me? -- Matt ...

CHTMLView and frames
'ello Can sombody please tell me how to prevent the CHtmlView from opening a new window if the target frame does not exist. (Just open the page as if there was no target specified) Thanx Hein I'm not really sure what you want here? Is removing the Navigate2 call from the OnInitialUpdate function in the view what you need? -- Frank "Hein Albrecht" <heina@magnumsimplex.com> wrote in message news:u2Gkf5QAEHA.3672@TK2MSFTNGP11.phx.gbl... > 'ello > > Can sombody please tell me how to prevent the CHtmlView from opening a new > window if the target fra...

CHTMLView why do you torture me!?
I posted a while back and got no answer. Sorry to repost but I'm just hoping somebody out there knows the answer and didn't see my question before. I want to save the IE browser's output to an image file (probably a DIB). I have tried but only get things that depend on the view: for example if the view size is too small so that there are scroll bars and part of the content is not visible that's what I get in the image file including even the scroll bars. I don't want that, I want a clean image of the content of the control, not clipped or including scroll bars, etc. I ...

CHtmlView #3
Hi I want to use CHtmlView in my app to show dynamically created html content. But I dont need doc/view architecture. I created SDI application without doc/view support and with ActiveX controls enabled. Then I replaced wizard generated view class with folowing class: class CMyView : public CHtmlView { public: CMyView (){} protected: virtual void OnInitialUpdate(); DECLARE_MESSAGE_MAP() }; BEGIN_MESSAGE_MAP(CMyView , CHtmlView) END_MESSAGE_MAP() void CMyView::OnInitialUpdate() { CHtmlView::OnInitialUpdate(); Navigate(L"about:<body>sample text</body>"); } in ...

Need a Position in CHtmlView
Hello. I need to get a position of tag in Chtmlview. I found 'AbsolutePosition' in CWebBrowser2, but I don't know to use it. Please help me. Thanks. try IHTMLElement::ScrollLeft. to access an element, take a look at the source code of CDHtmlDialog::GetElement "Sohn Jae Hwa" <user119@korea.com> д���ʼ� news:dhjcq0$pkk$1@inn1.bora.net... > Hello. > > I need to get a position of tag in Chtmlview. > I found 'AbsolutePosition' in CWebBrowser2, but I don't know to use it. > > Please help me. > Thanks. > > > ...

Searching inside a CHtmlView?
Is there a way to do this? could someone point me to the right direction otherwise. I don't see any Find methods for this class thanks Use IWebBrowser2's object model and iterate over all IHTMLElements and then you can find what you want. I think AliR will provide you with the code shortly. --- Ajay Hi Kourosh, Do you want to do the search yourself, or do you want CHtmlView to do it for you? This code will bring up the IWebBrowser2 find window. void CMyHtmlView::OnEditFind() { UUID Uuid; CString GUID1 = ("ED016940-BD5B-11CF-BA4E-00C04FD70816"); UuidFromStri...

CHtmlView::Stop
I have a mfc app with CHtmlView. I am trying to implement a stop button on the frame. I used CHtmlView::Stop. It works OK for a simple page. Now I have a page with two frames. <frameset cols="30%,70%"> <frame name="menu" ...> <frame name="detail" ...> </frameset> when you click the links on the menu, a request will be sent to a jsp page to build a report to the detail page. in this case, CHtmlView::Stop() doesn't work. My question is how to stop page loading on the detail frame (the second column of the html page). Right ...