Client
-------------
CoInitializeEx(0,COINIT_APARTMENTTHREADED);
enum A valA = I_D;
ITest* pTest = 0;
CoCreateInstance();
pTest->SetMode(I_D); //Run-Time Check Failure #0 - The value of ESP
was not properly save
Server TestDLL.dll
--------------------------
0) Registry shows
[HKEY_CLASSES_ROOT\Interface\{F8D85DAA-098B-4947-8B08-E253A1D7499D}]
@="ITest"
[HKEY_CLASSES_ROOT\Interface\{F8D85DAA-098B-4947-8B08-E253A1D7499D}
\ProxyStubClsid]
@="{00020424-0000-0000-C000-000000000046}"
[HKEY_CLASSES_ROOT\Interface\{F8D85DAA-098B-4947-8B08-E253A1D7499D}
\ProxyStubClsid32]
@="{00020424-0000-0000-C000-000000000046}"
[HKEY_CLASSES_ROOT\Interface\{F8D85DAA-098B-4947-8B08-E253A1D7499D}
\TypeLib]
@="{315BE7EE-B39B-41F7-9B2A-9CF2824E6F27}"
1) _MERGE_PROXY preprocessor has been removed.
2) C++/H
STDMETHOD(SetMode)(enum A iMode );
STDMETHODIMP CTest::SetMode(enum A iMode)
{
m_A = iMode;
return 0;
}
3) IDL
enum A
{
I_A = -1,
I_B = 1,
I_C = 2,
I_D = 3
};
[
object,
uuid(F8D85DAA-098B-4947-8B08-E253A1D7499D),
dual,
nonextensible,
helpstring(""),
pointer_default(unique)
]
interface ITest : IDispatch
{
[id(3), helpstring("")] HRESULT SetMode(enum A iMode);
};
[
uuid(315BE7EE-B39B-41F7-9B2A-9CF2824E6F27),
version(1.0),
helpstring("Type Library")
]
library CTestLib
{
importlib("stdole2.tlb");
[
uuid(8B2E3F9E-AA9E-4579-BBC3-4B272DEF2520),
]
coclass CTest
{
[default] interface ITest;
};
};
RGS
-----
HKCR
{
TestDLL.CTest.1 = s 'CTest Class'
{
CLSID = s '{8B2E3F9E-AA9E-4579-BBC3-4B272DEF2520}'
}
TestDLL.CTest = s 'CTest Class'
{
CLSID = s '{8B2E3F9E-AA9E-4579-BBC3-4B272DEF2520}'
CurVer = s 'TestDLL.CTest.1'
}
NoRemove CLSID
{
ForceRemove {8B2E3F9E-AA9E-4579-BBC3-4B272DEF2520} = s 'CTest Class'
{
ProgID = s 'TestDLL.CTest.1'
VersionIndependentProgID = s 'TestDLL.CTest'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Free'
}
'TypeLib' = s '{315BE7EE-B39B-41F7-9B2A-9CF2824E6F27}'
}
}
}
HKCR
{
NoRemove AppID
{
'%APPID%' = s 'TestDLL'
'TestDLL.DLL'
{
val AppID = s '%APPID%'
}
}
}
Thanks
Ramesh
Try putting a [v1_enum] attribute on your enum.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
Regards,
Ramesh
On Oct 21, 10:44 pm, "Igor Tandetnik" <itandet...@mvps.org> wrote:
http://doc.ddart.net/msdn/header/include/mapidefs.h.html
If you can understand, here is the H file for the method that I am
calling, GetRecipientTable(). This code worked fine with VC6.0, now we
are using it in VS2008. Worst is this does not happen with every
machine. Calling process is entering in to STA. Something fundamental
seems to be going wrong here and that is affecting COM methods
invocation. Solution could be as just changing compiler setting but I
have no clue. VS setting says __cdecl by default but every COM method
specifies calling convention.
Thanks
Ramesh
On Oct 22, 12:05 pm, "asnowf...@gmail.com" <asnowf...@gmail.com>
wrote:
> > With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925- Hide quoted text -
>
> - Show quoted text -