C++: Dialogs with SysLink control do not show up

For some strange reason, adding a SysLink control onto the dialog during design time would cause DialogBox() to fail with -1.

There are a whole bunch of advice online to get it working, but all of them involve some tinkering with project files and the inclusion of ridiculously cryptic manifest files.

The main reason the Syslink causes the DialogBox() command to fail is because it requires unicode text support, starting from ComCtl32.dll 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.

To get it working (without messsing with project properties and manifest ugly files, include this line into a project header file.

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

Note: This only works with Visual Studio 2005 and onwards.

But don't get comfy with your success, you still have another major puzzle to solve...

Can you ever figure out... JAPAN? Seriously, wtf?

To handle the link click event, see this post.

[ Syslink Control Overview, Enabling Visual Styles ]

Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog