Results 1 to 21 of 21

Thread: hyperlink

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908

    hyperlink

    is it possible to use hyperlink on the internet to open an application in a pc?

  2. #2
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871
    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

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908
    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...

  4. #4
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    Yes it can. TheVader provided some code (JavaScript). Since this is a VB forum, here is something else

    VB Code:
    1. Dim Shell
    2. Set Shell = WScript.CreateObject("WScript.Shell")
    3. 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

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908
    hi thanks for the reply...but i receive the error : object require..

  6. #6
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    What line does it say the error is on?


    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908
    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?

  8. #8
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    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

  9. #9
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    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

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908
    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

  11. #11
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    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

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908
    if i am not wrong the above code is wriiten in vb?

  13. #13
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    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

  14. #14

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908
    wat do i need in order to write a java script? java software itself?

  15. #15
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    No, Javascript comes with Internet Explorer. You don't need anything.

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  16. #16

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908
    thanks for your help...need i need lots of readup in this area..

  17. #17
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871
    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

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  18. #18

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908
    wat i receive virus???? kid me!!!

  19. #19
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871
    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

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  20. #20

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908
    ic!....thank! for the help!!..btw how do i 'integrate' this part of a small code with a hyperlink from an e-mail?

  21. #21

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908
    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
  •  



Click Here to Expand Forum to Full Width