Click here to Skip to main content
15,884,176 members
Articles / Web Development / ASP.NET

Extending .NET Events Functionality

Rate me:
Please Sign up or sign in to vote.
4.48/5 (15 votes)
14 Nov 2007CPOL6 min read 49.9K   1.2K   32  
This article explains how to extend the standard .NET event and delegate mechanism with extra features
<html>

<head>
</head>

<body>
    <form name="test">
    <p>Make sure you have registered clocks.dll as follows:</p>
    <p>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe Clocks.dll /tlb:Clocks.tlb /codebase</p>
    <input type="button" id="bn_start" value="Start clock test" onClick="bn_start_onClick()"></input>
    <input type="button" id="bn_stop" value="Stop clock test" onClick="bn_stop_onClick()"></input>
    <p>
    <span id="text_tag">0</span>
    </p>
        <script language=JScript>
            function text_tag::onclick()
            {
                document.getElementById("text_tag").innerHTML = 0;
            }
        </script>
</body>

<script type="text/javascript" language="jscript">
var clock;

function bn_start_onClick()
{
//debugger;
	alert('Press OK to start');

	clock = new ActiveXObject("Clocks.clock");
	var extendedClockEvents = clock.ExtendedClockEvents();
	extendedClockEvents.ScriptCallbackObject = clock_Callback;

    clock.Start(1000);
}

function bn_stop_onClick()
{
    if (clock != null)
    {
        clock.Stop();
    }
}

function clock_Callback(time)
{
    document.getElementById("text_tag").innerHTML = time;
}    

</script>

</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader
Belgium Belgium
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions