Naked functions!

The compiler generates prolog and epilogue code for functions compiled for do some additional housekeeping for try/catch blocks, maintaining stack frame etc. So what to do to prevent such code generation in MS VC compiler! MSVC compiler provides us with an attribute called __declspec(naked). Use this to prevent code generation by VC compiler. Note that […]
Continue reading…

 

Drawing shadowed text using windows API?

Is there an API to draw shadowed text? Yes there is one in XP, only limitation is that you should be linking Commctrl32.dll version 6 using your manifest file! DrawShadowText is the API that I am talking about! Here is some sample code which does this… [sourcecode language=’cpp’]void CMyDlg::OnPaint() { // Default first CDialog::OnPaint(); CStringW […]
Continue reading…

 

Freeing unused libraries while using COM!

It’s a good practice to free unused COM dlls if it’s not used anymore. So is there a function call which does this? Yes, it’s called CoFreeUnusedLibraries or CoFreeUnusedLibrariesEx! Are the libraries immediately removed from the internal COM dll list, no there is a time delay of 10 minutes for MTAs and neutral apartment models, […]
Continue reading…

 

Seeing array values in the debugger as a list!

VC debuggger has a nice feature to display array values. It works with any contiguous data, for e.g. vector, CArray, native type arrays etc. Follow these steps… IntVector is an array of integers Start quick watch by pressing Shift + F9 with IntVector object selected Select _First(encircled in red) and press Add watch(encircled in red) […]
Continue reading…