Hi Thanks for the answer. I already tried that but it's not working :(
aymen Tn
Posts
-
Subscribe to an event through COM GetEvent return null -
Subscribe to an event through COM GetEvent return nullHi I'm having a source code of an Api, but since we don't have to change it. I'm creating a windows service that register it as a COM component then it could be used from the client. I'll try to simplify my issue. I started with the creation of an interface having the function and an event (that uses delegate)
[Guid(ApiServices.InterfaceId), ComVisible(true)]
public interface IApiServices
{
[DispId(1)]
ApiResult Function1();\[DispId(2)\] event TestEvent event1;
}
Then I created a class that implements this inteface
\[ Guid(ClassId), ComVisible(true) ClassInterface(ClassInterfaceType.None) ProgId("ApiService") \]
public class ImplApiServices : MarshalByRefObject, IApiServices
{
private ApiObject _apiObject;public ImplApiServices ()
{
_apiObject= new ApiObject();
_apiObject.TestEvent += OnEvent1;
}ApiResult Function1()
{
return _apiObject.Function1();
}public event TestEvent event1;
private void OnEvent1(object e)
{
if (event1 != null)
event1(e);
}
}And then I did all the other steps to register it as a COM component and launch use it through a service. when I call it using a client, it is recognized and the function returns the result perfectly
var _apiServiceObjType= Type.GetTypeFromProgID("ApiService");
var _apiServiceObj= Activator.CreateInstance(_apiServiceObjType);var result = (ApiResult )_apiServiceObjType.InvokeMember("Function1",
BindingFlags.InvokeMethod, null, _apiServiceObj, null);But when I want to subscribe a method to the event, I get a null eventInfo in the following instruction and can't go further
EventInfo eventInfo = _apiServiceObjType.GetEvent(event1);
Any link or recommendation that helps with this kind of problem is welcome. Thanks
-
Disable Windows NavigationHello Thanks for your reply. but with this solution the windows expolorer still work, for example when I push the keybord start button it still works, What I want to do is to diable all windows fonctionnality (like Windows +E ....) Thanks
-
Disable Windows NavigationHi I'm developing a wpf application using visual studio 2010 in c#. for security reason, the navigation in the operating system is not allowed while running the application. That means once it is launched, all Windows menu, icons, toolbars ... must be hidden, and only the application must appear. (it's a kind of that the PC becomes only dedicated to it). Any suggestion or Idea ? Thanks in advance
-
Windows MobileHi Sorry I reposted because I found that I did the first in the wrong place
-
Windows MobileHi thanks for the answer,apparently this is for windows phone, I'm using a smart device, windows mobile version 6
-
Windows MobileHi I'm using the mobile 6 version, visual studio 2008, .NEt 3.5
-
Windows MobileHi I'm working on improving a GUI on an application, I have a tabconrol with many pages, I want to put a background Image instead of the unique color which appear behind, I didn't find any property to do it .. Is there any way ?? your help is really appreciated, thanks
-
Windows MobileHi I'm working on improving a GUI on an application, I have a tabconrol with many pages, I want to put a background Image instead of the unique color which appear behind, I didn't find any property to do it .. Is there any way ?? your help is really appreciated, thanks