Conditional compilation and conditional inclusion of a resource!

Hope you’ve heard of conditional compilation. Conditional compilation simply means what it says, i.e. compile only when a certain condition is true and it’s only meant for the compiler hence it should only take place during compilation. We do conditional compilation with help of preprocessor commands. For eg: [sourcecode language=’cpp’]void WhoIsNibu() {     // 😉 […]
Continue reading…

 

How about tooltips for my controls on a dialog!

Recenty a colleague of mine came up and asked if it’s possible to display tooltips for toolbar buttons and other controls without much difficulty. So I gave him the solution and also decided to post it here for anyone who doesn’t know. When a tooltip text is to be displayed the framework sends a TTN_NEEDTEXT […]
Continue reading…

 

How to make tab control pages transparent while using XP themes?

Having trouble with tab control pages’  gray background while using XP themes? Well to solve this problem we need to do some additional housekeeping(AFAIK)… Add a message map entry for WM_CTLCOLOR… [sourcecode language=’cpp’]BEGIN_MESSAGE_MAP(CTabPage, CDialog)      ON_WM_CTLCOLOR() END_MESSAGE_MAP()[/sourcecode] Override OnCtlColor and add following code… [sourcecode language=’cpp’]HBRUSH CTabPage::OnCtlColor( CDC* pDC_i, CWnd* pWnd_i, UINT uCntrlType_i ) { // First […]
Continue reading…

 

How to get name of owner of a process?

Here is a function that extracts the name of the owner of a process… [sourcecode language=’cpp’]bool ExtractProcessOwner( HANDLE hProcess_i,                           CString& csOwner_o ) {    // Get process token    HANDLE hProcessToken = NULL;    if ( !::OpenProcessToken( hProcess_i, TOKEN_READ, &hProcessToken ) || !hProcessToken )    {       return false;    }    // First get […]
Continue reading…