The bitmap doesn't display with when using with CStatic control on a CFormView after declaring the manifest to use Windows Common Controls with latest MFC from VS2019 Community Edition

An Nguyen 1 Reputation point
2021-06-15T10:14:39.707+00:00

Hi all,

I encountered an issue which I still doesn't understand why.

I had a CStatic control to display an bitmap on a CFormView. My code works fine if I don't do the declaring with the manifest to use Windows Common Controls.

The issue is that after declaring the manifest, I rebuilt the program. Run it and the bitmap won't display. Somehow it got hidden ??? as I only see a blank CFormView body only.

Anybody hit the same issue before? Please let me know how you got it fixed?

Thank you.
An

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,683 questions
{count} votes

1 answer

Sort by: Most helpful
  1. An Nguyen 1 Reputation point
    2021-06-15T10:27:42.583+00:00

    Thank you for the answer.

    I declared it in the stdafx.h as the snippet below

    //- Declare the appropriate manifest to use Windows Common Controls
    #if defined _M_IX86
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
    #elif defined _M_IA64
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
    #elif defined _M_X64
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
    #else
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
    #endif
    

    Regards,
    An


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.