本人用vc6.0的ATL开发了一个Maprojt.DLL,在Windows98下可以编译(使用debug,和release Minsize)通过,
用客户程序调用,并可以正常运行,但在WINDOWS2000下也可以编译(使用debug,和release Minsize)通过,
用客户程序调用,对于release Minsize模式编译的Maprojt.DLL,可以正常运行;对于debug模式编译的Maprojt.DLL,
却不能正常运行;由于在WIN2K下,使用release Minsize模式编译的Maprojt.DLL时,程序不能稳定运行,使用SmartCheck
调试程序时,告诉Maprojt.DLL中存在错误,因此本人需要编译的debug模式下的Maprojt.DLL,进行调试,但现在
发生了上述错误:在win98 和win2k下均可以正常注册(regsvr32 Maprojt.dll)
  用vb写的客户程序,给出的错误信息为:Out of memory;
    Dim PtTest As TITLib.Cptor   Private Sub Command1_Click()
      Dim bRetVal() As Byte
    
      Set PtTest = New TITLib.Cptor   '给出的错误信息为:Out of memory
      .
      .
      .
   end sub     
  用vc写的客户程序,给出的错误信息如下所示
  
  void CPtTestDlg::OnOK() 
{ // Declare and HRESULT and a pointer to the Simple_ATL interface
HRESULT hr;
ICryptor *Eptor;
char cStrtmp[256];

// Now we will intilize COM
hr = CoInitialize(0);

// Use the SUCCEDED macro and see if we can get a pointer to
// the interface
if (SUCCEEDED(hr))
{
hr = CoCreateInstance(CLSID_CPptor, NULL, CLSCTX_INPROC_SERVER,
IID_IPptor, (void**) &Eptor);

// If we succeeded then set some properties, then call 
// the DoPTing method, if it failed then display an 
// appropriate message to the user.
if (SUCCEEDED(hr))    //运行到此时,在WIN2K使用debug模式下编译的Maprojt.DLL,则执行else分支,
      //在win98下,或Win2k下使用release minsize模式下编译的Maprojt.DLL,
      //执行正确的分支
{
.
.
.

}
else 
{
MessageBox("CoCreateInstance Failed.");
}
}
// Uninitialize COM
CoUninitialize();

}     请问在WIN98和WIN2K下,ATL COM的编程有何区别,并且对ATL的版本有何要求,或需要什么补丁.

解决方案 »

  1.   

    用ATL开发的一个组件,插到PowerPoint里,测试正常。
    然后在组件管理里将该组件安装起来,再重新打开PP文档,竟然说该控件无法激活??怪哉?请大虾解惑。
      

  2.   

    WIN2K更稳定一些,
    hr = CoCreateInstance返回的错误码是什么?
      

  3.   

    hr = CoCreateInstance返回的错误码
    hr = -2147024882
    GetLastError() return value is 0
      

  4.   

    hr = -2147024882 意味着 E_OUTOFMEMORY
    你把内存都吃完了Win2K 的 Pack装了没有
    VStudio SP3装了没有