mfc - Can a COM interface return a integer instead of a long? -
here class , associated interface:
[guid("xx")] [comvisible(true)] [interfacetype(cominterfacetype.interfaceisiunknown)] public interface istudentitem { string type { get; set; } datetime week { get; set; } int study { get; set; } } [guid("yy")] [classinterface(classinterfacetype.none)] [comvisible(true)] public class studentitem : istudentitem { public string type { get; set; } public datetime week { get; set; } public int study { get; set; } }
as can see, study
defined int
.
but in mfc side, when using property, end long
:
long lstudynumber = 0; if(succeeded(studentitem->get_study(&lstudynumber))) oentry.istudypoint = static_cast<int>(lstudynumber);
my dll in both 86x , 64x editions. there way get_study
property return integer
instead?
why want this. use appropriate type makes sense data in os , bitness.
you can use int. coms know __int3264 type in midl compiler , inside tlb (type libraries) , variant has vt_int type.
so idispatch driven automation receive correspondent value.
but aware there marshaling, when have 64bit external com server , 32bit process asks data, marshaller transform previous vt_int vt_i8... on other hand 32bit external com server return vt_int vt_i4 64bit process...
Comments
Post a Comment