Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Publishing Events in a VFP DLL
Message
De
14/12/2008 19:17:49
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Publishing Events in a VFP DLL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01367304
Message ID:
01367304
Vues:
75
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?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform