Solved

Urgent! How to set a static text to be a link? (VC++)

Posted on 2003-11-19
4
351 Views
Last Modified: 2010-04-02
Hi there,

I am a beginner in VC++ programming.
What I want is like below:

A dialog box, and a static text in the dialog box.
This static text looks like "http://www.XXX.com" and is
with white background color / blue text color and underline.

when the user clicks the static text, the IE is opened and
connect to the specified web site.

Could anybody teach me about this or just give me the sample
code? I really need this as soon as possible. Thanks a lot!!
0
Comment
Question by:poppy526
4 Comments
 
LVL 13

Accepted Solution

by:
SteH earned 300 total points
ID: 9780377
The solution is found on codeguru:
http://www.codeguru.com/staticctrl/HyperlinkStatic.html
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 9780379
0
 
LVL 32

Expert Comment

by:jhance
ID: 9781787
0
 
LVL 1

Assisted Solution

by:georgiek50
georgiek50 earned 50 total points
ID: 9790465
Here is my sample code for my About Dlg that does exactly what you need:

IDC_WEBSITE is a static control in the About Dlg, and I am processing it inside WM_COMMAND (you don't need the internet checking but it's better to have it there to make sure the user is connected and if not to pop up their default dialer)

case IDC_WEBSITE:

// Attempt to connect to the internet

if ( InternetGetConnectedState(lpdwConnectionFlags, 0) == FALSE )
{      

if ( MessageBox(hDlg, "Connect to the Internet?", szAppName, MB_YESNO | MB_ICONQUESTION) == IDYES
)
{

if ( InternetAttemptConnect(0) != ERROR_SUCCESS )
{
MessageBox(hDlg, "Unable to Connect.", szAppName, MB_OK | MB_ICONERROR);

return FALSE;
}
}
else
return FALSE;
}

ShellExecute(hDlg, NULL, "www.yourwebsitehere.com", NULL, NULL, SW_MAXIMIZE);
                                    
return FALSE;

Sorry about the text formatting :)
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now