RTD C# implementation on vs2005

S

Sheldon

Hi All,

I have written a simple RTD Server C# implementation using vs2005 but I am
having trouble making it run. When I run this DLL with external app set as
Excel using vs2005 in debug mode, it pops out Excel app. But I receive the
#N/A value when I input =RTD("Excel_RTD_Demo.Class1",,"blah") in one of the
cells. I also get this on the output window in vs2005:
'EXCEL.EXE' (Managed): Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols
loaded.
A first chance exception of type 'System.IO.FileNotFoundException' occurred
in Unknown Module.

I don't have actual COM coding experience and I just began to pick up VS2005
recently. Does anyone have similar issue in writing RTD in VS2005? Any help
is appreciated.

Here is a copy of the RTD Server.

using System;
using System.Timers;
using System.Collections.Generic;
using System.Text;
using Excel = Microsoft.Office.Interop.Excel;
using System.Runtime.InteropServices;

namespace Excel_RTD_Demo
{
[Guid("40d7bff1-20ed-490e-88ab-59a759ec4a86")]
public class Class1 : Excel.IRtdServer
{
private Excel.IRTDUpdateEvent callBackObject = null;
private int topicId;
private Timer atimer = new Timer();

public int ServerStart(Excel.IRTDUpdateEvent CallbackObject)
{
atimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
atimer.Interval = 3000;
atimer.AutoReset = true;
atimer.Enabled = true;
callBackObject = CallbackObject;
return 1;
}

public void ServerTerminate()
{
callBackObject = null;
}

public object ConnectData(int TopicID, ref Array Strings, ref bool
GetNewValues)
{
topicId = TopicID;
return "Connecting...";
}

public void DisconnectData(int TopicID)
{
}

public int Heartbeat()
{
// check if data source is active
return 1;
}

public Array RefreshData(ref int TopicCount)
{
TopicCount = 1;
object[,] results = new object[2, 1];
Random gen = new Random(DateTime.Now.Millisecond);
results[0, 0] = topicId;
results[0, 1] = gen.Next().ToString();
return results;

}

private void OnTimedEvent(object source, ElapsedEventArgs e)
{
callBackObject.UpdateNotify();
}

}
}

Thanks,
Sheldon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top