What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » newbie wants to call C++ program

Pages: (2): « First [ 1 ] 2 » Last »
newbie wants to call C++ program
Author: Message:
Hen
Junior Member
**


Posts: 37
Joined: Aug 2007
O.P. newbie wants to call C++ program
Hi all,
I just read about this messenger scripting option few days ago, and its very freidnly programming.
1) Can I combine in my script, C++  / VB programs?
If a certain event happens, I want to send event parameters to a C++ program.

2) Do you know a way to send data to the serial port? (Js / C++ / C / VB )
Same as before:
On_certain_event(parameter_X) => send_Serial_port(parameter_X)

Thanks!

Hen.
08-28-2007 10:08 PM
Profile E-Mail PM Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
RE: newbie wants to call C++ program
you can make a C++ program, then compile it as a .dll file. The scripting environment can then call functions in the .dll file by way of the Interop.Call() function, as documented in the scripting documentation.
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
08-28-2007 10:13 PM
Profile PM Web Find Quote Report
Hen
Junior Member
**


Posts: 37
Joined: Aug 2007
O.P. RE: RE: newbie wants to call C++ program
quote:
Originally posted by MeEtc
as documented in the scripting documentation.


You mean something like this?
(1)
<OleFiles>   
    <FileName>C++_function.dll</FileName>
</OleFiles>

If this is it, what's the difference, and when to use:
<OleFiles> OR <DotNetFiles> ?

(2) I saw in one of the threads back in 2006, that if I want to register a dll file I need to write in the Initialization:
var sDll = new ActiveXObject('Project_Name.Class_name');

and what do they mean by "initialize"?
i.e ?
function OnEvent_Initialize(MessengerStart)
{
var sDll = new ActiveXObject('Project_Name.Class_name');
}

(3) calling the function:
sDll.function(parameters);

(4)
So what do I need to do? (1) + (3) ? or (1) + (2) + (3) ?

(5)
Now I guess I can handle the serial port with C++, but just for general knowledge, is there a way to handle it also with Js?
(Guess its harder, 'cause Js is more for web development unlike C++...)

Thanks!
quote:
Originally posted by MeEtc
can then call functions in the .dll file by way of the Interop.Call()


...oops didnt notice that one before.

OK, so I can call the function.
(So why back in 2006, they posted you should call a function using " sDll.function(parameters); " ?)
But regarding my previouse reply - I register it by (1) or (2) or someother way?, or if I just save it in the script library as .dll it will recognize it?

Thanks!
08-29-2007 12:32 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: newbie wants to call C++ program
C++ Dlls do not need to be registered and they have their functions Exported so you can simply call it like so.

code:
Interop.Call('dllname.dll', 'FunctionName', <params>);

The OleFiles is for Dlls that need to be registered before they can be used. For instance you need to register a Visual Basic DLL before  you can use it as an ActiveXObject.
08-29-2007 12:48 PM
Profile E-Mail PM Find Quote Report
Hen
Junior Member
**


Posts: 37
Joined: Aug 2007
O.P. RE: RE: newbie wants to call C++ program
quote:
Originally posted by matty
you need to register a Visual Basic DLL before  you can use it as an ActiveXObject.


OK, cool. Now I can work with C++.
In case I need VB I understand I need to register using "OleFiles".
How do I register? using the next? :
<OleFiles>
<FileName>C++_function.dll</FileName>
</OleFiles>
Do I need also to write:
var sDll = new ActiveXObject('Project_Name.Class_name');

And how do I call it - using "sDll.function(parameters); " or just like for C++ : " Interop.Call('dllname.dll', 'FunctionName', <params>); " ?

Thanks!

This post was edited on 08-29-2007 at 01:03 PM by Hen.
08-29-2007 12:59 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: newbie wants to call C++ program
Visual Basic does not export the DLLs when you compile it. You need to create an ActiveXObject for it.

code:
var MyActiveXObj = new ActiveXObject('ProjectName.ClassName');

MyActiveXObj.MyFunction('hi', 'we', 'are', 'params);

matty's reply to [Resolved] Talking to VB.

This post was edited on 08-29-2007 at 01:05 PM by matty.
08-29-2007 01:03 PM
Profile E-Mail PM Find Quote Report
Hen
Junior Member
**


Posts: 37
Joined: Aug 2007
O.P. RE: RE: newbie wants to call C++ program
quote:
Originally posted by matty
Visual Basic does not export the DLLs when you compile it. You need to create an ActiveXObject for it.

code:
var MyActiveXObj = new ActiveXObject('ProjectName.ClassName');

MyActiveXObj.MyFunction('hi', 'we', 'are', 'params);



You were quicker than me in 10seconds... :-)
I just updated my reply....

By the way, what's excatly the difference between <OleFiles> and <DotNetFiles> ?

Thanks!

08-29-2007 01:05 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: newbie wants to call C++ program
quote:
Originally posted by Hen
You were quicker than me in 10seconds... :-)
I just updated my reply....

By the way, what's excatly the difference between <OleFiles> and <DotNetFiles> ?

Thanks!
OleFiles are Visual Basic (requiring regsvr32 for registering) and DotNetFiles are Visual Basic.Net and C#.Net (requiring regasm for registering)
08-29-2007 01:06 PM
Profile E-Mail PM Find Quote Report
Hen
Junior Member
**


Posts: 37
Joined: Aug 2007
O.P. RE: RE: newbie wants to call C++ program
quote:
OleFiles are Visual Basic (requiring regsvr32 for registering) and DotNetFiles are Visual Basic.Net and C#.Net (requiring regasm for registering)


On the basis of .net_file = <DotNetFile> should have called it <VBFile> .... ;-)

Didnt see that at first... just didnt pop into my mind. <DotNetFile> much more logic name... :-)

Thanks!

This post was edited on 08-29-2007 at 01:19 PM by Hen.
08-29-2007 01:19 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: newbie wants to call C++ program
OLE stands for Object Linking and Embedding. It makes perfect sense but that is neither here nor there. Glad you made sense of it all now.
08-29-2007 01:48 PM
Profile E-Mail 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