What is "Kol Zeh"?
Rashi: What is mentioned above.
Metzudas David: What is said below - all Ma'asim Tachas ha'Shamesh (in this world).
How did Shlomo see this?
Rav Sadya Gaon: He contemplated.
Seforno: Via experience.
What did he put to his heart?
Rashi: Also all deeds of man.
Seforno: Actions that appear good, or not bad, and in the end they cause great ruin.
What is the meaning of "Es Asher Shalat ha'Adam b'Adam l'Ra Lo"?
Rav Sadya Gaon, Ibn Ezra: He ruled over his colleague to harm him. This is tied to "Ki l'Chol Chefetz Es Mishpat" (6).
Rashi: It is when a man overpowers a colleague, and in the end it is bad [for the former]. Amalek overpowered Yisrael 1 , "v'Achariso Adei Oved" (Bamidbar 24:20). The same applies to Pharaoh, Nebuchadnetzar and Sancheriv.
Rashbam: When a man rules over himself to do evil deeds, when he will be judged for them, they will be evil for him.
Ri Kara: When one sees that he is succeeding, and he overpowers his colleague, he extorts, robs and pursues him. He thinks that there is no judgment or judge. He does not put to his heart that this is for his own evil - Hashem will seek [to avenge] the shame of the pursued (3:15).
Seforno: Power seems to be surely good, but sometimes it brings sin on the one who has power, like occurred to Egypt when they ruled over Yisrael.
Metzudas David: There is a time when one is able to do evil to his colleague, like he desires.
Even though "Yehoshua weakened Amalek", when Moshe's hands descended, Amalek overpowered (Shemos 17:13, 11). Amalek cut off Milos of Yisrael, and cast them up towards Shamayim (Eichah Rabah (3:22). (PF)