Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
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.

790 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