 |
|
 |
I wonder if this source code can be used in GNU3 project? Header has a "can not be sold" stipulation, which technically contradicts with GNU3. If any of the authors could come forward and clarify if I can use this control in GNU3-licensed project (or any other open source project for the same matter), I would appreciate it. I tried to email authors, but none of the emails I could find is active. I want to use it in VVCap (www.vvcap.net) project
--galets
|
|
|
|
 |
|
 |
Hi, I used this.Nice.Thanks
Anu
|
|
|
|
 |
|
 |
When this control is used on a property page that is added and removed several times, some errors occur because the font and the tooltip objects are not destroyed.
Here's the fix for the tooltip:
// Create the tooltip
if (m_bToolTip)
{
CRect rect;
GetClientRect(rect);
if (m_ToolTip)
{
m_ToolTip.DestroyWindow();
m_ToolTip.Detach();
}
m_ToolTip.Create(this);
m_ToolTip.AddTool(this, m_strURL, rect, TOOLTIP_ID);
}
For the font objects you need to do:
if (m_Font.m_hObject)
{
m_Font.DeleteObject();
m_Font.Detach();
}
All these fixes need to be done in the PreSubclassWindow procedure.
Best regards,
Matthias
|
|
|
|
 |
|
 |
Parent Notification Static HyperLink control
Thanks for This Great Control.
One Question: Could i modify it for my use, is I am permitted to do that.
thanks once again
"I Think this Will Help"
[Vote One Here,.....]
visit me at http://www.thisisalok.tk
|
|
|
|
 |
|
 |
In the downloaded code the call to SetUnderline() has no effect because the
underline state has been hard coded in the function declaration. Here are my
changes to give you full control over your hyperlink appearance.
1) in the XHyperLink.h file comment out the [= ulHover] in the function
declaration.
2) in the XHyperLink.cpp file set the m_nUnderline variable to your desired
default state in the constructor.
3) in the PreClassSubwindow override function pass the m_nUnderline variable
in the SetUnderline() function call -- eg. SetUnderline(m_nUnderline);
4) in the SetUnderline() function implementation change the first if
statement to the following:
if (m_nUnderline == nUnderline && nUnderline != 1)
return;
This forces an "Always Underline" call to set the underline font. Otherwise,
an "Always" call will not underline if it follows a previous "hover" call.
After making these changes now you can call m_mycontrol.SetUnderline(state)
and set unique text states for each hyperlink. Of course, if you omit these
calls, then the default state you set in the constructor will determine the
state for all controls.
That's all. Hope this helps.
|
|
|
|
 |
|
 |
This is a fabulous class. I would only like to suggest one improvement.
There may be times where you want to show a tooltip, but hide the URL -- for
example the URL is very long.
I modified this class to enable customized tooltips. I simply modified the
class declaration for the SetURL function in the XHyperLink.h file as follows:
void SetURL(CString strURL, CString strTip);
Then in the "Protected Attributes" section I added a new member variable:
CString m_strTip;
Then in the XHyperLink.cpp file I made two modifications. First in the
PreSubclassWindow() function, at the end of the function I modified the
following statement:
if (m_bToolTip)
{
CRect rect;
GetClientRect(rect);
m_ToolTip.Create(this);
m_ToolTip.AddTool(this, m_strTip, rect, TOOLTIP_ID);
}
and finally, I modified the SetURL() function as follows:
void CXHyperLink::SetURL(CString strURL, CString strTip)
{
m_strURL = strURL;
m_strTip = strTip;
if (::IsWindow(GetSafeHwnd()))
{
PositionWindow();
m_ToolTip.UpdateTipText(strTip, this, TOOLTIP_ID);
}
}
Now from the OnInitDialog() function of your dialog class you simply call
SetURL passing two variables, the first is the actual URL and the second your
customized Tooltip string -- for example:
CString szURL = "http://wwwp.musicmatch.com/skins/search.cgi?
NOHEADER=1&REQUEST=THEMES&Font=Arial,9,FW_BOLD&TextColor=1e323c&ForeColor=0000
00&TextBackColor=b2c8d2&HighLightTextBackColor=91b4c3&HighLightTextColor=00000
0&MMJB_KEY=J425L-WA299-L24KK-H27UK&KEY_STATE=1&CERT_STATE=1&MMUID=C1554A68-
4D2D-4A8D-9683-8DF167402ECC&Grant=0&VERSION=7.50.0089MMD&ThemeVersion=2.1
&OEM=MMD&OOEM=MMD&LANG=ENU";
CString szTip = "Get MMJB Skins Here";
m_Download.SetURL(szURL, szTip);
_____________________________________________________________________________
That's All Folks!!
|
|
|
|
 |
