Embedding a web browser in app... and getting messages from clicks

Started by
3 comments, last by bishop_pass 22 years, 1 month ago
Aynbody know of any good resources on how to embed a web browser in an application written in C? And then, given that, what would be the most effective way (if possible) to get the click of a button in the custom built webpage being viewed in the embedded browser to fire off a message to the parent app? So let''s say I code an app which is running on your computer. In one panel of the app is a web browser. It is showing a webpage that I built. There are some buttons, links, whatever, on the webpage. When the user clicks on certain buttons, a message is sent to the app, so that it can do something else in another panel which is unrelated to the app. ___________________________________
_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
Advertisement
MSDN is your friend. Look up IWebBrowser2. I don''t know about handling mouse clicks, though.
---visit #directxdev on afternet <- not just for directx, despite the name
I''m not sure if this is the best way, but you could write some sockets coding that will listen for data sent to it at a specified port, and have the buttons simply send data to it.

I''ve written something similar, however, it was more of a remotely controlled type of program. People could connect to my IP and click buttons, which would send data to my listening program, which would then execute them.

If you want to do it this way, you could create a form in your HTML using the action POST. You would probably want to specify the IP "127.0.0.1" because it''s going to be a local webpage, and thus it will send it directly to your IP.

As for embedding a browser content area into your window..I have no idea
Look into CHtmlView if you are using MFC.
I''ve done just what you are talking about.

Basically, use the CHtmlView, as the class that contains the DHMTL.
You can create menu items with java-script in the HTML.
You can also create the buttons, and other gui items in java-script/HTML.

Sending messages back to the C++ code could be done one of two ways.
1) Letting the message not be processed by the HTML, such that eventually, the CHtmlView parent object gets a shot at the message.
2)Or better, create a simple COM/ATL interface that is embeded in the HTML. Then you can use it to talk in either direction.
(Great for real time updates)
I''m not using MFC. I was hoping for some good documentation and a sample C application which creates a browser in an app.


___________________________________

_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.

This topic is closed to new replies.

Advertisement