trying to call Find() from a test dll im messing with and I keep getting the error"Specified cast is not valid."
here's a little snippet of what im working with.....
test.dll
foo.h
__declspec(dllexport) UINT Find();
foo.cpp
UINT Find()
{
return 1;
}
C# test.exe using interface for the call
[ComImport, CoClass(typeof(object)), TypeIdentifier, CompilerGenerated, Guid("MYGUID")]
public interface CSmart : ISmart
{
}
[ComImport, TypeIdentifier, CompilerGenerated, Guid("MYGUID")]
public interface ISmart
{
[DispId(1)]
uint Find();
}
here is the button push
private CSmart caller;
this.caller = (CSmart)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("MYGUID")));
try
{
caller.Find();
}catch (Exception ex)
{
}
Loading the dll into dependancy walker shows
1(0x0001) | 0(0x0000) | unsigned int Find(void) | 0x00011091
What I have tried:
not sure where to start....lol