使用VFP中的Bindevent。

huangapple go评论114阅读模式
英文:

Using Bindevent in VFP

问题

我目前在Thinfinity.VirtualUI中遇到事件处理问题,非常感谢任何指导和专业知识。

我已将Thinfinity.VirtualUI集成到我的应用程序中,并使用UploadFile方法上传文件。上传完成后,应触发一个名为"OnUploadEnd"的事件,提供上传文件的名称。我想捕获这个事件并执行一个名为"OnUploadEnd_EventHandler"的VFP程序或方法,该方法接受文件名作为参数。

为了处理这个事件,我尝试使用BINDEVENT函数,如下所示:

VirtualUI = CREATEOBJECT('Thinfinity.VirtualUI')

BINDEVENT(VirtualUI, "OnUploadEnd", loEventHandler, "OnUploadEnd_EventHandler")
VirtualUI.UploadFile(gTempdir)

然而,尽管文件成功上传,但事件没有被捕获,"OnUploadEnd_EventHandler"方法没有被执行。我非常感谢您在识别问题并提供关于如何正确处理Thinfinity.VirtualUI中的"OnUploadEnd"事件的方法方面的任何帮助。

在解决这个问题的过程中,我看到了以下博客文章,描述了类似的情况并提供了有关这个主题的一些背景信息:https://blog.cybelesoft.com/upload-remote-files-web-enabled-applications。这是一个很棒的产品,但技术帮助文件不够详细。

非常感谢您提前提供的宝贵支持。我迫不及待地等待您的回复。

我尝试了多种不同的方式来使用BINDEVENT,但都没有成功。

我收到了以下信息,可以尝试这个函数:

UploadFileEx(const ServerDirectory: WideString; out FileName: WideString): WordBool;

一旦UploadFile结束,它将触发以下事件:

OnUploadEnd(const FileName: WideString)

但是,我不知道用户希望上传的计算机上的文件名。

英文:

I am currently facing an issue with event handling in Thinfinity.VirtualUI and would greatly appreciate any guidance and expertise.

I have integrated Thinfinity.VirtualUI into my application, and I am using the UploadFile method to upload files. Upon completion of the upload, an event named "OnUploadEnd" is supposed to be triggered, providing me with the name of the uploaded file. I would like to capture this event and execute a VFP program or method called "OnUploadEnd_EventHandler" that accepts the file name as a parameter.

To handle this event, I have attempted to use the BINDEVENT function as follows:

VirtualUI = CREATEOBJECT('Thinfinity.VirtualUI')

BINDEVENT(VirtualUI, "OnUploadEnd", loEventHandler, "OnUploadEnd_EventHandler")
VirtualUI.UploadFile(gTempdir)

However, despite the successful upload of the file, the event is not being captured and the "OnUploadEnd_EventHandler" method is not executed. I would greatly appreciate any assistance in identifying the issue and providing guidance on the correct approach to handle the "OnUploadEnd" event in Thinfinity.VirtualUI.

In my pursuit to resolve this issue, I came across the following blog post, which describes a similar scenario and provides some background information on the topic: https://blog.cybelesoft.com/upload-remote-files-web-enabled-applications. This is a fantastic product but the technical help files are sparse.

Thank you in advance for your valuable support. I eagerly await your response.

I have tried using Bidevent in various different ways but have been unsuccessful.

I have been given the following
can try this function:

UploadFileEx(const ServerDirectory: WideString; out FileName: WideString): WordBool;
Once the UploadFile ends it will trigger the following event:
OnUploadEnd(const FileName: WideString)

I do not however know the filename on the PC the user wishes to upload.

答案1

得分: 3

为捕获Com对象事件,您应该使用事件处理程序。

使用对象浏览器创建事件处理程序类:

  • 在对象浏览器中打开Thinfinity com库
  • 定位接口部分;如果有多个接口,请找到在方法部分具有"onuploadEnd"的接口
  • 将该接口拖放到空的prg文件中,您将获得名为'myclass'的事件处理程序类
  • 在"onUploadEnd()"下编写所需的代码

然后执行:

VirtualUI = CREATEOBJECT('Thinfinity.VirtualUI')
vuiEventHandler = CREATEOBJECT('myclass')
eventhandler(virtualUi, vuiEventHandler)

在VFP帮助中查找EVENTHANDLER。

英文:

To capture Com objects events you should use a eventhandler.

Use the the object browser to create the evenhandler class:

  • open Thinfinity com library in the object browser
  • locate the interfaces section; if there's more than one interface, locate the one that has the onuploadEnd in the methods section
  • drag and drop the interface to an empty prg and you'll get the eventhandler class named as 'myclass'
  • write the desired code under onUploadEnd()

then do:

VirtualUI = CREATEOBJECT('Thinfinity.VirtualUI')
vuiEventHandler = CREATEOBJECT('myclass')
eventhandler(virtualUi,vuiEventHandler)

Look for EVENTHANDLER in vfp help.

huangapple
  • 本文由 发表于 2023年6月6日 10:01:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/76410991.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定