Calling a function from .DLL, or calling C2 from .EXE

Just started using Construct 2? Post your questions here

Post » Wed Oct 21, 2015 9:24 pm

Hello,

Sorry for the crowded title. I want to do use Construct2 TTS, but the string I want to be read is generated by another program. Here is the scenario I have in mind:
Construct2: Calls function F (with string parameter). F exists in a .DLL file.
The .DLL file: Generates string S, and sends it to C2.
.. and so on ..

Is there a general method to do so ? I mean a method to send messages between C2 and local applications/.DLL

Thank you.
B
7
G
1
Posts: 11
Reputation: 402

Post » Wed Oct 21, 2015 9:33 pm

You can pass commands to the CLI from Node Webkit. I think it is called Run application.
https://www.scirra.com/manual/162/nwjs
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Thu Oct 22, 2015 3:39 am

The only problem is passing values to the exe or getting values back. You could use the clipboard for this but that's a bit hacky. Another option is using a file to return the data, but it's not ideal.

Outside of that there appears to be plugin for nw.js to communicate with other dlls or you could make a plugin. The problem is, to do either you need to re-compile the nw executable, and unless you're very familiar with the process, it won't be easy.

Would it be possible to make the program with js instead? That is if you made it. That way it's very doable to make a c2 addon that communicates with it.
B
91
S
31
G
102
Posts: 5,232
Reputation: 67,250

Post » Thu Oct 22, 2015 10:11 pm

Thank you very much for the help.

I think the file method (using NW.js) will make it hard to know when a program edits a file. If the file is shared between the two processes, how does one know when the other is done editing ?
The clipboard method seems clever! and the js seems promising might try them.
B
7
G
1
Posts: 11
Reputation: 402

Post » Fri Oct 23, 2015 2:57 am

With what we have access to I don't think we can know when a process is done with a file. The simplest solution would be to access the file after a set amount of time. Just be sure the program can finish before the c2 export accesses the file.
The same idea could be applied to the clipboard idea.
B
91
S
31
G
102
Posts: 5,232
Reputation: 67,250

Post » Fri Oct 23, 2015 12:15 pm

Thank you, R0j0hound :)
B
7
G
1
Posts: 11
Reputation: 402


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests