Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7937489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:32:12+00:00 2026-06-03T22:32:12+00:00

I have a .Net COM server that has a method that takes a message

  • 0

I have a .Net COM server that has a method that takes a message and a delay as parameters. After the delay, it fires an event sending the message back to the client.

It works with .Net and VB6 clients.

In order to get the COM event to bind in FoxPro, you have to create a class that implements the event interface in foxpro and wire it up, as described here:
http://www.west-wind.com/presentations/dotnetfromVfp/DotNetFromVfp_EventHandling.asp

I have such a class:

DEFINE CLASS ComEventHandler AS session OLEPUBLIC
  IMPLEMENTS IComServerEvents IN "PcaTest.ComServer"
  * "C:\ComTest\PCATest.tlb"

  PROCEDURE IComServerEvents_TimerExpired(message AS STRING) AS VOID
  * add user code here
  ?message
  ENDPROC
ENDDEFINE

And the code to wire this up:

loMM = CREATEOBJECT("PcaTest.ComServer")
loEvents = CREATEOBJECT("ComEventHandler")

EventHandler(lomm, loevents)

When I run this code, I get Type Library PcaTest.ComServer not found. However, it works as expected if I change the implements line to:

IMPLEMENTS IComServerEvents IN "C:\ComTest\PCATest.tlb"

I can’t hard-code the location of the tlb.

The line “CREATEOBJECT(“PcaTest.ComServer”)” works fine, actually, and if I don’t try to instantiate a ComEventHandler object, that COM object is instantiated and I can call its methods and access its properties. The event handler class is (mostly) only working when I feed it the .tlb and not the progId.

The .Net COM server is registered in the GAC. I’ve tried regasm with and without /codebase and with and without /tlb or /tlb:filename.tlb

I did have this working in testing at one point, or so it seemed. I am unable to duplicate those results now, but when I had it working I had used /codebase and /tlb:filename.tlb.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:32:13+00:00Added an answer on June 3, 2026 at 10:32 pm

    I hate to answer my own question. Again. But I got it.

    Answer: using regasm /codebase when the assembly is registered in the GAC makes it not work. My problem was that if I did regasm before installing the assembly in the GAC, it would work, but if the assembly was registered in the GAC first, or if it was registered in the GAC and regasm is called at a later time, FoxPro gets confused.

    Consuming a .Net COM server’s events in FoxPro absolutely requires:

    • assembly registered for COM (progId and ClsId), probably by regasm
    • /codebase flag on regasm that adds something like this into the registry:

      [HKEY_CLASSES_ROOT\CLSID\{A2DA47BD-15E8-48E3-BA54-4B1CED2D3C01}\InprocServer32]
      @="mscoree.dll"
      "CodeBase"="file:///C:/MACsWave/PCATest/pcatest.dll"
      

      Codebase is required, even though the assembly ought to be accessible from the GAC. /codebase is not required for VB6 clients, for example

    • /tlb flag to register typelib. /tlb:”filename” is not required.

    Because the /codebase flag is used, registering the assembly in the GAC is not needed.

    If you do add the assembly to the GAC and subsequently call regasm /codebase, you get this in the registry:

    [HKEY_CLASSES_ROOT\CLSID\{A2DA47BD-15E8-48E3-BA54-4B1CED2D3C01}\InprocServer32]
    @="mscoree.dll"
    "CodeBase"="file:///C:/WINDOWS/assembly/GAC_32/PCATest/1.1.0.0__325ac2fec08eafa8/PCATest.dll"
    

    I wonder whether perhaps FoxPro is looking for the tlb file in the same directory as the dll, but finds there is no .tlb in the GAC. Or something…

    In any case, problem solved.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the core problem: I have a .NET application that is using COM interop
I have a c# .NET assembly that gets called from a C++ COM client.
I have trouble to expose a .NET assembly in COM. It seems that I
In my ASP.NET web-based application, I have a normal ASP.NET button that has a
ASP.NET - IIS 6 - we currently have a public-facing site that has a
In project i have reference to Microsoft.Office.Word.Server and in code i have method that
I have an ASP.NET 2.0 application under IIS that has the functionnality of exporting
I have a .NET user control registered as COM. I use regasm to register
I have CruiseControl.net running Visual Studio (2005/2008 - using devenv.com) as we need to
I have created a COM enabled .NET User Control and am wondering what is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.