Ok, so I'm pretty new to C ++ and the Windows API, and I'm just writing a small application. I wanted my application to use visual styles in XP, Vista, and Windows 7, so I added this line to the top of my code:
#pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
It seemed to work fine on my Windows 7 machine as well as on a Vista machine. But when I tried the application on XP, the application did not load any controls (for example, buttons, labels, etc.) - even messages did not appear.
This image shows a small test application that I just put together to demonstrate what I'm trying to explain: http://img704.imageshack.us/img704/2250/myapp.png
In this test application, I do not use particularly bizarre or complex code. I actually just took the simplest example code from the MSDN library ( http://msdn.microsoft.com/en-us/library/ff381409.aspx ) and added a section to the WM_CREATE message to create a button:
MyBtn = CreateWindow(L"Button", L"My Button", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, 25, 25, 100, 30, hWnd, NULL, hInst, 0);
But I just can’t understand what is happening and why it is not working. Any ideas guys? Thank you for your promotion.
(By the way, the application works in XP, if I delete the manifest section from above - obviously, without visual styles. It might also be worth mentioning that the application was created using Visual C ++ 2010 Express on a computer running Windows 7 - if that matters ?)