Click here to Skip to main content
15,918,193 members

Comments by egon_ll (Top 9 by date)

egon_ll 25-Sep-10 5:24am View    
Reason for my vote of 5
Automatic vote of 5 for accepting answer.
egon_ll 25-Sep-10 5:24am View    
Thank you! Now it works.
egon_ll 23-Sep-10 11:15am View    
This can not work, as LightControl is only defined in the dll but not in the program calling the dll.
I tried it anyway and I get the error "LightControl not declared".
egon_ll 23-Sep-10 5:20am View    
I now tried this:

ILightControl^ilc = dynamic_cast<ilightcontrol^>(obj);
ilc->Settings();

The cast works fine, but when I call the method I get the error:
"Object reference not set to an instance of an object."

I think the problem is, that I'm trying to create an Object of an interface. That is probably not possible.
But as I already have the right object, there must be a possibility to tell the compiler, that the object implements the interface ILightControl, and can therefore call the method Settings().
egon_ll 23-Sep-10 5:07am View    
As LightControl is only defined in the dll, the software doesn't know LightControl at compilation time.

I defined the interface ILightControl in the dll and derived LightControl. I also defined ILightControl in my main program. Now I have to tell the compiler, that the object I created has the function Settings, and call it. This is the first time I'm working with interfaces, so I might overlook something.