By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,270 Members | 1,582 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,270 IT Pros & Developers. It's quick & easy.

capture Event of VB DLL in Javascript

P: 6
Hi.................,

i want to capture event from vb dll file in javascript,actually i can already access all the function of that dll from javascript but i don know how to capture event raised by ny vb dll file in my web page from javascript............if u have any solution plz post it as early as possible.

my code is as follows


[HTML]<html>
<head>
<title></title>
</head>
<SCRIPT language="javascript">
function comEventOccured()
{
var msg;
var obj =new ActiveXObject("e3_TestProj4ASP.e3_Test");
obj.GetUCaseStr("super"); // function that raises the custom event
// UppercaseStr(msg)

)
function UppercaseStr(msg)
{
alert(msg);
document.write(msg);
alert("After Event");
}



</SCRIPT>
<body>

<INPUT TYPE=button value=MethodCall onClick="comEventOccured()">
</body>

</html>[/HTML]

************************************************** **********************************

e3_TestProj4ASP.dll

UppercaseStr(msg) is the event raised in Vb dll as

raiseEvent UppercaseStr(msg)

msg is the dim variable returned by my event, so whenever i capture it i need to have the value of that msg variable.

thanx
Nov 22 '07 #1
Share this Question
Share on Google+
9 Replies


acoder
Expert Mod 15k+
P: 16,027
Welcome to TSDN!

If you use document.write after the page has loaded, it will open a new document for writing. Where do you want this new valueto be displayed?

PS. If it's just uppercase that you want, why not use JavaScript instead of VB for this?
Nov 22 '07 #2

P: 6
Welcome to TSDN!

If you use document.write after the page has loaded, it will open a new document for writing. Where do you want this new valueto be displayed?

PS. If it's just uppercase that you want, why not use JavaScript instead of VB for this?
hi..............

i don have dip knowledge in jscript, so i don know hthat document.write is of vbscript, but it doesn't make call to event.

i mean whenever we call the above function it raises the UppercaseStrn event which returns the msg parameter which is then useful to me.

but i cant capture the raised event, i don want to display the msg parameter i just want to pass it in new page through jsp.but alert(msg) does not called, it means raised event is not captured by ny Uppercase function

i hope u got it properly........
By the way thanx for replying....& if u have any idea plz send me urgent........
Thanx a lot
Hirru
Nov 23 '07 #3

acoder
Expert Mod 15k+
P: 16,027
If you want to pass the msg value to your JSP page, set a form input element to that value, e.g.
[HTML]<input id="msg" name="msg" type="text">[/HTML] then in your JavaScript function, instead of the alert, try:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("msg").value = msg;
You then need to submit this value to the JSP script.
Nov 23 '07 #4

P: 6
[HTML]<html>
<head>
<title></title>
</head>
<SCRIPT language="javascript">
function comEventOccured()
{
var msg;
var obj =new ActiveXObject("e3_TestProj4ASP.e3_Test");
obj.GetUCaseStr("super"); // function that raises the custom event
// UppercaseStr(msg)

)
function UppercaseStr(msg)
{
document.getElementbyId("msg")=msg;
}
</SCRIPT>
<body>
<INPUT TYPE=button value=MethodCall onClick="comEventOccured()">
</body>
</html>[/HTML]
Nov 23 '07 #5

acoder
Expert Mod 15k+
P: 16,027
Try this:[HTML]
<html>
<head>
<title></title>
</head>
<SCRIPT type="text/javascript">
function comEventOccured()
{
var msg;
var obj =new ActiveXObject("e3_TestProj4ASP.e3_Test");
obj.GetUCaseStr("super"); // function that raises the custom event
// UppercaseStr(msg)

)
function UppercaseStr(msg)
{
document.getElementById("msg").value=msg;
}
</SCRIPT>
<body>
<form action="yourJSPscript.jsp">
<input id="msg" type="text">
<INPUT TYPE=button value=MethodCall onClick="comEventOccured()">
<input type="submit">
</form>
</body>
</html>[/HTML]
Nov 23 '07 #6

P: 6
First of all Once again thanx for replying

<B>My DLL file is as follows</B>

Expand|Select|Wrap|Line Numbers
  1. Public Event UppercaseStr(UStr As String)
  2.  
  3. Public Sub GetUCaseStr(MsgStr As String)
  4.     Dim UString As String
  5.  
  6.     TimerTask 5
  7.  
  8.     UString = UCase(MsgStr)
  9.     RaiseEvent UppercaseStr(UString)
  10. End Sub
  11.  
************************************************** *****

Now, the actuall problem is that when i call the
GetUCaseStr("super") Function as

obj.GetUCaseStr("super") ...........it wait for 5 second, then convert the string into Uppercase and raise the Event UppercaseStr which return a "SUPER" as String.

But when i call the obj.GetUCaseStr("super"), it is successfully called, then it waits for 5 second, it means the event in the dll is raised but it wont be captured in Javascript.

So i need help in javascript that how to capture that event which is raised in dll...
i have searched almost forum and sites, i din get this answer..related to
Event capturing in Javascript

Thanx a lot Once Again for replying me
Hirru
Nov 23 '07 #7

acoder
Expert Mod 15k+
P: 16,027
Is this the only thing that you require in VB, i.e. making a string upper case? Or is this just an example and you're going to make calls to other VB DLLs?

If it's just this, then there's no need for VB - JavaScript can also convert a string to upper case.
Nov 25 '07 #8

P: 6
Thank-U very very much again for replying

No, Its just testing actual thing is different.........................................

But I got the solution wchin is written bellow

[HTML]<html>
<head>
<title></title>
<div style="display: none">
<object Progid="e3_TestProj4ASP.e3_Test" id="dllobjr"
classid="ClsId:A11D6C46-5968-4BB9-BF56-C974EF87BFAD" style="display: none;">
</object>
</div>

<script type="text/javascript" FOR="dllobj" EVENT="UppercaseStr(msg)" Viewastext>
alert( "I just caught the event!"+ msg );
</script>
</head>
<body>
<b>This contains the "object" tag</b><br>

<input type=button onclick=VBxSignaler.GetUCaseStr("super") value="FireEvent" /><p>
</body>
</html>
[/HTML]
NOTE: This page is working if it is running in any of the
Appication Server Such as Tomcat. IIS,etc......depends on your application.

It can be Jsp, Asp or Html page.....you can do the same in any way......

Thanx...ba bye
Nov 26 '07 #9

acoder
Expert Mod 15k+
P: 16,027
This would obviously only work in IE.

Anyway, I'm glad you got it working. Post again if you have any more questions.
Nov 26 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.