2
votes

At first adding syslink to my dialog box, prevented it from opening. I was asked to add the following line in my code to display a dialog box with "Syslink" control.

#pragma comment(linker,"\"/manifestdependency:type='win32'\name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

It worked fine when I added this line to my VS project. What does this line of code imply ?

Secondly, when i added the same code for the dialog box and syslink control in another project's .rc file and resource.h file and when I compiled it using make file, I encountered the same problem. However this time I have added the #pragma comment line. ( FYI - If I remove the syslink control from the rc file, the dialog box works fine ). What could be the problem ?

3

3 Answers

2
votes

The pragma causes a Microsoft library to be linked into your program. To use these "common controls 6" you also need a call to InitCommonControlsEx during program startup.

1
votes

@ScottMcP-MVP Thanks for your response.

Actually I solved the second problem. "/ALLOWISOLATION:NO" was set as a linker option in my makefile, which built the object file and binaries as if there was no manifest file. So the "# pragma comment" directive which modified the manifest had no effect when compiled from makefile. When I removed that linker option everything worked fine even without calling "InitCommonControls"

According to my understanding, the specified "# pragma directive" adds a comment in the object file to link the common controls library and it also adds an entry in the manifest file to link the common controls library only if it's version is 6 or above. ( Since syslink is defined only from version 6 )

Please correct me if I'm wrong.

1
votes

This fixes the SYSLink control

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' "\    
"version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 

you noticed adding a SYSLink looks good in Dialog form editor but when running your actual application it would load up a dialog thats completely blank all controls missing etc.. some say it doesn't load up the dialog at all.. Well this is the only way to fix it.

It fails because it requires unicode text support which isn't loaded by default it's located in Comctl32.dll file version 6.

All the new functionality defined in ComCtl32.dll version 6 supports only Unicode. Therefore, you cannot create ANSI versions of SysLink controls, only Unicode versions.