Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am developing BHO for IE with C++ (ATL). Via registry I have added a toolbar button into IE that calls COM dll of mine. However, how could I make it display a message box on button click (not load/unload of addin).
Posted

You need to add a message handler to your button:
<br />
  ON_BN_CLICKED( BUTTON_ID, OnBtnClick )<br />


And, of course a function for that:
<br />
afx_msg void ClassName::OnBtnClick()<br />
{<br />
MessageBox( "Some test text" );<br />
}<br />


I just tried it in my BHO for IE... works fine!
 
Share this answer
 
v2
Add this 2 blocks to your class source file:

<br />
BEGIN_MESSAGE_MAP(YourClassName, YourBaseClass)<br />
ON_BN_CLICKED( BUTTON_ID, OnBtnClick )<br />
END_MESSAGE_MAP()<br />


<br />
afx_msg void YourClassName::OnBtnClick()<br />
{<br />
MessageBox( "Some test text" );<br />
}<br />


Add this line to your class header file:
<br />
afx_msg void OnBtnClick();<br />


That's all... what else do you need? :)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900