Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2003-11-19
4
Medium Priority
?
364 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 13

Accepted Solution

by:
SteH earned 1200 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 200 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

730 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