|
 |
I agree, but I think it will be more useful a function like this:
void SetURL(CString szURL, LPCTSTR szTip=NULL);
So, if invoked with just 1 argument, it must use szURL for both URL and tooltip.
void CXHyperLink::SetURL(CString szURL, LPCTSTR szTip /*=NULL*/)
{
m_strURL = szURL;
m_strTip = szTip ? szTip : szURL;
if (::IsWindow(GetSafeHwnd())) {
PositionWindow();
m_ToolTip.UpdateTipText(m_strTip, this, TOOLTIP_ID);
}
}
Best regards,
Jaime.
|
|
|
|
 |
|
 |
Hi,
how can I use this control in a SDI application? I need to have this XHyperLink in the midle of a CView...
Thanke you in advance!
|
|
|
|
 |
|
 |
Hi, Hans.
It occurs to me that if the length of the url to be set is large than a certain number not only the hyperlink will cease to function but also the dialog in which the hyperlink control is embedded will disappear.
Any idea?
Thanks,
Don Chen
|
|
|
|
 |
|
 |
The URL is passed in a CString variable, which as far as the class is
concerned could contain all the data of a text file or HTML page if you so
needed. The limit would only be imposed if you set a limit at the time you
created the variable (in ClassWizard for example).
As far as the static control is concerned, the idea is to NOT try to place
the URL in the static control, but rather a meaningful abbreviated version --
such as www.microsoft.com
Use SetWindowText to set the text in your control, and SetURL to set the
actual URL (they can--and probably should--be two separate strings).
Also see my posting in this forum on customized tooltips for setting and
displaying custom tooltips rather than the URL (this modification was made
due to long URLS).
_____________________________________________________________________________
There is nothing left to say!
|
|
|
|
 |
|
 |
Hi Sir,
I like yr hyperlink control
but i want to create without using mfc
how can i create a hyperlink using win32(api)
plz help me, if u free!!
thank a lot
|
|
|
|
 |
|
 |
Background colors do not take effect:
pDC->SetBkMode(TRANSPARENT);
if (m_Brush.GetSafeHandle())
{
pDC->SetBkColor(m_crBackground);
return (HBRUSH) m_Brush;
}
else
{
return (HBRUSH)GetStockObject(NULL_BRUSH);
}
Corrected code:
if (m_Brush.GetSafeHandle())
{
pDC->SetBkColor(m_crBackground);
return (HBRUSH) m_Brush;
}
else
{
pDC->SetBkMode(TRANSPARENT);
return (HBRUSH)GetStockObject(NULL_BRUSH);
}
Not so much a bug as a performance issue, but SetTimer and OnTimer are unnecessary:
void CXHyperLink::OnMouseMove(UINT nFlags, CPoint point)
{
if (!m_bOverControl) {
m_bOverControl = TRUE;
if (m_nUnderline == ulHover) SetFont(&m_UnderlineFont);
Invalidate();
SetTimer(m_nTimerID, 100, NULL);
}
CStatic::OnMouseMove(nFlags, point);
}
Modified code:
void CXHyperLink::OnMouseMove(UINT nFlags, CPoint point)
{
if (m_bOverControl != FALSE)
{
CRect rect;
GetClientRect(&rect);
if (rect.PtInRect(point) == FALSE)
{
m_bOverControl = FALSE;
if (m_nUnderline == ulHover) SetFont(&m_StdFont);
Invalidate();
ReleaseCapture();
}
}
else
{
m_bOverControl = TRUE;
if (m_nUnderline == ulHover) SetFont(&m_UnderlineFont);
Invalidate();
SetCapture();
}
CStatic::OnMouseMove(nFlags, point);
}
Don't forget to delete the OnTimer() code to save a little time compiling and help reduce final EXE size (in debug mode anyway).
|
|
|
|
 |
|
 |
The timer "bugfix" is wrong because it leaves the hyperlink in active state after clicking. The original code (with timer) doesn't have this problem.
|
|
|
|
 |