Prev: maximum line number of ini file, using ::GetPrivateProfileString
Next: Middle Click in Task bar : How to get Application's process onwhich click is done
From: Thomas Steinbach on 3 Dec 2008 05:26 Hello NG, does anybody knows how to get this Syslink Control within the CommonControls 6 running? I used the examples at http://msdn.microsoft.com/en-us/library/bb760706(VS.85).aspx generating a dynamic CommonControl adapting the given sourcecode on this msdn site and I tried to use the Syslink Control using VS2008. First I added a manifest file to my app and the CommonControls initialize well. (The syslink created by VS2008 and the dynamic Syslink, apears in the AboutBox. Actually I get this WM_NOTIFY (WN_CLICK,WN_ENTER) event, but could not get the given Url in the Structure item (see source below) Additional I tried using just a simple static textcontrol and this would work fine for me, but the Style doesn't look like a weblink. If somebody know how to modify a static textcontrols text to color blue and underline and how to get the Hand if a user move over the link, it would be good if he give me some tips (links?), how to do this. I think this would be the best way. Cause it would work with cc prior to version 6.0 (dynamic syslink, SyslinkControl and clickable static textcontrol) ---snip--- INT_PTR CALLBACK DlgAboutProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { int wmId = 0; int wmEvent = 0; HWND g_hLink; PNMLINK pNMLink; LITEM item; switch( uMsg ) { case WM_INITDIALOG: g_hLink = CreateWindowEx(0, (LPCSTR)WC_LINK, "Just <A HREF=\"http://www.google.de\">click here</A> ", WS_VISIBLE|WS_CHILD|WS_TABSTOP, 42,55,114,8, hWnd, 0, GetModuleHandle(0), NULL); return (INT_PTR)TRUE; /* WM_INITDIALOG */ case WM_NOTIFY: switch( ((LPNMHDR)lParam)->code ) { case NM_CLICK: case NM_RETURN: pNMLink = (PNMLINK)lParam; item = pNMLink->item; MessageBox(hWnd, item.szUrl, "URL", MB_OK); return (INT_PTR)TRUE; default: break; } /* switch */ break; /* WM_NOTIFY */ case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); switch( wmId ) { case IDC_STATIC_SYSLNK: ShellExecute(NULL, "open", "http://www.google.de/", NULL, NULL, SW_SHOWMAXIMIZED); return (INT_PTR)TRUE; case IDOK: case IDCANCEL: EndDialog(hWnd, LOWORD(wParam)); return (INT_PTR)TRUE; default: break; /* wmId */ } break; /* WM_COMMAND */ case WM_CLOSE: EndDialog(hWnd, LOWORD(wParam)); return (INT_PTR)TRUE; default: break; /* uMsg */ } return (INT_PTR)FALSE; } ---snap--- Resource is: ---snip--- IDD_DLG_ABOUT DIALOGEX 0, 0, 170, 66 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Dialog" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN ICON IDI_ICON_MAIN,IDC_STATIC,14,15,20,20 LTEXT "Webtest, Version 1.0",IDC_STATIC,42,9,114,8 LTEXT "http://www.google.de/",IDC_STATIC_SYSLNK,42,20,114,8,SS_NOTIFY DEFPUSHBUTTON "OK",IDOK,7,45,156,14,WS_GROUP CONTROL "<a>http://www.google.de/</a>", IDC_SYSLINK1,"SysLink",WS_TABSTOP,42,57,114,8 ---snap--- You can see, the structure and the var item.szUrl has not a valid value. What is wrong with my code If anybody knows to get this working it would be fine to hear from. btw: it wouldn't work either, if I adapt all the given sourcecode for the WM_NOTIFY event from http://msdn.microsoft.com/en-us/library/bb760706(VS.85).aspx Thomas
From: Christian Kaiser on 3 Dec 2008 06:18 > Additional I tried using just a simple static textcontrol and > this would work fine for me, but the Style doesn't look like > a weblink. If somebody know how to modify a static textcontrols > text to color blue and underline and how to get the Hand > if a user move over the link, it would be good if he give > me some tips (links?), how to do this. I think this would > be the best way. Cause it would work with cc prior to > version 6.0 a) WM_SETFONT (underline) b) WM_CTLCOLORSTATIC (blue) c) subclass the control and answer WM_SETCURSOR/WM_MOUSEMOVE and WM_LBUTTONUP (for hand cursor and click)
From: Loic on 3 Dec 2008 07:19 Thomas Steinbach wrote: > Hello NG, > > does anybody knows how to get this Syslink Control > within the CommonControls 6 running? > > I used the examples at > http://msdn.microsoft.com/en-us/library/bb760706(VS.85).aspx > generating a dynamic CommonControl adapting the given > sourcecode on this msdn site and I tried to use the > Syslink Control using VS2008. > > First I added a manifest file to my app and the > CommonControls initialize well. (The syslink > created by VS2008 and the dynamic Syslink, apears > in the AboutBox. > > Actually I get this WM_NOTIFY (WN_CLICK,WN_ENTER) > event, but could not get the given Url in the Structure item > (see source below) > It works perfectly for me. Maybe you mixed unicode and ansi ((LPCSTR)WC_LINK has no sense) I get item.szUrl = "http://www.google.de" for dynamic SysLink
From: Thomas Steinbach on 3 Dec 2008 11:18
Hello Christian, >> Additional I tried using just a simple static textcontrol and >> this would work fine for me, but the Style doesn't look like >> a weblink. If somebody know how to modify a static textcontrols >> [...] > a) WM_SETFONT (underline) > > b) WM_CTLCOLORSTATIC (blue) > > c) subclass the control and answer WM_SETCURSOR/WM_MOUSEMOVE and > WM_LBUTTONUP (for hand cursor and click) a) and b) looks good. But I have no subclassing experience within the WinAPI. I found this on MSDN: http://support.microsoft.com/kb/179398/en-us But it's VB and I can't VB. I'm using pure C and the WinAPI and there are no classes in C. But perhaps something like a wrapper? Additional I found this in MSDN: http://msdn.microsoft.com/en-us/library/ms997565.aspx but that means global and instance subclassing, not a CustomControl and StaticText Control. Do you have an example or do you know a HowTo (Link?) for this technic and how to subclass a Control? btw: Is there a FAQ of c.o.m.p.win32 available? Thomas |