转换基于计时器的应用基于事件的应用程序。在C ++中 [英] Convert timer based app. To event based app. In C++

查看:76
本文介绍了转换基于计时器的应用基于事件的应用程序。在C ++中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个应用程序。适用于c ++中的windows计时器



我想在另一个应用程序中将它用作奴隶。但主应用程序。顺序。



在主应用程序中。我们声明在完成所有必要的



计算后通过了1秒(实际时间可以少很多或者更多)



在奴隶应用程序中。有一个真正的计时器,其持续时间为1秒

我想做的是在主应用程序中。当它决定1秒钟通过它应该发送某种事件给奴隶,这将导致其计时器达到其持续时间并激活计时器回调



应用程序沟通通过UDP



谢谢!



我尝试过:



有些乱搞SetWaitableTime但没有结果

Hi

I have an app. which works with windows timer in c++

i want to use it as a slave in another app. but the master app. is sequential.

In the master app. we declare that 1 second passed after completing all the necessary

calculations (the actual time can be a lot less or a lot more)

In the slave app. there is a real timer which its duration is 1 second
What i want to do is in the master app. when it decided that 1 second passed it should send some kind of an event to the slave which will cause its timer reach its duration and activate the timer callback

The apps communicate through UDP

Thanks!

What I have tried:

Some messing around with SetWaitableTime but with no results

推荐答案

问题出在哪里?



您已经拥有IPC(进程间通信)。让主设备向从设备发送特定的包,然后相应地执行操作(调用回调函数并可选地停止或重新启动计时器)。包实现称为协议


这篇关于转换基于计时器的应用基于事件的应用程序。在C ++中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