ConnectionPoint and IDL
-
Hi everyone, I hope there's someone out there, who can help me with my problem, I've asked about this in the COM forum, but no one knows or cares to reply. I have an ATL control, which should communicate with Macromedia's Flash control. I generated the IDL file and the event interface (based on IDispatch) has a few custom methods in it. When I use MIDL these custom methods nor the dispids are present in the .h file. Is this correct behaviour? I could ofcourse add the methods to the interface and then base my event sink on that or am I supposed to do it with the IDispatch and thus responding to those methods when invoke is called? .NET and VB provide actions for these events directly, but I need to use ATL for the task and would really like to understand the internals, rather than pick the quick and easy way out. Even links to c++ sourcecode interfacing with Flash would help me out. Thanks in advance!
-
Hi everyone, I hope there's someone out there, who can help me with my problem, I've asked about this in the COM forum, but no one knows or cares to reply. I have an ATL control, which should communicate with Macromedia's Flash control. I generated the IDL file and the event interface (based on IDispatch) has a few custom methods in it. When I use MIDL these custom methods nor the dispids are present in the .h file. Is this correct behaviour? I could ofcourse add the methods to the interface and then base my event sink on that or am I supposed to do it with the IDispatch and thus responding to those methods when invoke is called? .NET and VB provide actions for these events directly, but I need to use ATL for the task and would really like to understand the internals, rather than pick the quick and easy way out. Even links to c++ sourcecode interfacing with Flash would help me out. Thanks in advance!
Must've missed this one. When you say the custom methods and dispids are missing from the .h file, does that mean you only see the dispinterface as IDispatch in there? Have you tried using #import on the typelibrary (or DLL if there isn't an explicit one) and looking at the tli/tlh files generated to see if they are any different? If you use OLEVIEW and examine the IDL of the Flash control, is it different, or is that what you used to generate it in the first place? Worst case is, as you say, to have your own IDispatch; initially it could just dump out the events that are sent to it, so you can at least confirm it's behaving as expected. Steve S Just waiting for the day when someone asks a non-urgent question...
-
Must've missed this one. When you say the custom methods and dispids are missing from the .h file, does that mean you only see the dispinterface as IDispatch in there? Have you tried using #import on the typelibrary (or DLL if there isn't an explicit one) and looking at the tli/tlh files generated to see if they are any different? If you use OLEVIEW and examine the IDL of the Flash control, is it different, or is that what you used to generate it in the first place? Worst case is, as you say, to have your own IDispatch; initially it could just dump out the events that are sent to it, so you can at least confirm it's behaving as expected. Steve S Just waiting for the day when someone asks a non-urgent question...
Sorry for the stream of consciousness, I used the OLEVIEW to generate the IDL for Macromedia Flash control and after using MIDL to generate the header, it contains only the IDispatch interface. As I'm an ATL/COM newbie, I just wanted to get this right in the first place, I can add the methods to the generated class and then base my sink on that, but I have a feeling this isn't the right way to do it. I'll probably add the dispids for the Flash events as constants and test with a IDispatch, still I want to know whether this is expected behaviour when compiling an IDL file.
-
Sorry for the stream of consciousness, I used the OLEVIEW to generate the IDL for Macromedia Flash control and after using MIDL to generate the header, it contains only the IDispatch interface. As I'm an ATL/COM newbie, I just wanted to get this right in the first place, I can add the methods to the generated class and then base my sink on that, but I have a feeling this isn't the right way to do it. I'll probably add the dispids for the Flash events as constants and test with a IDispatch, still I want to know whether this is expected behaviour when compiling an IDL file.
Better than an stream of unconsciousness... That would be _IShockwaveFlashEvents, then? I've repeated what you've done, and also #import-ed the OCX, and examined the generated file. In each case, the sink is empty. I've also tried tweaking the IDL to remove the "hidden" keyword, but this made no noticeable difference. I'd go with plan B, and test with an IDispatch. I've looked at much of our code here, and that's how we tend to do things; a hand-crafted invoke function that then calls the appropriate functions. Steve S
-
Better than an stream of unconsciousness... That would be _IShockwaveFlashEvents, then? I've repeated what you've done, and also #import-ed the OCX, and examined the generated file. In each case, the sink is empty. I've also tried tweaking the IDL to remove the "hidden" keyword, but this made no noticeable difference. I'd go with plan B, and test with an IDispatch. I've looked at much of our code here, and that's how we tend to do things; a hand-crafted invoke function that then calls the appropriate functions. Steve S
Steve, thanks a million! It's always nice to share the burden with someone 'in the know'. Would you recommend using the dispids from the IDL file or should I implement the GetIDsOfNames in my IDispatch? I'd presume Flash would be using the predefined IDs in the invoke calls rather than asking for the ids I've chosen myself, afterall it's Flash's interface I'm playing with. And one final note, is everyone using VB and .NET to do this? Is the C++ implementation a well kept secret or what? I thought this would be something a lot of people had done before and still Google was unable to give me anything else than this same question asked over and over again. If someone is looking for an idea for an article here, this could be it; communicating with Flash using SetVariable and catching the FSCommand event. Quite trivial to implement, yet causing confusion among many developers.
-
Steve, thanks a million! It's always nice to share the burden with someone 'in the know'. Would you recommend using the dispids from the IDL file or should I implement the GetIDsOfNames in my IDispatch? I'd presume Flash would be using the predefined IDs in the invoke calls rather than asking for the ids I've chosen myself, afterall it's Flash's interface I'm playing with. And one final note, is everyone using VB and .NET to do this? Is the C++ implementation a well kept secret or what? I thought this would be something a lot of people had done before and still Google was unable to give me anything else than this same question asked over and over again. If someone is looking for an idea for an article here, this could be it; communicating with Flash using SetVariable and catching the FSCommand event. Quite trivial to implement, yet causing confusion among many developers.
:-O Didn't realise I was 'in the know'! You can just use the dispids from the IDL, preferably, as you said before, defined as constants somewhere. Flash will be using the predefined IDs, so it will be safe, and it's much less painful than implementing GetIDsOfNames, which you won't need. Don't know about the final note, I only use C++/C/C# with VBS thrown in. For what it's worth I usually 'handcode' the event sink so that the invoke function calls a pure virtual in a base class, then my concrete class provides the pure virtuals. This is occasionally useful if I need the same kind of sink somewhere else in the project or another app. Steve S