Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

C++, Keyboard & EventGhost

If you have a question or need help, this is the place to be.
Post Reply
deus
Posts: 3
Joined: Wed Dec 04, 2013 8:18 am

C++, Keyboard & EventGhost

Post by deus »

Hello, I'm writing a program in Borland C + +,and I would control it from GhostEvent level.
I turned on the plugin "Keyboard" in EventGhost and I will send of information that button is pressed in this form:
> keybd_event(0x41, 0, 0, 0);
> keybd_event(0x41, 0, KEYEVENTF_KEYUP, 0);
but Evenghost can't detect this. Does anyone knows another way how to do it? Maybe you know some other idea how to send information about the event from another program in C + + to EventGhost. (Beyond Python)
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: C++, Keyboard & EventGhost

Post by krambriw »

Use sockets
deus
Posts: 3
Joined: Wed Dec 04, 2013 8:18 am

Re: C++, Keyboard & EventGhost

Post by deus »

What socket? How?
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: C++, Keyboard & EventGhost

Post by krambriw »

IP communication, tcp/udp. Eventghost has already plugins for receiving & sending messages via socket communication...search the forum for it.

Since all source code is open, you can easily study existing python implementations. How to use sockets for ip communication in C++ is something...you have to figure out but there should be tons of samples to find using google

In addition there are many other possibilities, you just have to check out the plugin section to find out. But since you are in C++ you obviously have to find a solution fitting your own preference

Here are a few I'm thinking of, all already supported in EG when using dedicated plugins:
- websockets
- http using web server plugin
- MQTT
- UDP/TCP socket
- OPC
- email
- serial rs232
- xPL
- IR (infrared, if the two systems can have free view of sight in between))
- database (mySQL)

and maybe some I have forgotten to mention

Anyway, I would rate them as folllows:

1) For a quick start, look at the http using the latest webserver plugin
2) If you need a message broker system, look at MQTT (Internet of Things)
3) A fast and efficient way, look at sockets, check the Network Event Receiver & Sender plugin
4) If you plan to build a system with gui using web pages and like to have fast updates of individual elements on the page without having to do page refresh, look at websockets

Personally, to integrate systems, I would tend to select a message broker. Like MQTT. I believe that the *Internet of Things* will be something we will see more of in the future and when you continue to add stuff to your home in the future, they will all be interconnected.
Even if socket communication is the fastest I have tried, the performance of MQTT is still very good. I am running the MQTT broker in a Raspberry Pi and all my MQTT Clients are connected via this broker (including EG).

BestR
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: C++, Keyboard & EventGhost

Post by Pako »

Walter wrote it correctly, but unfortunately it is not complete.
He did not mention the other ways to trigger an event in EventGhost using an external program:
1) Command line - see documentation
2) ActiveX/COM - see, for example, the topic COM Integration with other apps that require a type library?
3) Windows messaging - see, for example, the plugin MusicBee

I think that even at this moment, the options list is incomplete.

Pako
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: C++, Keyboard & EventGhost

Post by krambriw »

:D

Thanks Pako, there are soooo many options, it is soon impossible to remember all...

Maybe if the user only wants to run two applications (his C++ and EG) in the same computer, I would reconsider my suggestion and consider windows messaging.

Best regards and many thanks,
Walter
deus
Posts: 3
Joined: Wed Dec 04, 2013 8:18 am

Re: C++, Keyboard & EventGhost

Post by deus »

Thank you for your help. SendImput already tried, but without success. I tried otherwise. It might work ...
Post Reply