Praise be to Allaah.
When we speak of denouncing evil actions with the heart, it refers to two things, when and how.
With regard to when: this is done when the Muslim is unable to take action or speak out against the evil action, but he is aware of the conditions and guidelines of al-amr bi’l-ma’roof wa’n-nahy ‘an al-munkar (enjoining what is good and forbidding what is evil). The basic principle concerning this is the hadeeth narrated by Imaam Muslim in his Saheeh which he attributes to the Prophet (peace and blessings of Allaah be upon him): “Whoever among you sees an evil action, then let him change it with his hand [by taking action]; if he cannot, then with his tongue [by speaking out]; and if he cannot, then with his heart – and that is the weakest of faith.” So this answers the question of when.
As for how: it means that the believer feels in his heart that he hates and detests this evil action, and he wishes that he were able to change it, and feels sad that he is unable to change this evil action. This last point is one of the signs of one's sincerity in denouncing the evil action in one’s heart. The person should also ask Allaah to help him change and eradicate this evil. We ask Allaah to help us and all the believers to develop this blessed attitude. It should also be pointed out that a person may be unable to change an evil action, but he can still keep away from the places where that sin is being committed. Indeed, he has to keep away; it is not enough only to denounce the evil in one's heart. Allaah says (interpretation of the meanings):
“And when you (Muhammad) see those who engage in a false conversation about Our Verses (of the Qur’aan) by mocking at them, stay away from them till they turn to another topic. And if Shaitaan (Satan) causes you to forget, then after the remembrance sit not you in the company of those people who are the Zaalimoon (polytheists and wrongdoers).” (al-An’aam 6:68)
“And it has already been revealed to you in the Book (this Qur’aan) that when you hear the Verses of Allaah being denied and mocked at, then sit not with them, until they engage in a talk other than that; (but if you stayed with them) certainly in that case you would be like them. Surely, Allaah will collect the hypocrites and disbelievers all together in Hell” (al-Nisaa’ 4:140)
May Allaah bless our Prophet and all his family and companions, and grant them peace.