twitter

Bonafide Ideas Rss

Featured Posts

Microsoft Visual C++ MVP Award for 2013 G’day Community, Firstly, I’d like to wish you all a happy new year 2013, full of health, blessings & success Secondly, I’m happy to announce that Microsoft has awarded me with an MVP (9th consecutive year) in the Visual C++ category, therefore I’d like to thank God, my daughter, my wife (for all of her patience & understanding),...

Read more

Analysing assemblies and finding out possible leaks... Today’s post is about… A command line utility I wrote a few days back for analysing and finding out possible leaks by not disposing of objects properly. Before we get into the nuts and bolts of the utility, please find attached two files which are: MSIL Instruction Set Specification (Required to do any MSIL manipulation) Utility’s...

Read more

CyberNanny: Remote Access via Distributed Components This article is about an application called CyberNanny, which I recently wrote to allow me to remotely see my baby daughter Miranda at home from anywhere at any time. It’s written in Visual C++ (MFC) and it comprises different technologies such as Kinect and its SDK, Windows Azure, Web services and Office automation via Outlook. The project...

Read more

DDD Sydney - Slide deck Hi community, Please feel free to grab the slides I used at DDD Sydney from here Regards,   Angel

Read more

Developer… Developer… Developer Sydney! Hi Community, I would like to invite you all to “Developer… Developer… Developer Sydney”. This event will be held at UTS on Saturday 30th June 2012. I’ll be presenting “Building Windows 8 applications natively with Visual C++”. I look forward to seeing you there. Best Regards, Angel

Read more

Tip of the day–An easy & convenient way to create tabs in an MFC application

Category : C++, MFC, Visual C++

Hi Community,

Today I started to write an MFC application that comprises the Kinect sensor and its SDK, and the idea is to have a single UI with different views, this functionality is provided by the CTabCtrl class (Tab control) – I could’ve accomplish this by creating tabs and setting its properties individually but it’s repetitive code that might grow in the future when a new tab is required, so I came up with a convenient way to do this as shown in the snippet below

void MyKinectAppDlg::CreateTabControl() {

 

    auto nIndex = 0;

 

    auto tabs = std::map<std::wstring, TCITEM>();

 

    tabs.insert(std::pair<std::wstring, TCITEM>(L"Color View", TCITEM()));

 

    tabs.insert(std::pair<std::wstring, TCITEM>(L"Depth View", TCITEM()));

 

    tabs.insert(std::pair<std::wstring, TCITEM>(L"Skeletal View", TCITEM()));

 


 

    std::for_each(tabs.begin(), tabs.end(), [&] (std::pair<std::wstring, TCITEM> tab) {

 

        tab.second.mask = TCIF_TEXT;

 

        tab.second.pszText =  (LPWSTR) tab.first.c_str();

 

        m_streamTabs.InsertItem(nIndex++, &tab.second);

 

    });

 

}

 

 

and the tab control created is

image

Happy coding & happy weekend!

Angel

Post a comment