What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » DLL function detection (?) + weird error

Pages: (2): « First [ 1 ] 2 » Last »
DLL function detection (?) + weird error
Author: Message:
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. DLL function detection (?) + weird error
Hi,

I have 2 questions (and it seems a bit stupid to me, to post 2 threads in less than 15 min. :P ).

1.

Is there a way to detect when a DLL function is called (so when I display a message box using "MessageBoxW" in "User32.dll")?

2.

In the following piece of code, I get some weird error (though my scirpt works perfectly):

code:
    var Contacts = Messenger.MyContacts;
    var e = new Enumerator(Contacts);
    var c = Contacts.Count;
    for(i = 0; i < c; i++) {
        e.moveNext();
        Contact = e.item();
        EmailArray[i] = Contact.Email; // This line keeps giving a "-2146823281"-error..
//        Debug.Trace(EmailArray[i]); Disabled.. Only gives the email addresses from the contactlist..
        WndEmail.Combo_AddItem("Email",Contact.Email);
    }

The error states that Contacts.Email is an empty object.
Part of the problem is my ability to understand the "for()" statement.. Which I don't really really don't understand..



2nd question solved :D

This post was edited on 04-14-2008 at 04:27 PM by SmokingCookie.
04-13-2008 05:14 PM
Profile PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: DLL function detection (?) + weird error
1. it's your script... shouldn't you be able to tell other parts of it when you call a DLL yourself?

2.

try this:

var Contacts = Messenger.MyContacts;
var e = new Enumerator(Contacts);
while (e.moveNext()) {
var contact = e.item();
EmailArray[i] = contact.Email;
WndEmail.Combo_AddItem("Email",contact.Email);
}

This post was edited on 04-13-2008 at 05:53 PM by ShawnZ.
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
04-13-2008 05:52 PM
Profile PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: RE: DLL function detection (?) + weird error
quote:
Originally posted by ShawnZ
1. it's your script... shouldn't you be able to tell other parts of it when you call a DLL yourself?

2.

try this:

var Contacts = Messenger.MyContacts;
var e = new Enumerator(Contacts);
while (e.moveNext()) {
var contact = e.item();
EmailArray[i] = contact.Email;
WndEmail.Combo_AddItem("Email",contact.Email);
}

1.

I actually mean, that as soon as Windows calls a function in a DLL, I'd like to know of its name and parameters.. I have DLLExp, which only reads the DLL's function names and some weird "address" thing..

2.

I'm sorry to say that your code doesn't work.. It gives me an empty combobox.. :S
04-13-2008 06:00 PM
Profile PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: DLL function detection (?) + weird error
quote:
Originally posted by SmokingCookie
I actually mean, that as soon as Windows calls a function in a DLL, I'd like to know of its name and parameters.. I have DLLExp, which only reads the DLL's function names and some weird "address" thing..

you mean, when any program on the system calls a certain DLL? that's a lot harder to do...
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
04-13-2008 06:03 PM
Profile PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: DLL function detection (?) + weird error
Indeed.. That's why my last hope is this forum.. I am not too lazy to select the process/DLL myself, if only I could get the function names and parmeters..

And I think I'll have to live with the error :S
04-13-2008 06:07 PM
Profile PM Find Quote Report
felipEx
Scripting Contest Winner
***


Posts: 378
Reputation: 24
35 / Male / Flag
Joined: Jun 2006
RE: DLL function detection (?) + weird error
it's a bit late for a reply (A)

quote:
Originally posted by SmokingCookie
I actually mean, that as soon as Windows calls a function in a DLL, I'd like to know of its name and parameters.. I have DLLExp, which only reads the DLL's function names and some weird "address" thing..
Have you tried with SpyStudio?
Take a look at the picture, I installed a hook (using SpyStudio) to detect when 'MessageBox' is called ;D

[Image: spystudiovs5ee6.th.png]
so, when you call 'MessageBox'  (in a script, for example) you will see the function's name and its parameters (useful when you want to learn about external application's behavior)
code:
Interop.Call('user32', 'MessageBoxW', 0, 'text', 'title', 64)


about the second question... try this:
code:
for(var e = new Enumerator(Messenger.MyContacts) ; !e.atEnd(); e.moveNext())
{
    Debug.Trace(e.item().Email);
// WndEmail.Combo_AddItem("Email", e.item().Email);   
}

:)
04-13-2008 08:30 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: DLL function detection (?) + weird error
code:
var EmailAddresses = new Array()
for (var e = new Enumerator(Messenger.MyContacts); !e.atEnd(); e.moveNext() ) {
    EmailAddresses.push(e.item().Email); // add the Contacts email address to the end of the array
    WndEmail.Combo_AddItem("Email", e.item().Email);
}

Or if you are as so inclined to create a loop to fill the Combo box...

code:
for (var i in EmailAddresses) {
    WndEmail.Combo_AddItem("Email", EmailAddresses[i]);
}
04-14-2008 11:44 AM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: DLL function detection (?) + weird error
Well, thanks for the replies.. Going to make homework nouw :( :S

I'll test these codes and SpyStudio later this afternoon, or in the evening..

EDIT:: Error solved.. Thanks (again :$ ) guys :D

This post was edited on 04-14-2008 at 04:10 PM by SmokingCookie.
04-14-2008 02:52 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: DLL function detection (?) + weird error
The problem with your code is that you call "e.moveNext()" at the beginning of your loop. This means that it'll start off by index 1 in the Enumerator object and will go past the end. Thus, you're actually missing the first contact and then you go past the end of the enumeration, giving you that "empty object" error. :)

In fact, there's an even better way to do this. Instead of using your numeric "i" variable in your for-loop, you can do the checks with the Enumerator and let the "i" variable increase with it. You don't even need to put it at the end of the loop yourself, you can place in the incremental statement by separating it with a comma from the "e.moveNext()"! And you can also do the same to define both the "i" and "e" variables! :P

This can give you code as short as this:
code:
for(var e = new Enumerator(Messenger.MyContacts), i = 0; !e.atEnd(); e.moveNext(), i++) {
Contact = e.item();
EmailArray[i] = Contact.Email;
WndEmail.Combo_AddItem("Email",Contact.Email);
}

Red = initial statement
Green = conditional statement
Blue = incremental statement
Just to show you how much you can simplify a piece of JScript by pushing it to the limits... :)

This post was edited on 04-14-2008 at 04:16 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
04-14-2008 04:13 PM
Profile E-Mail PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: DLL function detection (?) + weird error
Hey, I'm a serious n00b with the for() statement :P (it just doesn't make any sense to me :S )

Well, I think I have some things to experiment with for tonight :P
04-14-2008 04:19 PM
Profile PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On