MozillaZine

Navigate opened Firefox browser like IE in C#.net

Discuss building things with or for the Mozilla Platform.
yoyo2003
 
Posts: 1
Joined: July 2nd, 2008, 5:54 am

Post Posted July 2nd, 2008, 2:02 pm

Hi,

I am New to mozilla firefox. I have done an app that finds an opened IE browser and navigate the browser to an URL.

[DllImport("user32.dll", SetLastError = true)]
public static extern int FindWindow(
string lpClassName, // class name
string lpWindowName // window name
);
public void Navigate2URL(string strIEName, string strUrl){
int iHandle = FindWindow("IEFrame", strIEName);
SHDocVw.ShellWindows SWs = new SHDocVw.ShellWindows();
SHDocVw.InternetExplorer IE = null;

for (int i = 0; i < SWs.Count; i++)
{
IE = (SHDocVw.InternetExplorer)SWs.Item(i);
if (IE.HWND == iHandle)
{
object o = null;
IE.Navigate2(strUrl, ref o, ref o, ref o,ref o);
}
}
}

But the requirement has been changed: the client wants to use firefox. Is there any way to reference an opened firefox browser and access it? "IWebBrowser2.Navigate2(strUrl, ref o, ref o, ref o,ref o);"?

jayfox911
 
Posts: 4
Joined: November 20th, 2008, 12:43 pm

Post Posted November 20th, 2008, 12:44 pm

I am trying to do the same thing. Have you found out a way to do this?

Thanks,
Jason

Philip Chee

User avatar
 
Posts: 6475
Joined: March 1st, 2005, 3:03 pm

Post Posted November 21st, 2008, 8:22 am


jayfox911
 
Posts: 4
Joined: November 20th, 2008, 12:43 pm

Post Posted November 25th, 2008, 12:23 pm

Phil,

thanks for the idea, however the plan is to display the page rendered by mozilla not just open the page in an external app.

An example of using the Mozilla DLL or API in Visual Studio to display the URL in a GUI.

Jason

jayfox911
 
Posts: 4
Joined: November 20th, 2008, 12:43 pm

Post Posted November 25th, 2008, 1:21 pm

i think i found what i was looking for ...

1) download the dll files http://www.iol.ie/~locka/mozilla/MozillaControl171.exe

2) register the dll C:\Program Files\Mozilla ActiveX Control v1.7.1>Regsvr32 mozctlx.dll
http://www.iol.ie/~locka/mozilla/troubleshooting.htm

3) reference COM in VS

4) create and use
private MOZILLACONTROLLib.MozillaBrowser mozBrowser;
mozBrowser = new MOZILLACONTROLLib.MozillaBrowser();
mozBrowser.Navigate(url, ref o, ref o, ref o, ref o);

trolly
Moderator

User avatar
 
Posts: 39908
Joined: August 22nd, 2005, 7:25 am

Post Posted November 25th, 2008, 1:42 pm

This seems to be part of the Mozilla ActiveX project which was terminated about 4 years ago. There is no version which can be used with FF 2 or FF3.
I think there is no way to do it because Firefox is neither scriptable nor embedable.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.

jayfox911
 
Posts: 4
Joined: November 20th, 2008, 12:43 pm

Post Posted November 26th, 2008, 12:32 pm

I was getting this error...Browser is not in a valid state
at MOZILLACONTROLLib.IWebBrowser2.Navigate(String URL, Object& Flags,
Object& TargetFrameName, Object& PostData, Object& Headers)

it was due to it not being Initialized. ((System.ComponentModel.ISupportInitialize)(this.axMozillaBrowser1)).BeginInit();

by using the gui view to add it to the project.

here is how.

1) register the dll, http://www.iol.ie/~locka/mozilla/control.htm
C:\Program Files\Mozilla ActiveX Control v1.7.12> regsvr32 mozctlx.dll

2) make the ActiveX version of the dll
C:\Program Files\Mozilla ActiveX Control v1.7.12>"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\aximp" mozctl.dll

3) add the reference to your project by right clicking on "References" then select "Add reference"

4) add the MozillaBrowser Class to the toolbox, right click on toolbox and select "choose items..."

5) drag and drop the MozillaBrowser Class from the toolbox on your gui

this is what that does for us that i was missing by hand coding it: ((System.ComponentModel.ISupportInitialize)(this.axMozillaBrowser1)).BeginInit();

i am coding in c#

LIMPET235
Moderator

User avatar
 
Posts: 39183
Joined: October 19th, 2007, 1:53 am
Location: The South Coast of N.S.W. Oz.

Post Posted March 26th, 2013, 3:29 am

Jay C, This is an old thread so I split your request off.
Your post is now here > viewtopic.php?f=27&t=2684027

Locking this relic.
Ancient Amateur Astronomer
Win-7-HP/IntelĀ® DualCore-2.0GHz/500G HDD/4 Gig Ram/550Watt PSU/350WattUPS/Firefox-20.0-62.0-70.0/T-bird-2.0.0.24/SnagIt-v10.0.1/MWP-7.12.
W.M.Y.C.
(Always choose the "Custom" Install.)

Return to Mozilla Development


Who is online

Users browsing this forum: No registered users and 3 guests