Home > Back-end >  Change OPCWorkshop BCB met F1004 internal compiler error
Change OPCWorkshop BCB met F1004 internal compiler error

Time:09-17

Download version of an industrial control with OPCServer OPCWorkshop, compiled using VS2010 open normal (VC6.0 compiled), but the generated DLL can't use below the BCB, view the source code, using cstrings type and special time, then all the source code for transferred to modify under BCB6.0 compiler,
First step all the cstrings changed to string, and the cstrings function is converted to the string function, all of them, and cut out the VS version from several header files and modify the part function:
//# include & lt; Atlstr. H>
//# include & lt; Atlsync. H>
//# include & lt; ATLComTime. H>

To compile found at the following error:
[c + + Fatal error] atlcom. H. (4144) : F1004 Internal compiler error at 0 x955a94 with base 0 x900000

Locating in the class definition: template & lt; The class T, const IID * piid, const GUID * plibid=& amp; CComModule: : m_libid, WORD wMajor...
Atlcom. H
 
/////////////////////////////////////////////////////////////////////////////
//IDispatchImpl

The template & lt; The class T, const IID * piid, const GUID * plibid=& amp; CComModule: : m_libid, WORD wMajor=1,
WORD wMinor=0, class tihclass=CComTypeInfoHolder>
The class ATL_NO_VTABLE IDispatchImpl: public T
{
Public:
Typedef tihclass _tihclass;
//IDispatch
STDMETHOD (GetTypeInfoCount) (UINT * pctinfo)
{
* pctinfo=1;
Return S_OK.
}
STDMETHOD (GetTypeInfo) (UINT itinfo, LCID LCID, ITypeInfo * * pptinfo)
{
Return _tih. GetTypeInfo (itinfo, lcid pptinfo);
}
STDMETHOD (GetIDsOfNames) (REFIID riid, LPOLESTR * rgszNames, UINT cNames,
The LCID LCID, DISPID * rgdispid)
{
Return _tih. GetIDsOfNames (riid rgszNames, cNames, lcid, rgdispid);
}
STDMETHOD (Invoke) (DISPID dispidMember, REFIID riid,
Pdispparams LCID LCID, WORD wFlags, DISPPARAMS * and * pvarResult VARIANT,
EXCEPINFO * pexcepinfo, UINT * puArgErr)
{
This return _tih. Invoke ((IDispatch *), dispidMember, riid, lcid,
WFlags pdispparams, pvarResult pexcepinfo, puArgErr);
}
Protected:
The static _tihclass _tih;
Static HRESULT GetTI (LCID LCID, ITypeInfo * * ppInfo)
{
Return _tih. GetTI (lcid ppInfo);
}
};

The template & lt; Class T, const IID * piid, const GUID * plibid, WORD wMajor, WORD wMinor, class tihclass>
IDispatchImpl : : _tihclass
IDispatchImpl : : _tih=
{piid, plibid, wMajor wMinor, NULL, 0, NULL, 0};


Through annotation positioning in turn to be class AG_IErrorInfoImpl: public IDispatchImpl
 
# # ifndef ERRORINFOIMPLH
# define ERRORINFOIMPLH

# pragma once
//# include "stdafx. H"
# include & lt; Atlbase. H>
Extern CComModule _Module;
# include & lt; Atlcom. H>

The template & lt; The class T, const clsids * pclsid=& amp; CLSID_NULL & gt;
The class AG_IErrorInfoImpl: public IDispatchImpl{
Protected:
DWORD m_ErrorDescriptionID;
String m_ErrMsg;
Public:

AG_IErrorInfoImpl ()
{
M_ErrorDescriptionID=0;
}

Void setErrorString (DWORD id,... )
{
/*
Va_list marker;
Va_start (marker, id);//Initialize variable arguments.
String format.
Format. LoadString (id);
M_ErrMsg. FormatV (format, marker);
Va_end (marker); */
M_ErrorDescriptionID=id;
}

Void setErrorString LPCTSTR (STR)
{
M_ErrMsg=STR;
M_ErrorDescriptionID=1;
}
Public:

STDMETHOD (GetGUID) (GUID * pGUID)
{
If (pGUID==NULL) return E_INVALIDARG;
* pGUID=* pclsid;
Return S_OK.
}
STDMETHOD GetSource () (BSTR * pBstrSource)
{
LPOLESTR PTR=NULL;
if(! FAILED (ProgIDFromCLSID (* pclsid, & amp; PTR)))
{
CComBSTR STR=PTR;
CoTaskMemFree (PTR);
* pBstrSource=STR. Detach ();
}
Return S_OK.
}
STDMETHOD (GetDescription) (BSTR * pBstrDescription)
{
If (m_ErrorDescriptionID)
{
//CComBSTR STR.
//STR. LoadString (m_ErrorDescriptionID);
//* pBstrDescription=STR. Detach ();
//return S_OK.
//}
CComBSTR STR=m_ErrMsg. C_str ();
* pBstrDescription=STR. Detach ();
}
Return S_OK.
}
STDMETHOD (GetHelpFile) (BSTR * pBstrHelpFile)
{
Return E_NOTIMPL.
}
STDMETHOD (GetHelpContext) (DWORD * pdwHelpContext)
{
Return E_NOTIMPL.
}

DWORD showMessageBoxByErrorInfo ()
{
Return: : MessageBox (NULL, m_ErrMsg, _T (" COM error!" ), MB_OK | MB_ICONERROR);
}
};

The class errorDescription
{
String STR.
Public:
ErrorDescription (IUnknown * obj)
{
CComQIPtr Inf=obj;
If (inf==NULL) return;
CComBSTR MSG.
Inf - & gt; GetDescription (& amp; MSG);
STR=W2A (MSG);
}

Operator LPCTSTR ()
{
Return the STR. C_str ();
}
};

The inline DWORD showMessageBoxByErrorInfo (IUnknown * obj)
{
CComQIPtr Inf=obj;
If (inf==NULL) return 0;
CComBSTR MSG.
Inf - & gt; GetDescription (& amp; MSG); nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related