|
-
Apr 11th, 2004, 08:37 AM
#1
Thread Starter
Fanatic Member
hyperlink
is it possible to use hyperlink on the internet to open an application in a pc?
-
Apr 11th, 2004, 09:06 AM
#2
Fanatic Member
You can use the WScript ActiveX Component from a page. 
Code:
<script type="text/javascript">
var WshShell = new ActiveXObject("wscript.shell");
WshShell.run("C:\\Windows\\system32\\calc.exe");
</script>
Author for Visual Basic Web Magazine
-
Apr 11th, 2004, 09:09 AM
#3
Thread Starter
Fanatic Member
hmm.....sorry i dun really understand the code...
actually i mean from a mail that one receive comes with a "hyperlink" that is able to call out an application (vb.exe) on the computer...
-
Apr 11th, 2004, 10:03 AM
#4
Yes it can. TheVader provided some code (JavaScript). Since this is a VB forum, here is something else 
VB Code:
Dim Shell
Set Shell = WScript.CreateObject("WScript.Shell")
Shell.Run "charmap"
Really all it does it the exact same as the Shell() function of normal Visual Basic. The one above opens the character map.
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Apr 11th, 2004, 10:43 AM
#5
Thread Starter
Fanatic Member
hi thanks for the reply...but i receive the error : object require..
-
Apr 11th, 2004, 10:59 AM
#6
What line does it say the error is on?
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Apr 11th, 2004, 11:04 AM
#7
Thread Starter
Fanatic Member
Set Shell = WScript.CreateObject("WScript.Shell")
...btw...i dunno whether i have make myself clr enough...
ai mean that a hyperlink from 'external' internet that launch an application....from the local machine..is that possible...? how does it workks?
-
Apr 11th, 2004, 11:16 AM
#8
Do this:
Open notepad, and type this:
Code:
<html>
<head>
<script type="text/javascript">
var WshShell = new ActiveXObject("wscript.shell");
WshShell.run("C:\\Windows\\system32\\calc.exe");
</script>
</head>
</html>
Line by Line;
1) creates a new variable containing an activeX object, which is The Shell() function.
2) uses the Shell.Run command to execute a program on the computer that is viewing the page
It should work
PS: Used TheVader's code since mine doesn't work in IE
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Apr 11th, 2004, 11:24 AM
#9
Even better, try this as an example:
Code:
<html>
<head>
<script type="text/javascript">
function open_app() {
var WshShell = new ActiveXObject("wscript.shell");
WshShell.run("calc");
}
</script>
</head>
<body>
<style type="text/css">
.fakelink
{
font-size:8pt;
font-family:sans-serif,verdana;
color:blue;
cursor:hand;
}
</style>
<div class="fakelink" onMouseDown="open_app()"><u>Open Calculator</u></div>
</body>
</html>
All it is is opening the Calculator with a little more to make it fancy.
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Apr 11th, 2004, 11:30 AM
#10
Thread Starter
Fanatic Member
1) creates a new variable containing an activeX object, which is The Shell() function.
2) uses the Shell.Run command to execute a program on the computer that is viewing the page
It should work
PS: Used TheVader's code since mine doesn't work in IE
???? sorrie i am confuse...dun understand wat u mean
-
Apr 11th, 2004, 11:34 AM
#11
This really should be moved, as the original question doesn't even have anything to do with Visual Basic.
Goh:
I tried to put it as simple as I can.
Code:
var WshShell = new ActiveXObject("wscript.shell");
WshShell.run("C:\\Windows\\system32\\calc.exe");
That will run a program like you asked. You just need to replace this:
Code:
WshShell.run("C:\\Windows\\system32\\calc.exe");
Then it will run any program you want.
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Apr 11th, 2004, 11:40 AM
#12
Thread Starter
Fanatic Member
if i am not wrong the above code is wriiten in vb?
-
Apr 11th, 2004, 11:43 AM
#13
No, it is written in JavaScript....Hence why there is the line:
Code:
<script type="text/javascript">
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Apr 11th, 2004, 11:57 AM
#14
Thread Starter
Fanatic Member
wat do i need in order to write a java script? java software itself?
-
Apr 11th, 2004, 12:17 PM
#15
No, Javascript comes with Internet Explorer. You don't need anything.
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Apr 11th, 2004, 12:21 PM
#16
Thread Starter
Fanatic Member
thanks for your help...need i need lots of readup in this area..
-
Apr 11th, 2004, 04:20 PM
#17
Fanatic Member
Just do what Phreak suggests, you should be fine. Paste this code in a text file and save it as .htm. It will execute any file you want. 
Code:
<html>
<head>
<script type="text/javascript">
function open_app() {
var WshShell = new ActiveXObject("wscript.shell");
WshShell.run("calc");
}
</script>
</head>
<body>
<style type="text/css">
.fakelink
{
font-size:8pt;
font-family:sans-serif,verdana;
color:blue;
cursor:hand;
}
</style>
<div class="fakelink" onMouseDown="open_app()"><u>Open Calculator</u></div>
</body>
</html>
Author for Visual Basic Web Magazine
-
Apr 11th, 2004, 05:29 PM
#18
Thread Starter
Fanatic Member
wat i receive virus???? kid me!!!
-
Apr 11th, 2004, 06:00 PM
#19
Fanatic Member
Originally posted by Goh
wat i receive virus???? kid me!!!
Virus? Do you mean you get a security warning? You're likely to, because ActiveX objects have complete control over the computer (just like every regular executable program). But in this, it's safe to permit the control to run, of course.
Author for Visual Basic Web Magazine
-
Apr 11th, 2004, 06:10 PM
#20
Thread Starter
Fanatic Member
ic!....thank! for the help!!..btw how do i 'integrate' this part of a small code with a hyperlink from an e-mail?
-
Apr 13th, 2004, 12:00 AM
#21
Thread Starter
Fanatic Member
funny..when i first try it on my pc...it works...but now when i try on other pcs...and i save as ....html ..and i open it ..it is just pure text??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|