|
|
Comments and Discussions
|
|
 |

|
Today I was searching for a hyperlink class and found hundreds of them but none of them worked for me. But your work is very simple elegant just according to my needs without unnecessary details. Thanks...
|
|
|
|

|
I'm trying to use this control to 'activate' text on a dialog - meaning I don't want the hyperlink to act like a hyperlink, I just want to know in my dialog that it has been clicked.
So, how does one reroute the OnClicked message to the containing dialog? And is it possible to identify which CHyperlink control was clicked (if I have more than one)?
|
|
|
|

|
IMHO the possible way is to modify the source by adding the RegisterMessage with some pseudo-unique message call in the header and then firing that registered message from the GotoURL to parent, basing on some condition, for example - if the URL string passed in is empty. Like that:
Add to Hyperlink.h:
~~~~~~~~~~~~~~~~~~~
const UINT NEAR WM_HYPERLINK_NOTYFY_PARENT_CLICK = ::RegisterWindowMessage(_T("WM_HYPERLINK_NOTYFY_PARENT_CLICK"));
Change the Hyperlink.cpp like this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void CHyperLink::OnClicked()
{
m_bOverControl = FALSE;
if (m_strURL.IsEmpty()) {
GetParent()->PostMessage(WM_HYPERLINK_NOTYFY_PARENT_CLICK, (WPARAM)GetDlgCtrlID(), 0);
return;
}
int result = (int)GotoURL(m_strURL, SW_SHOW);
..............
}
Then proceed that message in parent window like this:
afx_msg LRESULT OnHyperlink(WPARAM wParam, LPARAM lParam)
{
if (wParam == IDC_STATIC_URL1)
AfxMessageBox(L"Url1");
else
if (wParam == IDC_STATIC_URL2)
AfxMessageBox(L"Url2");
return 1;
};
and add ON_REGISTERED_MESSAGE(WM_HYPERLINK_NOTYFY_PARENT_CLICK, OnHyperlink) to the message map.
And don't forget to call SetURL(_T("")) to make it work.
This method avoids us from changing the reflection idea.
modified on Friday, April 3, 2009 11:58 AM
|
|
|
|

|
Thanks...this works a treat!
|
|
|
|

|
In this example there is one dialog named "HyperLink Sample". On this dialog there is static text named "mail me" and Ok button is there.
I want same functionality but just want to destroy "HyperLink Sample" dialog when someone clicks on it as well as it should work as HyperLink.
Thanks,
Hemang
|
|
|
|

|
I'd like to thank for this wonderful MFC control. It really looks simple and professional. I was saved quite a lot of work. x10 ))
|
|
|
|

|
there are not completely understandable explanations in the article, which way
can people use Hyperlink control ?
If the usage of yours Hyperlink control is forbidden in the commercial products, please,
let me know ASAP.
I have mentioned you and CHyperLink in the "Credits" section of the Help file.
Please, check this. If everything OK, or I should make credits some another way?
The product site is: http://www.timestimator.com/
If you found Timestimator useful for you, of course, you are always welcome for free license (when the program become completely commercial)
With the best regards, Vit
With the best regards, Vit
|
|
|
|

|
Hello
I am using CHyperLink in my application to open a page.
This opens in IE. But how is it possible to make this open
in Firefox?
thanks in advance
Renjith
|
|
|
|
|

|
I'm not sure if these fixes are 100% correct, but I had to make these changes in order for things to work...
1) In SetURL
m_strURL = strURL;
SetWindowText(m_strURL); <-- added this
The url wouldn't change using this method, so I added the SetWindowText call. A check to see if it's an empty string might be useful too.
2) In PositionWindow
My center aligned url was being cut off on the left side.
I changed...
Extent.cx += WndRect.Width() - ClientRect.Width();
to
Extent.cx += WndRect.Width() - ClientRect.Width() + 1;
Now the text is showing correctly.
|
|
|
|

