Good news: did it !!
There are just a few lines necessary (Code below).
nsIDOMWindowInternal has functions for Back, Forward, Stop, Home.
Now I have to find solutions for "Reload", "New Window", "Search" and "Favorites"
void GoBack()
{
nsresult res;
nsCOMPtr<nsIWindowMediator> mediator;
nsCID cid = NS_WINDOWMEDIATOR_CID;
nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
nsCOMPtr <nsIDOMWindowInternal> mrw;
nsCOMPtr <nsIDOMWindow> ContentWnd;
mediator = do_GetService(cid, &res);
if (NS_OK != res)
return;
res = mediator->GetMostRecentWindow(nsnull, getter_AddRefs(mrw));
if (mrw)
{
res = mrw->GetContent(getter_AddRefs(ContentWnd));
if (ContentWnd)
{
nsCOMPtr<nsIDOMWindowInternal> wnd(do_QueryInterface(ContentWnd));
wnd->Back();
}
}
}
[EMAIL PROTECTED] (SatHack) wrote in message
news:<[EMAIL PROTECTED]>...
> Hi all,
> my original objective was to implement a GoBack which I can call from
> a process outside mozilla.
>
> So I implemented a component which creates a Windows-Window with a
> unique classname. The WndProc of this window listens for special
> messages and should execute the wished mozilla-functions. So far, so
> good - the component is running, but I'm having some trouble with
> calling GoBack.
>
> I tried it with nsIWindowMediator::GetMostRecentWindow and then a call
> to the nsIDOMWindowInternal::Back which fails (seems to have wrong
> docshell) :-(
>
> After that I debugged nsDocShell::GoBack (breakpoint in it and
> pressing Back-button in mozilla) and found that this was called from
> an eventhandler written in java, probably nsnavigator.js. So I tried
> it with java script (JS_CompileXXX and JS_ExecuteXXX), but I can't get
> the actual document, thus I can't get nsIWebNavigation :-(
>
> Is there any way to get to nsIWebNavigation::GoBack, if you're neither
> the app of the mozilla-plugin nor (the other way around) embedded in
> the actual document ?
>
> Any help very appreciated.
> Thanks