How to access mozzila from c++ code for example it will click button on any webpage ?

How to access mozzila from c++ code for example it will click button on any webpage ?

i dont want mouse clicker i want command. that doesnot depend on resolution or anything else.
You shouldn't try, it's in the wrong layer. You should expect to handle that stuff in Javascript.
You shouldn't try, it's in the wrong layer. You should expect to handle that stuff in Javascript.

I agree with kbw 100% in this use case. But in the interest of posterity the answer to your question would be to use what Mozilla refers to as the 'XPCOM' interface: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM . As you can see from a glance this is not an easy interface to use. Comparatively your operation could probably be accomplished with something as simple as a 'PUSH' command using JS. The only reason I made this post was to explain why you shouldn't try using C\C++ in this case. Although it is possible, it is not an economical use of your time\effort. Always try to use the right tool for the job.
closed account (13bSLyTq)
Hi,

Computergeek01 is correct and I must agree with him!

If you are planning on using C++ it is a lot of work in-deed because of the fact that to be able to access internals of Mozilla you must need to inject code that will internally execute code, and it requires nasty method of hooking function firefox internal functions such as PR_Write() , PR_Read() which not only make the entire procedure of this program much more sophisticated but also then comes the string handlers of the data you gain.

As say we get the following HTML documented from PR_Read() hook-callback:


<html>
<h6>Cplusplus forum has the best programmers in the globe, its worlds best forum.</h6>
<a href="http://www.cplusplus.com" > Visit the best forum</a>
</html>


You must construct an very precise algorithm that will literally scan through all the data acquired and pin-point every link and collect them using few rules such as (very ambiguous, but should give you a gist of how complicated the algorithm may need to be constructed):

1. A website must lie inside the brackets that have "<a href:" inside them
2. To check if the collected result is a website there must be no gaps (no " ") between them
3. A website must be between 2 speech marks
4. ....

As you see these are pretty simple points but I am sure a better algorithm based programmer then myself may come up with far more points that are more accurate and may take more time with the rules but this is a gist of what the algorithm must consist of.

This is only the starting problem you will face even if you manage to clear these issues with persistence, you will need to solve the issue of security software's such as Anti-Viruses and other information security programs from blocking its behavior as only malwares and other security threats tend to perform injections and such into the following product (Mozilla Firefox), so to be honest it just makes the developers life a hell if you use this method and go ahead programming it in C++ or its similar counter-parts.

Now if you plan on applying these I must say you are spending and writing more code than that is needed and will most likely be 10,000% more difficult than handling this procedure in Java Script.

I will wrap this post up by saying is to write this program in something more on its layer just as kbw and Computergeek01 have mentioned as it shall make your project far more easier to maintain and to handle in long-term and of course make your life far more easier as a developer.

Kind Regards,
OrionMaster
Topic archived. No new replies allowed.