473,812 Members | 2,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Execute other Program...

On my form, I have a field that displays the student's website. How do I
display thewebsite as a hyperlink in a textbox where the user can click on
it and Internet Explorer opens up the site?
Jul 17 '05 #1
12 8093
If that's all that's in that textbox, then the solution is simple... just
set up
a CLICK event on the textbox, that passes it's contents to a SHELLEXECUTE
API call. Over here, I have this API call pre-defined as "runfile" in a
module called "shellexec" , so in this situation, I would only need to do...

Private Sub Text1_Click()
ShellExec.RunFi le Text1.Text
End Sub

"Scott D. Barrish" <sb******@tampa bay.rr.com> wrote in message
news:iH******** *********@twist er.tampabay.rr. com...
On my form, I have a field that displays the student's website. How do I
display thewebsite as a hyperlink in a textbox where the user can click on
it and Internet Explorer opens up the site?

Jul 17 '05 #2
Thank you for your help.

I accomplished my task with the following:

Shell("c:\progr am files\internet explorer\iexplo re.exe " & lblLink.Caption ,
vbMaximizedFocu s)

Sincerely,
Scott D. Barrish
Jul 17 '05 #3
On Thu, 25 Sep 2003 04:17:43 GMT, "Scott D. Barrish"
<sb******@tampa bay.rr.com> wrote:
Thank you for your help.

I accomplished my task with the following:

Shell("c:\prog ram files\internet explorer\iexplo re.exe " & lblLink.Caption ,
vbMaximizedFoc us)


It might be an idea to programatically find the file name and location
of the default browser

The API FindExecutable( ) is useful for that
Jul 17 '05 #4
I used the following code:

Private Declare Function ShellExecute _
Lib "shell32.dl l" _
Alias "ShellExecuteA" ( _
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) _
As Long

Private Sub lbl_Link_Click( )
Dim r As Long
r = ShellExecute(0, "open", lbl_Link.Captio n,0, 0, 1)
End Sub
"J French" <er*****@nowher e.com> wrote in message
news:3f******** ******@news.btc lick.com...
On Thu, 25 Sep 2003 04:17:43 GMT, "Scott D. Barrish"
<sb******@tampa bay.rr.com> wrote:
Thank you for your help.

I accomplished my task with the following:

Shell("c:\prog ram files\internet explorer\iexplo re.exe " & lblLink.Caption ,vbMaximizedFoc us)


It might be an idea to programatically find the file name and location
of the default browser

The API FindExecutable( ) is useful for that

Jul 17 '05 #5
On Thu, 25 Sep 2003 16:11:32 GMT, "Scott D. Barrish"
<sb******@tampa bay.rr.com> wrote:
I used the following code:

Private Declare Function ShellExecute _
Lib "shell32.dl l" _
Alias "ShellExecuteA" ( _
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) _
As Long


Yes, that is fine - provided one small thing ....

That you are sure that ShellExecute will recognize the 'file' that you
are sending it

Having to launch a browser to try to go to all sorts of dubiously
formatted web addresses, I opt for finding the App's name and then
launching it myself

That way I am sure a Browser will get launched ...

Think about it for a bit ...
- I spent some time worrying over the problem

Of course FindExecutable is fundamentally faulty, as it might launch a
DDE server - and also (stupidly) needs an existing file
- but give it c:\temp\dummy.h tm and it comes back with a browser

- the other (safe) method is to ponce around in the registry looking
for the file associated with 'htm'
- having nailed that down once, I don't like using it
Jul 17 '05 #6
xyz
On Wed, 24 Sep 2003 12:00:14 GMT, "Scott D. Barrish"
<sb******@tampa bay.rr.com> wrote:
On my form, I have a field that displays the student's website. How do I
display thewebsite as a hyperlink in a textbox where the user can click on
it and Internet Explorer opens up the site?


=============== =====
I recently had to solve this problem. It is different for Windows
95,98,ME and Windows NT,2000,XP. Here is a cross-system solution.

Place a "Microsoft SysInfo control" on your form. Set the "label"
field that displays the web site URL to be underlined in the Font
attribute, set the MousePointer attribute to 99 (custom), and set the
MouseIcon to HAND-M.CUR (it is normally in the /windows/cursors
directory, I attached it). This will cause the web hand to show when
the cursor is placed over the label that has the web link.
' The declaration below goes in a Module1.bas file
' execute shell command
Declare Function ShellExecute Lib "shell32.dl l" _
Alias "ShellExecu teA" (ByVal hwnd As Long, ByVal lpOperation As
String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
' This is the code to launch the browser (It assumes that
' the form with the SysInfo control is frmMain
Private Sub Label5_Click()

Dim rcu As Long
Dim URL As String
' ShellExecute defined in Module1.bas

URL = "http://www.yahoo.com/" ' or whatever

If frmMain.SysInfo 1.OSPlatform = 2 Then
' OSPlatform = 2 for Win NT/2000/XP
Call ShellExecute(Me .hwnd, "open", URL, "", "", 0)
Else
' OSPlatform = 1 for Win 95/98/ME
rcu = Shell("start " & URL, vbNormalFocus)
End If
End Sub


Jul 17 '05 #7
xyz


Jul 17 '05 #8
Iexplorer.exe is not the only browser out there.

I think one should try to locate the browser associated with the htm files,
as you say. However I dont I dont know how :-)

