question

AnNguyen-6986 avatar image
0 Votes"
AnNguyen-6986 asked DavidLowndes-6766 commented

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

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++
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello, how and where do you declare the manifest?
Regards, Guido

0 Votes 0 ·

How are you having the bitmap displayed on the static control?
Do you have any code involved, and if so, does anything return a failure when you debug it?

0 Votes 0 ·

Thank you for the reply.

The CStatic control declared in the resources with BITMAP type and then simply loads in bitmap from the resource into it.

My program works fine if I don't use the manifest declaration. It only hit the strange issue once I use the declaration. The debug shows no failure.

0 Votes 0 ·

OK, does the version of your program with the manifest have the bitmap in its resources the same as the version without the manifest? You can open the EXE in VS to check that the resources are there.

Have you tried with a different (simpler) bitmap image to see if that makes any difference?

If you try to load the bitmap resource using LoadBitmap, or LoadImage, does that succeed?

0 Votes 0 ·

1 Answer

AnNguyen-6986 avatar image
0 Votes"
AnNguyen-6986 answered AnNguyen-6986 commented

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


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Which linker define is active? In my apps it's _M_X64.
I don't see a problem with the manifest. The problem must arise from the bitmap or CStatic. Have you tried DavidLowndes suggestions?

0 Votes 0 ·

I replied the thread above.

Thanks for your help.

0 Votes 0 ·