Browser extension button not working after first use?

S

Sujoan

Hi,
I have added a button to IE backed by a COM object using C#. Iam
able to achieve the required functionality on the click of the button.
However, I am unable to click the button again, i.e., my toolbar button

gets disabled and grayed out. I have implemented
IOleCommandTarget::QueryStatus implementation method as follows:

public int QueryStatus(ref Guid pguidCmdGroup, int cCmds, IntPtr
prgCmds, IntPtr pCmdText)
{
OLECMD ocmd;
bool temp= true;
ocmd.cmdf=
(UInt32)OLECMDF.OLECMDF_ENABLED|(UInt32)OLECMDF.OLECMDF_SUPPORTED;
Marshal.StructureToPtr(ocmd.cmdf,prgCmds,temp);
return 0;



}


public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdExecOpt,
object[] pvaIn, object[] pvaOut)
{
Speak();//This function works fine;actually the text on the web page

is read out here!
return 0;


}


Since the button is disabled after first use, iam not able to use my
required functionality on navigation to other pages.Please somebody
help me in this regard.
Thanks and Regards,
Sujoan.
 
R

Rob ^_^

Hi Sujoan,

Enable your button AFTER your com object has completed reading the page.

Also when your com object starts you should check for other running
instances. You can only allow a page to be read at one time.

So Pseudo-code

Button Press > Start com > disable button > read page > complete page
reading (maybe look for esc key to cancel reading) > enable button

Regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top