0

我希望在 C++ 程序中使用 autohotkey 的功能。我目前正在运行由 c++ 程序触发的脚本——我只是将它们作为 .bat 文件运行。这很好用,但问题是我无法将脚本中的值返回给 c++ 程序。

我希望能够从脚本中读取鼠标的位置,并在我的 C++ 程序中基于此做出决定。我的脚本做了相当复杂的事情——所以在 autohotkey 中这样做对我来说是最好的解决方案——我了解 C,但对 C++ 知之甚少。

我已经阅读了 Autohotkey .DLL - 我知道如何触发它,但不知道如何从中读取值。如果有人可以指导我,甚至发布加载 .dll 并将值发送到脚本并返回值的示例代码 - 我将永远感激不尽!

我花了几个小时在这上面,但无济于事!

4

2 回答 2

0

I'm not sure about the dll, but you could just write your own application in Autohotkey and package it along with your C++.

The communication takes place over a hidden window with an edit control and a button. You use one application to set text in the edit box, and then to click the submit button. The other application owns the window can process whatever is put into the edit control - as if you were passing a variable. Basically, that's it.

Check out this thread where I've explained it in more detail: How to send a command to a running application via commandline

Now, that's not quite what you wanted, but the effect is the same, and you already know all the api.

于 2013-12-15T02:08:03.563 回答
0

返回一个值,这可能工作http://www.autohotkey.net/~tinku99/ahkdll/functions/ahkgetvar.htm

于 2011-03-09T14:08:07.630 回答