Hi, I'm trying to create a link like label in a win32 application.
I generally find an API I can use but I'm having no luck with it currently.
Just wondering if anyone has some Ideas? just a starting point will be great.

Appreciate you reading, thanks.

In my VS2010 there's a LinkLabel control in the toolbox. It appears to have been part of .net since 2.0.

That can easily be done with .NET languages such as C# and VB.NET (see this link), but I might be terribly complicated to accomplish the same thing with win32 api functions.

Thanks both, I did it in .net but realised it would be easier to create a gui in win32 rather than mix managed and unmaneged code in .net. I have got half way there, in setting the colour of the text.

SetTextColor((HDC) wParam, RGB(0,0,230));
SetBkMode((HDC) wParam, TRANSPARENT);
return (LRESULT)GetStockObject(NULL_BRUSH);

Now I just need to, change the mouse icon to a hand upon mouse over, and perform a ShellExecute on click.

the linklabel should be managed.

I'm not sure I know what you are hinting at, I am using unmanaged API 's. I don't know how to mix the two.

Anyway, I have almost completeded this, I'm just having trouble loading cursor resource and then changing it back. I have no Idea how to do it.

Can anyone help?

(edit) It's ok I got it (at last) I can get an early night now :)


I know I marked this as solved, but it is not I realized, the code I have for setting color of label string is making all labels that color.

            SetTextColor((HDC)wParam, RGB(0,0,230));
            SetBkMode((HDC) wParam, TRANSPARENT);
            return (LRESULT) GetStockObject(NULL_BRUSH);

That is in my wndproc callback.

Does anyone know how to change just one label?

(edit) Never mind, I found it. sorry if anyone wasted any time.
I had to compare lParam with control handle.

Check the hwnd parameter of winproc to see if it is the label you want.

Thank you Ancient Dragon.