Annoying flicker in MFC dialog box

Started by Mark25, June 14, 2015, 12:00:37 PM

Previous topic - Next topic

Mark25

Good day,

we're developing a dialog based MFC application using Visual Studio 2010. When "3D Active Button Magic" ActiveX buttons are inserted inside the dialog, at run-time they seem to flicker in an annoying way: is there a way to avoid this?

Cheers

Mark

Administrator

Hello Mark,

this is a known issue caused by a problem inside the Windows manifest added by default inside the stdafx.h file; lines causing the issue are beginning with the following code:


#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' .... etc.


in case you shouldn't be interested in using 3D controls created by the Windows manifest, you may simply comment out these lines.
In case you would prefer keeping Windows manifest controls, you may use an undocumented feature of "3D Active Button Magic" which allows eliminating the issue.
Assuming that you have a dialog box whose code is implemented inside a MyAppDlg.cpp file, you simply need to invoke the following lines of code inside the MyAppDlg::OnInitDialog function:


CBtnEnh *pBtn = (CBtnEnh *) GetDlgItem (IDC_3DBUTTON1);
pBtn->SetNSContainerColor (-4);

This undocumented method can be invoked by one single instance of the control (in this case identified by the IDC_3DBUTTON1 identifier) so, in case you should have more 3D buttons in your application, you will only need to invoke it once at the beginning of the application's life.

Kind Regards

Severino Delaurenti
MultiMedia Soft