A round dialog box!

Ever wondered how those cute little round dialog boxes are created. I too wondered for some time. But let me tell you it is easy, take a look: Do this from OnInitDialog! [sourcecode language=’cpp’]//Create a region object globally. CRgn m_EllipticRegion; //a rect object CRect crDialogRect; //get your dialog size this->GetClientRect(crDialogRect); //Now create the elliptic region […]
Continue reading…

 

What happens before and after OnInitDialog!

Two functions to look up would be… _AfxPreInitDialog _AfxPostInitDialog As the name suggests _AfxPreInitDialog gets called before OnInitDialog is called and _AfxPostInitDialog gets called after OnInitDialog. One of the things that happens in _AfxPostInitDialog is centering of a dialog if user hasn’t changed position of the dialog in OnInitDialog, so how is this done? _AfxPreInitDialog […]
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…

 

Creating a dialog from it’s template!

Here is a sample on how to do it… [sourcecode language=’cpp’]CDialogTemplate dlgTemplate; // Load dialog template into memory dlgTemplate.Load( MAKEINTRESOURCE( IDD_DIALOG_ID )); // Change font of dialog dlgTempl.SetFont( _T( “Courier” ), 10 ); // Creates and displays a modal dialog from a template in memory CDialog dlg; dlg.InitModalIndirect( dlgTemplate.m_hTemplate, 0 ); dlg.DoModal();[/sourcecode] What’s the use […]
Continue reading…