|
Hi,
You have it wrong with the fix #1. This is not a bug. It allows you to have the hyperlink caption set to something with SetWindowText() and associate a URL with SetURL.
Go on any web page and you'll see that it is quite rare that a hyperlink text is the underlying URL associated to the link.
If you want both the caption to be the URL text, the correct way of using it would be to both call SetWindowText and SetURL().
|
|
|
|

|
Hi,
Thanks for this nice Hyperlink control.
I am encountering one problem.
I have 10-15 static controls on my form, and I am using Hyperlink class for 3 static controls.
But the CtlColor event of Hyperlink class is not firing.
I am firing OnCtlColor event in my View class.
Please tell me how to fire the CtlColor event of Hyperlink class.
Thanks,
Sanat
Sanat
|
|
|
|

|
I tried to build the demo project in VC6, and I got
compile error:
Cannot open include file: 'atlconv.h'
I suspect I need to add some compile option. Can anyone advice?
Thanks a lot,
Don Chen
|
|
|
|

|
Hello Sir,
I want create hyperlink control as u show
but i don't like to use mfc
so how can i create hyperlink control using win32(api)
plz ,help me
|
|
|
|
|

|
This was exactly what I was looking for. Thanks!
-William Brendel
|
|
|
|

|
Ditto,, thanks again.
Ed Deighton.
http://groups.yahoo.com/group/arpwizard/
|
|
|
|

|
First of all, thanks for this very good control.
I have only one suggestion about the default hand cursor : on Windows 98/Me/2000/XP, you can use IDC_HAND to load the cursor which gives you also support for the drop shadow. To keep compatibility for Win 95, you can modify the SetDefaultCursor() in the following way :
void CHyperLink::SetDefaultCursor()
{
if (m_hLinkCursor == NULL) {
#ifdef IDC_HAND
m_hLinkCursor = ::LoadCursor(NULL, IDC_HAND); if (m_hLinkCursor == NULL) #endif
{
CString strWndDir;
GetWindowsDirectory(strWndDir.GetBuffer(MAX_PATH), MAX_PATH);
strWndDir.ReleaseBuffer();
strWndDir += _T("\\winhlp32.exe");
HMODULE hModule = LoadLibrary(strWndDir);
if (hModule) {
HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
if (hHandCursor)
m_hLinkCursor = CopyCursor(hHandCursor);
}
FreeLibrary(hModule);
}
}
}
|
|
|
|
|

|
i have a win32-project (without mfc) building upon the scrnsave.lib by microsoft. i have a dialog for the screensaver and want to use a text or image as a hyperlink there. how can i get a click-message from a static text in my wndproc?
greets,
morgler
|
|
|
|

|
If you use WTL you can find CHyperLink in atlctrls.h. It has similar features.
Jan
|
|
|
|

|
How can i place a hyperlink in a textbox?
|
|
|
|

|
I wonder if anybody knows how hyperlink control can be plugged into a dialog bar. If I am using Chris Maunder's dialog with
hyperlink control on it as my dialog bar, the dialog bar would be created in MainFrm.cpp :
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndDlgBar.Create(this, IDD_HLSAMPLE_DIALOG,
CBRS_ALIGN_RIGHT, AFX_IDW_DIALOGBAR))
{
TRACE0("Failed to create dialogbar\n");
return -1; // fail to create
}
return 0;
}
|
|
|
|

|
hi,
i want to show hyperlink on a particular column. this column is in listcontrol. So how can i do this? i want to show hand cursor if i am on that column or row and after clicking on it i get some dialog. I am ablre to get dialog after clicking. My requirement is to display hyperlink or hand cursor for that column or row.
this is highpriority for my project.
Please tell me how can i achieve this?
thank you,
kalpana
|
|
|
|

|
hi kalpana,
It is not possible kalpana. it possible only on label control.
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
A simple drop-in hyperlink control
| Type | Article |
| Licence | CPOL |
| First Posted | 20 Nov 1999 |
| Views | 229,429 |
| Bookmarked | 98 times |
|
|