Solved

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

Posted on 2003-11-19
4
357 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

729 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