Solved

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

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

Suggested Solutions

Title # Comments Views Activity
C++ to C# code conversion issue 4 117
How to convert MFC::CString to UTF8 wchar_t* 10 364
Create a path if not exists 7 105
find Speed using GPS latitude & longitude 4 81
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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 viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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.

685 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