简体   繁体   English

从C#内的VFP文本框中编写

[英]Write on a VFP textbox from within c#

In an application that I'm working on, I have the need to write in a VFP application's textbox and then to click a button (VFP too). 在我正在处理的应用程序中,我需要在VFP应用程序的文本框中编写内容,然后单击一个按钮(也是VFP)。

The application that I'm working on written in c#. 我正在使用C#编写的应用程序。 Is there a way to do this? 有没有办法做到这一点?

Thanks, i'm completely lost. 谢谢,我完全迷路了。

One way to do that would be to use native Windows messages as communication between both applications. 一种方法是将本机Windows消息用作两个应用程序之间的通信。 On the C# end you would use P/Invoke to call SendMessage with a custom message, passin the data to the VFP Window, while on the VFP end you would use BINDEVENT to receive those messages and act accordingly (this one requires VFP9) 在C#端,您将使用P / Invoke调用带有自定义消息的SendMessage ,将数据传递到VFP窗口,而在VFP端,您将使用BINDEVENT接收这些消息并采取相应的措施(这需要VFP9)

You can put a Timer in the VFP application, than waits for a external signal, like a presence of text file. 您可以在VFP应用程序中放置一个Timer,而不是等待一个外部信号(例如文本文件)。 The C# program will have to create and populate that file C#程序将必须创建并填充该文件

* In the Timer event (within VFP application) just ask for that file:

this.Enabled=.f.

if file("C:\c_program_params.txt") 

 * many kinds of ways to interact with that file
 lnH=fopen("C:\c_program_params.txt")
 ...

 * or
 lcContent=filetostr("C:\c_program_params.txt")

endif

this.Enabled=.t.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM