【问题标题】:Write on a VFP textbox from within c#在 C# 中写入 VFP 文本框
【发布时间】:2015-04-10 18:38:09
【问题描述】:

在我正在开发的应用程序中,我需要在 VFP 应用程序的文本框中写入内容,然后单击一个按钮(VFP 也是如此)。

我正在使用 c# 编写的应用程序。有没有办法做到这一点?

谢谢,我完全迷路了。

【问题讨论】:

标签: c# visual-foxpro


【解决方案1】:

一种方法是使用本机 Windows 消息作为两个应用程序之间的通信。在 C# 端,您将使用 P/Invoke 使用自定义消息调用 SendMessage,将数据传递到 VFP 窗口,而在 VFP 端,您将使用 BINDEVENT 接收这些消息并采取相应措施(这需要VFP9)

【讨论】:

    【解决方案2】:

    您可以在 VFP 应用程序中放置一个计时器,而不是等待外部信号,例如文本文件的存在。 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.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多