Rejeesh.T.S wrote:
Can you debug and see why SetIcon(0, 0) fails?
There are 3 versions of SetIcon, one is SetIcon(int, int) and the second is SetIcon(HICON, HICON). I think the compiler links it to SetIcon(int, int) when I wrote SetIcon(NULL, NULL). So I casted it to force it invoke the correct version by SetIcon((HICON)NULL /* second arg has default val */). And it does not crash now. But there is still old residue icon. I just downloaded the demo source of CButtonST v3.9 from CodeProject, and modified the code to make it change icon dynamically. I do not see it have this problem. And I compared the source code of CButtonST between the demo source and my code. They look the same regarding the icon drawing portion. This is so weird ...
Maxwell Chen