Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Interprocess Comunication (SendMessage / GetMessage)  (Read 4517 times)

0 Members and 1 Guest are viewing this topic.

globalenemy

  • Newbie
  • *
  • Posts: 10
    • View Profile
Interprocess Comunication (SendMessage / GetMessage)
« on: March 22, 2016, 05:35:10 pm »
I'm trying very hard to find out, how to implement (atleast) the functionality to send messages to my SFML application from another application. It allready seems very hard to find a standard example, that is somewhat useful or at all a tutorial. I've never done this before in any other framework, especially not in SFML.


I personally want to realize this using the DotNet Bindings but I couldn't even find an SFML solution in c++, so I thought I should post this topic here.


Anyone here knows how this would be done?

edit: The application would run on a Windows machine.
« Last Edit: March 22, 2016, 11:19:04 pm by globalenemy »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Interprocess Comunication (SendMessage / GetMessage)
« Reply #1 on: March 22, 2016, 06:53:54 pm »
SFML doesn't provide any inter process communication functonality.

So you basically just need to use something OS specific or use another library dedicated to that. Which in turn has nothing to do with SFML anymore and thus might be better suited for something like StackOverflow.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

globalenemy

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Interprocess Comunication (SendMessage / GetMessage)
« Reply #2 on: March 22, 2016, 10:40:54 pm »
The application would run on a Windows machine. It should have to do with SFML. Because SFML is providing the window. So I need to add this functionality somehow. From your post it seems you don't know how to do that. Or do you?

bitano

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: Interprocess Comunication (SendMessage / GetMessage)
« Reply #3 on: March 22, 2016, 10:57:14 pm »
So 1 application is your SFML application. What kind of application is the other one?

If you have full control over both applications and all you want is for them to communicate with eachother, you *could* also consider using a TCP listener and sending packets.

Or is that way off target?

globalenemy

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Interprocess Comunication (SendMessage / GetMessage)
« Reply #4 on: March 22, 2016, 11:13:33 pm »
Delphi Pascal, but that doesn't matter because would like to use the Windows Messaging System.

I need my SFML application to provide a way so that any other application has a way to talk to it.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms644927%28v=vs.85%29.aspx#handling
https://msdn.microsoft.com/en-us/library/windows/desktop/ms632593%28v=vs.85%29.aspx

I'm open for anything that works. Friend of mine, who will be coding the other end application allready suggested it could be possible to do it via shared memory. But so far that's way out of my league
« Last Edit: March 22, 2016, 11:21:15 pm by globalenemy »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Interprocess Comunication (SendMessage / GetMessage)
« Reply #5 on: March 23, 2016, 01:11:09 am »
As I said SFML doesn't provide a way to hook yourself into the event/message queue of the window, as such it can't be done through the API.

If you can't think of another communication channel, then you could modify SFML itself.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Interprocess Comunication (SendMessage / GetMessage)
« Reply #6 on: March 23, 2016, 02:53:32 am »
SystemHandle (.NET binding since you mentioned it and C#) is what you need from SFML. Implementing the actual communication is up to you.

If you're comfortable with a bit of C++, Boost.Interprocess should make shared memory easier. If you're wanting to do the main application in C#, writing a wrapper to call the C++ dll isn't difficult at all.

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: Interprocess Comunication (SendMessage / GetMessage)
« Reply #7 on: March 26, 2016, 02:51:32 pm »
You can use sockets. SFML implements some wrappers for network. But I didn't used it, because dotnet already provides System.Net namespace with all what you need. Also you can use WCF, it allows you to use pipe or tcp channel.

I don't recommend you to use shared memory or window messages, because it will be pain to port such app to another platform
« Last Edit: March 26, 2016, 02:55:24 pm by mkalex777 »

 

anything