Using .dll file in html and javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gennady46
    New Member
    • Nov 2009
    • 1

    Using .dll file in html and javascript

    Hi, I wrote the following class in C++ just to test:
    Code:
    #pragma once
    #include <windows.h>
    #include <stdio.h>
    namespace Test1 {
    
    public ref class Class1
    { public: void Web_Code()  
       { DeleteFile("c:\\Test_Web.txt"); 
         printf("Hello"); 
        }
    };
    }
    And built it. So I got Web_Test.dll
    I uploaded to my web folder Web_Test.dll
    And inserted html onto the web page:
    Code:
    <OBJECT id="control"
            classid="http:Web_Test.dll#Test1.Class1">
            </OBJECT>
     <script language="javascript">
          function doScript()
           {
            control.Web_Code();
           }
           </script>
       <body onLoad="javascript:doScript();">
    What it suppose to do is to delete a file on a hard drive and print "Hello" on a screen as a web page is
    being opened.

    But it does not work!
    Can you tell me what is wrong here.
    Thanks in advance, G.G.
    Last edited by gits; Nov 11 '09, 04:13 AM. Reason: added code tags
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    i doubt that this will work ... the only possibility that i'm aware of for such things would be to build an ActiveX component that could be included with an object-tag and then executed in IE only ... it would be a massive security issue in case a browser would allow what you have intended ... imagine a webpage that could delete files on your filesystem ...

    kind regards

    Comment

    Working...