A.

"J French" <er*****@nowher e.com> wrote in message
news:3f******** ******@news.btc lick.com...
On Thu, 25 Sep 2003 16:11:32 GMT, "Scott D. Barrish"
<sb******@tampa bay.rr.com> wrote:
I used the following code:

Private Declare Function ShellExecute _
Lib "shell32.dl l" _
Alias "ShellExecuteA" ( _
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) _
As Long


Yes, that is fine - provided one small thing ....

That you are sure that ShellExecute will recognize the 'file' that you
are sending it

Having to launch a browser to try to go to all sorts of dubiously
formatted web addresses, I opt for finding the App's name and then
launching it myself

That way I am sure a Browser will get launched ...

Think about it for a bit ...
- I spent some time worrying over the problem

Of course FindExecutable is fundamentally faulty, as it might launch a
DDE server - and also (stupidly) needs an existing file
- but give it c:\temp\dummy.h tm and it comes back with a browser

- the other (safe) method is to ponce around in the registry looking
for the file associated with 'htm'
- having nailed that down once, I don't like using it

Jul 17 '05 #9
On Fri, 26 Sep 2003 20:48:50 +0300, "Aristoteli s E. Charalampakis"
<ar************ ***********@REM OVEMEhotmail.co m> wrote:
Iexplorer.ex e is not the only browser out there.

I think one should try to locate the browser associated with the htm files,
as you say. However I dont I dont know how :-)

1) ShellExecute() finds and runs the browser

2) FindExecutable( ) finds the browser - you need to run it (good)

3) Peer into the Registry - Ok - but can be tedious

Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5059
by: Tim Williams | last post by:
I'm trying to write a simple python program to access a MySQL database. I'm having a problem with using MySQLdb to get the results of a SQL command in a cursor. Sometimes the cursor.execute works, sometimes not. From mysql: mysql> show databases; +-----------+ | Database |
1
1664
by: Thomas | last post by:
Hi all, I want to execute a new program in a c++ program without beeing blocked. After the child process is created both processes should run idependend. My method at the moment: execute( QString cmd ) { int pid = -1;
3
4497
by: Lubos | last post by:
Hi, How can i make this. When i maked a program in C# and then when the program is execute on computer without .NET Framework, how can i automaticaly invoke instalation of Framework after execute the program? How files (instalation files for Framework) i have to distribute with my program? Thanks Lubos
4
7883
by: Chris | last post by:
I posted this in the C# language group, then thought it might be more appropriate in this group. I would not cross-post except I want the answer so badly. I built small C# Web and Web Service applications in a training class last week. The applications worked in the class, but when I tried to run them again over the weekend, they both bombed. Instead of getting my Web page, or the Web Service page, I get a page full of error text...
2
2549
by: joe1977 | last post by:
Win2k3, PHP 5, Apache 2, Acrobat 7 when I go to my server, pull out cmd.exe and type as follows: "c:\Program Files\Adobe\Acrobat 7.0\\Reader\AcroRd32.exe" /t "c:\Program Files\Adobe\Acrobat 7.0\Reader\test.pdf" "labelprinter" the document test.pdf will be printed on labelprinter. Now, labelprinter is set for non-default draw "Casette nr 2" and the line
0
1123
by: wolf2300 | last post by:
hi how can i remotly execute program . i have 2 computers A and B . on both of them i have aplication (myap.exe) myap require 2 parameters. First is mypath , 2 myfile. for example to execute i write : C:\temp\myaps.exe c:\temp all.exe .. on my computer it works perfectly. but when i tried to execute this program on computer B it doesnt work. on computer A i write in command line \\klio\perflogs\konsoliduj.exe c:\perflogs calosc.csv
3
2559
by: =?Utf-8?B?S3VlaXNoaW9uZyBUdQ==?= | last post by:
I have a .NET VC++ program, I want to execute some dos command from the program, e.g. copy some file, and etc. How do I do that?
2
2038
fungazid
by: fungazid | last post by:
Help help help please I’m using DBD::mysql, and I want to insert a record into clients table (id, address, and phone-number of a client): my $str= “?,?,?,,,”; my @args1=('Zalman','Zalmanovich',12121,'New York'); $q=$dbh->prepare("INSERT INTO $table VALUES($str)")
6
6860
by: moongeegee | last post by:
I have compile my java program as myjava.class. And I can run as "java myjava" without any program. As now, I need to execute myjava.class in javascript. Please shed a light how to execut "java myjava" in my javascript. Thanks a million.
5
7082
by: sayeo87 | last post by:
Hi, I am quite new to JSP so please forgive me if I ask really simple things... I am trying to run system commands on the server and display the output on a webpage. This is what I've got: <%@ page import="java.io.*" %> <HTML> <BODY> <% Runtime rt = Runtime.getRuntime(); Process p = rt.exec("/bin/ls");
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10664
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10417
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10139
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5568
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5704
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4357
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3029
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.