OS specific functions?


#1

Hi everybody,

I am a seasoned Windows programmer but still a virgin to JUCE, and before I get lost, I would like to ask some questions:

Is it possible to access very OS specific functions from within a JUCE app?
What I want to do, is to call DDE (Dynamic Data Exchange) functions of Windows. DDE allows to setup a memory block that is shared by all applications on the computer that have the access key to it. Can that be done using JUCE?

As a second question: Does anybody know about a function equivalent to DDE on macOS? And how it is called?

A big thanks for every answer!
Michael


#2

I could be mistaken, but have a look at the InterprocessConnection and InterprocessConnectionServer classes in juce

InterProcessConnectionServer usage has a nice (untested) example in it showing how to set up two applications on a computer that can talk to each other.
the nice thing about InterprocessConnection is that the client sends/receives MemoryBlock instances.


#3

JUCE will not stop you from linking the DDEML into your application. That way you can interoperate with existing DDE aware software (I haven’t done that).

However, using this restricts your application for use on windows only.

@matkatmusic posted an abstraction JUCE provides. It communicates via NamedPipes or TCP sockets. This might be an alternatice, if you only want to communicate with your own programs or other JUCE made software.

It is also easy to implement the counterpart in different languages, as it is very low level. It simply adds 8 bytes to each packet, 4 bytes being a magic number for identification and 4 bytes as the number of bytes for the following packet.
We use this e.g. to communicate with an electron (node.js) frontend.

The Mac version (or one of them) is the XPC API: https://developer.apple.com/documentation/xpc
Another version is to use the LaunchServices, which is used to send data to another application to let it deal with it.
It can be used for more tasks than only open, save or print: https://developer.apple.com/library/content/documentation/Carbon/Conceptual/LaunchServicesConcepts/LSCConcepts/LSCConcepts.html
This is e.g. used for FxPlug plugins for FinalCut etc.


#4

Hi matkatmusic,

thanks a lot for the hint, I ll go and try it asap.


#5

Hi Daniel,

a big thank you - top info!