Hello,
I'm trying to run a sample c# application thats been verified to work on
earlier versions of visual studio but doesn't seem to work on Visual Studio
2005. It's very basic sample code the connects to a referenced com object.
I can access properties and run methods on the COM object but I'm not
receiving any events back to my c# .net code.
Are there any changes to Visual Studio 2005 or .NET 2.0 that might break
code that used interop?
The publisher of the COM object is eSignal, a company that supplies real
time and historic market data. They don't use Visual Studio 2005, so they
aren't able to tell me why it isn't working with the latest Visual Studio.
I've copied a message sent to them earlier today that explains what I'm
doing in code. I'm hoping that someone at Microsoft might able able to shed
a little light on this issue..
Thanks!!
-Charley
---- MESSAGE to ESIGNAL FOLLOWS
Here are the details of what I'm doing:
1. This is a visual c# project built in Visual Studio 2005
2. I import IESignal into the project by using project/add reference
3. I create a new instance of the HooksClass like this
private IESignal.HooksClass esignal;
esignal = new IESignal.HooksClass();
4. I set the application like this
esignal.SetApplication("xtaltrader");
5. I check to see if I'm entitled like this:
int ent = esignal.IsEntitled;
I notice that esignal.IsEntitled returns an Int32 NOT a boolean. I also
notice it takes about 3 seconds to for the IsEntitled property to change
from 0 to 1 after I SetApplication. (I believe this is due to the startup
time for the eSignal application).
6. I setup the QuoteChanged event handler like this
esignal.OnQuoteChanged += new
IESignal._IHooksEvents_OnQuoteChangedEventHandler(esignal_OnQuoteChanged);
7. I request the symbol stream like this:
esignal.RequestSymbol("yhoo", 1);
Note that RequestSymbol takes a string and an INT not a boolean. This
probably has to do with the way .net interop wraps the COM object. I can
NOT pass a boolean to RequestSymbol.
8. I wait for the event to be fired here
private void esignal_OnQuoteChanged(string s)
{ MessageBox.Show("The event fired!"); }
9. Nothing happens - the OnQuoteChanged method never gets executed.
"Peter Huang" [MSFT] - 02 Mar 2006 06:31 GMT
Hi
To access to COM server from .NET client, we need a RCW wrap assembly,
which is the assembly generated when we add reference to the COM Object.
Commonly the .NET generated Assembly may have some flaw, because the COM
Server may differ one another. That is why for Office 2003, we provide PIA
which is a full tuned Interop Assembly. If this is the case we need to
write our own wrap.
How to: Use Native COM Servers with CRCWs
http://msdn2.microsoft.com/en-us/library/f31k2c87.aspx
Commonly the .NET 2.0 com interop did not change a lot. I think you may try
to use the Interop Assembly generated by .NET 1.1. That may help.
Also it is hard for us to troubleshoot why the event did not fire because
we did not have the third party implementation and symbols.
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
bengof - 08 Aug 2006 15:06 GMT
Hello;
I was wondering if you were able to resolve this issue. I am experiancing
the same problem with VS 2005 Team Edition. I noticed that if I create a
BasicQuote object and as soon as I try to get the value it fires the
esignal_OnQuoteChanged event again! Here is a sample code
Private Sub esignal_OnQuoteChanged(ByVal sSymbol As String) Handles esignal.
OnQuoteChanged
bQ = esignal.GetBasicQuote(sSymbol)
txtBid.Text = Str$(bQ.dBid)
txtASk.Text = Str$(bQ.dAsk)
txtLast.Text = Str$(bQ.dLast)
Thank you
Ben G.
>Hello,
>
[quoted text clipped - 64 lines]
>
>9. Nothing happens - the OnQuoteChanged method never gets executed.