Code Library

Free Source Code and Program Tips

How to catch the events when you click on the application’s icon on the taskbar?

In the post “How to change the row height of CListCtrl“, it gives 2 solution example how to change row height or CListCtrl. Hower, it is not the simplest way. The simplest way to change the row height in a CListCtrl is: Display an icon with the desired height. All other ways that I know [...]

How to Adding CTreeCtrl in CListCtrl

In some case, you need such a control as the following figure: It’s a CListCtrl like control, but it binds a CTreeCtrl in the first column. But you can also consider it as a CTreeCtrl and each of the items has the list style. All roads lead to Rome. But in 1999, David Lantsman has [...]

How to use an derived CListCtrl in CListView

Sometime you use CListView and need to extend the functionality of the CListCtrl of the view. For example, you want to overwrite the handler function of the NM_CUSTOMDRAW or WM_SIZE message. So the problem is: How to tell CListView to use your own CListCtrl? OK, you are on the wrong way now. The CListView does [...]

How to set the backgroud color of CPropertyPage

How to set the backgroud color of CPropertyPage? If you override OnCtlColor in your property page, then you can return a different background color and that seems to work with CStatic and other items. But what if you want is a background that’s not just a simple color? You’d like to be able to draw [...]

How to select the item of ListView(CListCtrl)

Use CListCtrl::SetItemState with LVIS_SELECTED

Intermittent work in UI thread

Pedro Ferreira I’m trying to create a UI thread to do constant background work, but I’m having some design problems. The thread needs to fetch records from a database. do some processing on each record and, when there are no more records, sleep for 1 minute before check the database again. The process will be [...]

Intermittent work in UI thread

Pedro Ferreira said: I’m trying to create a UI thread to do constant background work, but I’m having some design problems. The thread needs to fetch records from a database. do some processing on each record and, when there are no more records, sleep for 1 minute before check the database again. The process will [...]