Button as hyperlink in MFC

Posted on 2004-03-24
Medium Priority
Last Modified: 2012-08-13
Hi all
  I am drawing bitmap image on a button and now I want to make the button as hyperlink in MFC.
Is there any way in MFC ?
With Regards
Sunil Joshi
Question by:sunil_djoshi
  • 2
LVL 14

Expert Comment

by:Daniel Junges
ID: 10667041
Captute BN_CLICKED event and then execute the link with CreateProcess, it will open you default browser:
CreateProcess("http:\\myhost.com", 0, 0, 0, FALSE, CREATE_NEW_CONSOLE, 0, 0, 0, &pi);

If you want to change the cursor on mouse over, then you need to capture the mouse enter and exit. Please read the follow thread, it treats exactly this issue:

LVL 49

Accepted Solution

DanRollins earned 800 total points
ID: 10675121
Another (similar) option...
In your OnClickXxxxx handler, use ShellExecute, like so:

     ShellExecute(NULL, "open", "http://www.yahoo.com",NULL, NULL,SW_SHOWNORMAL);

-- Dan

Author Comment

ID: 10746620
Hi junges
Thanks a lot fpr the answer and sorry for the late reply
 your solution works very fine
thanks a lot
Sunil Joshi
LVL 49

Expert Comment

ID: 10747088
The best way to thank an EE Expert is to click the [Accept] button next to his comment, then select the "Excellent" radio button and click [Submit]

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Make the most of your online learning experience.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Screencast - Getting to Know the Pipeline

588 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