I am writing a plugin for Autodesk 3ds Max, a native, Windows-only application. The plugin is written in C++ and uses the raw Win32 API to build its user interface, as 3ds Max plugins are supposed to.
I would like to display an HTML link in the plugin's UI to let the user download a new version of the plugin from the web. The SysLink control seems to do the job.
Here's the difficulty: the colors of 3ds Max's user interface are configurable. I would like my plugin to be a good citizen, so I need the SysLink control to use the same color as other static labels.
Unfortunately, right now the text of the SysLink control is always drawn in blue, which doesn't work so well with the dark color theme of 3ds Max. Moreover, it doesn't look like I can ask 3ds Max for its color palette.
How could I make the SysLink control use the same color as other static labels?
Edit:
This is what syslink control should look like by default:
Note the static part is black (same as static controls). Only the link part is blue. In your case everything is always blue, and background color matches dialog color. Therefore the application has already made custom changes.
If there is normal message handling then the code below should change everything to red:
Use WM_CTLCOLORSTATIC
, but you have to tell the syslink control to accept color change:
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CTLCOLORSTATIC:
{
HDC hdc = (HDC)wp;
SetTextColor(hdc, RGB(255, 0, 0));
SetBkColor(hdc, GetSysColor(COLOR_BTNFACE));
return (LRESULT)GetSysColorBrush(COLOR_BTNFACE);
}
case WM_INITDIALOG:
{
...
LITEM item = { 0 };
item.iLink = 0;
item.mask = LIF_ITEMINDEX | LIF_STATE;
item.state = LIS_DEFAULTCOLORS;
item.stateMask = LIS_DEFAULTCOLORS;
SendMessage(hsyslink, LM_SETITEM, 0, (LPARAM)&item);
...
return TRUE;
}
...
}
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With