Dialog does not show up after adding rich edit control!

Many of you must have faced this obscure problem, it’s because you haven’t called AfxInitRichEdit/AfxInitRichEdit2() function. Wait! Before you jump onto add this call identify your rich edit control’s class name, if you are working in VC6 then rich edit class name will be RICHEDIT and or if VC7 and above then it will be […]
Continue reading…

 

Reading contents of a file to a vector at one go!

It’s quite easy to read the contents of a file to a vector at one go. For this we need to get the size of a file and ask vector to allocate a buffer to hold these many bytes (use vector::resize()). Here is a function which does this. Note that it’s a byte/char vector. [sourcecode […]
Continue reading…

 

Why am I not receiving LBN_SELCHANGE for a list box?

Recently a colleague of mine asked this question, he added a message map entry for LBN_SELCHANGE but still no notification message arrived and also this list box was dynamically created using CListBox::Create function. The reason was that he missed out a style id while creating this window. LBS_NOTIFY should be specified when creating a list […]
Continue reading…

 

A humble attempt to explain GDI stock objects…

So what are stock objects? “Stock” as the name says means goods in hand, which a shop keeper always has as a backup. In the same way GDI also keep a set of backup of objects which it creates during initialization and these are known as stock objects. Let’s think of a case like this… […]
Continue reading…

 

Changing row height of a list control/CListCtrl

I’ve seen in forums numerous times people asking this query: How to change the row height of list control? Answers vary from , owner drawing to adding a fake image list with tall images. 🙂 Well so I decided to find out a way to do this in a proper way.  So here is a […]
Continue reading…

 

How to make some crt functions like memcpy, memcmp, strcmp etc inline?

In this blog post I’ll be talking about following #pragma compiler directives… #pragma intrinsic #pragma function Ever wondered how to make function calls for memset, memcpy etc inline. It’s quite easy, you can use #pragma intrinsic directive to tell the compiler to inline calls to above functions. Check out this link for a list of […]
Continue reading…