What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Trouble creating a DLL that works in Plus

Trouble creating a DLL that works in Plus
Author: Message:
a0369
Junior Member
**

Avatar

Posts: 16
35 / Male / Flag
Joined: Oct 2004
O.P. Trouble creating a DLL that works in Plus
I've spent quite some time trying to get a DLL file to work by using the Interop.Call function, but it just won't accept it.

Here's what I have so far.

c code:
#include "stdafx.h"

#ifdef __cplusplus    // If used by C++ code,
extern "C" {          // we need to export the C interface
#endif

__declspec(dllexport) int __stdcall GetScreenSize(int avar)
{
    //some code here
    return 1;
}

#ifdef __cplusplus
}
#endif

I just want to get the dll to work so I can use it, but messenger plus will not call the function.
10-12-2008 08:18 PM
Profile PM Web Find Quote Report
felipEx
Scripting Contest Winner
***


Posts: 378
Reputation: 24
35 / Male / Flag
Joined: Jun 2006
RE: Trouble creating a DLL that works in Plus
quote:
Originally posted by a0369
c code:
__declspec(dllexport) int __stdcall GetScreenSize(int avar)

I had to use:
c code:
__declspec(dllexport) int GetScreenSize(int avar)

jscript code:
    Debug.Trace(Interop.Call(MsgPlus.ScriptFilesPath + "\\test.dll", "GetScreenSize", 16 /* or any value*/ ))
    Interop.FreeDll(MsgPlus.ScriptFilesPath + "\\test.dll")


btw, what are you trying to do? :p
10-12-2008 11:13 PM
Profile E-Mail PM Find Quote Report
a0369
Junior Member
**

Avatar

Posts: 16
35 / Male / Flag
Joined: Oct 2004
O.P. RE: Trouble creating a DLL that works in Plus
find the screen resolution, if I can just get the function to be able to be called, I should be good to go from there. I tried taking out the __stdcall, but it still can't be called
10-12-2008 11:22 PM
Profile PM Web Find Quote Report
felipEx
Scripting Contest Winner
***


Posts: 378
Reputation: 24
35 / Male / Flag
Joined: Jun 2006
RE: Trouble creating a DLL that works in Plus
Well, you don't need a special DLL to achieve this. :D
jscript code:
var rc = Interop.Allocate(16);
Interop.Call("user32", "GetWindowRect", Interop.Call("user32", "GetDesktopWindow"), rc);
Debug.Trace("screen resolution: " + rc.ReadDWORD(8) + 'x' + rc.ReadDWORD(12))

rc.Size = 0;
I know theres another way, i'll post it later...

just open up the Script Debugging window and you'll see something like this:
quote:
Script is starting
Script is now loaded and ready
Function called: OnEvent_Initialize
screen resolution: 1280x1024

if you still want to create that DLL, just have a read at this article at msdn ;)

This post was edited on 10-12-2008 at 11:45 PM by felipEx.
10-12-2008 11:40 PM
Profile E-Mail PM Find Quote Report
a0369
Junior Member
**

Avatar

Posts: 16
35 / Male / Flag
Joined: Oct 2004
O.P. RE: Trouble creating a DLL that works in Plus
thanks for the screen resolution code, if I ever need to create a DLL, I'll try following what that tutorial says.
10-13-2008 01:22 AM
Profile PM Web Find Quote Report
davidpolitis
Full Member
***


Posts: 371
Reputation: 16
Joined: Aug 2006
RE: RE: Trouble creating a DLL that works in Plus
quote:
Originally posted by felipEx
I know theres another way, i'll post it later...
jscript code:
Interop.Call("User32", "SystemParametersInfoW", SPI_GETWORKAREA, 0, rc, 0);
10-13-2008 10:18 AM
Profile PM Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: Trouble creating a DLL that works in Plus
quote:
Originally posted by felipEx
quote:
Originally posted by a0369
c code:
__declspec(dllexport) int __stdcall GetScreenSize(int avar)

I had to use:
c code:
__declspec(dllexport) int GetScreenSize(int avar)

:-/ the documentation says you must use __stdcall calling convention.

quote:
FunctionName
[string] Name of the function as specified in the export table of the library. The function must use the __stdcall calling convention. See Remarks.


This post was edited on 10-13-2008 at 11:24 AM by Mnjul.
10-13-2008 11:24 AM
Profile PM Web Find Quote Report
a0369
Junior Member
**

Avatar

Posts: 16
35 / Male / Flag
Joined: Oct 2004
O.P. RE: Trouble creating a DLL that works in Plus
i know the documentation says you need to use the __stdcall, but it still doesn't accept, is there something that needs to be changed? I'm using Visual Studio 2005 btw
10-13-2008 04:52 PM
Profile PM Web Find Quote Report
« 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