Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Publishing Events in a VFP DLL
Message
From
14/12/2008 19:17:49
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Publishing Events in a VFP DLL
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01367304
Message ID:
01367304
Views:
76
I'm creating a COM server for use in C#, the process it runs is a bit lenthy so I would like to create Progress event. I've looked at "Visual FoxPro and Advanced COM", but I'm not really getting how I would create an event that I can then access from C#.

A rough outline of what I'm trying to do: (Not Runnable)
DEFINE CLASS MyVFPClass AS SESSION OLEPUBLIC

  PROCEDURE Go()
    *** Lengtly process goes here.
    d = DATETIME()
    c = d
    DO WHILE DATETIME() - d < 10
      IF c != DATETIME()
        IF (DATETIME() - d) % 2 = 0
          *** Event Called Here 
          THIS.Progress()
        ENDIF
        c = DATETIME()
      ENDIF
    ENDDO
  ENDPROC
    
  PROCEDURE Progress()
    *** I want this to trigger an event in C#
  ENDPROC

ENDDEFINE 
  // C# Background worker thread.
  public class cVFPSession
    {
    public cVFPSession()
      {
      MyVFPClass _VFP = new MyVFPdll.MyVFPClass();
      MyVFPClass.Progress += Progress();
      MyVFPClass.Go()
      }

    public void Progress()
      {
      // Report Progress using Background worker .ReportProgress;
      }
    }
Note: My other option is to create this as an EXE and use some form of inter process comunication. Might that be a better solution?
Next
Reply
Map
View

Click here to load this message in the networking platform