Здравствуйте!
Объясните, почему приведенный код выдает ошибку "Access violation ... in module 'oleaut32.dll'".
(CBuilder 6, Windows XP home edition)
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "uidn.h"
#include <objbase.h>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TfmIdent *fmIdent;
//---------------------------------------------------------------------------
__fastcall TfmIdent::TfmIdent(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfmIdent::FormCreate(TObject *Sender)
{
loadOpt();
}
//---------------------------------------------------------------------------
void __fastcall TfmIdent::addqNodes()
{
X("s", "s");
}
//---------------------------------------------------------------------------
void __fastcall TfmIdent::loadOpt()
{
short Ok;
IXMLDOMDocument* xOpt;
CoInitialize (NULL);
CoCreateInstance (CLSID_DOMDocument, NULL,
CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument, (void**) &xOpt);
xOpt->put_async(0);
VARIANT v;
v.vt = VT_BSTR;
v.bstrVal = L"x.xml";
xOpt->load(v, &Ok);
xOpt->Release();
CoUninitialize();
}
//---------------------------------------------------------------------------
void __fastcall TfmIdent::X( char* Nm, char* v)
{
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#ifndef uidnH
#define uidnH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <Forms.hpp>
#include <msxml.h>
//---------------------------------------------------------------------------
class TfmIdent : public TForm
{
__published: // IDE-managed Components
void __fastcall FormCreate(TObject *Sender);
private:
void __fastcall addqNodes();
void __fastcall loadOpt();
void __fastcall X( char* Nm, char* v);
public:
__fastcall TfmIdent(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TfmIdent *fmIdent;
//---------------------------------------------------------------------------
#endif