?
Solved

Open Web Browser, mouseover

Posted on 2000-05-06
13
Medium Priority
?
226 Views
Last Modified: 2010-04-02
[Borland C++ Builder 3 Standard]

I have a program I am working on, and I want to have a link that you can click on in the program that opens up the default Web Browser at a given address.

Can someone please give me some code for the onclick handler to do this?

Also, is there a simple mouseover/mouseout event handler? I can't find any in the Help system.

Thanks,

Daniel
0
Comment
Question by:Subhuman
[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
  • 5
  • 4
  • 4
13 Comments
 
LVL 1

Expert Comment

by:yz
ID: 2783827
Please refer to platform sdk , there are a sample named "MouseInfo" can tell u how to handle WM_MOUSEHOVER message, if u want to open browser, I think ShellExecture function can do it.
0
 
LVL 1

Expert Comment

by:yz
ID: 2783828
yz changed the proposed answer to a comment
0
 
LVL 1

Expert Comment

by:yz
ID: 2783831
Please refer to platform sdk , there is a sample named "MouseInfo" can tell u how to handle WM_MOUSEHOVER message, if u want to open browser, I think ShellExecute function can do it.
0
Independent Software Vendors: 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!

 
LVL 1

Expert Comment

by:yz
ID: 2783852
yz changed the proposed answer to a comment
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 200 total points
ID: 2783956
Create a temporary text file in your apps directory
(or in the c:\windows\temp directory) with this content:

[InternetShortcut]
URL=http://www.experts-exchange.com

Name this file "temp.url" and start it with ShellExecute:

#include <vcl\vcl.h>
#include <vcl\clipbrd.hpp>
#include <windows.h>
#pragma hdrstop

#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
  ::ShellExecute(NULL,"open","temp.url",NULL,NULL, SW_SHOW);
}
I hope, it helps. Alex
0
 
LVL 1

Author Comment

by:Subhuman
ID: 2785059
Thanks, I'll see what I can do with it.

What's the platform sdk?
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2785122
>>What's the platform sdk?
Windows 95/98/NT

0
 
LVL 1

Author Comment

by:Subhuman
ID: 2785135
? huh ?

So I'm supposed to look for a sample called "MouseInfo", eh?
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2785768
May be such code exists, i don't know.
But for what? If you want launch brouser pressing on the Button or other
control, simple set my code in OnClick
event header,
0
 
LVL 1

Author Comment

by:Subhuman
ID: 2787805
This is what I've got:

#include <stdio.h>
#include <math.h>
//these two are for the link
#include <vcl\clipbrd.hpp>
#include <windows.h>

#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
double Principal, Rate, Time, Accum, Interest, Num;
//char * const Principal = TEdit.PrincipalInput.Text;

//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------

//etc, some event handlers for other objects and such

//---------------------------------------------------------------------------

void __fastcall TForm1::URLnClick(TObject *Sender)
{
// The name of the TStaticText object I'm using for my link is "URLn"
// This stands for URL Normal (as opposed to URLu[nderline]), because
// of the two objects I want to swap the visibility of on mouseover.
// I'll get the link to work before I go screwing around with mouseover
// routines though. :)

  ::ShellExecute(NULL,"open","temp.url",NULL,NULL, SW_SHOW);
}
//---------------------------------------------------------------------------


--------------------------

This is the error message:

[C++Error] Unit1.cpp(211): Call to undefined function 'ShellExecute'.

I looked through the help system and there doesn't appear to be a ShellExecute function included with my version of C++ Builder. :(

What do you suggest (other than get a better compiler :) ?)
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2788800
ShellExecute has been defined in
you ...\include\Win32\shellapi.h
0
 
LVL 1

Author Comment

by:Subhuman
ID: 2790641
so I need a

#include<shellapi.h>

in there?
0
 
LVL 1

Author Comment

by:Subhuman
ID: 2790992
Thank you Alex :)
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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

765 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