//this function is the set of points in a TXT file generated SHP file
IFeatureLayerPtr CPolygonDlg: : CreateShpFromPoint (cstrings strShp)
{
Int index=strShp. ReverseFind (' \ \ ');//find the location of the last \
Cstrings strfolder=strShp. Left (index + 1);
Int len=strShp. GetLength ();
Cstrings strFileTitle=strShp. Right (len - index - 1);
IWorkspaceFactoryPtr pWSF=NULL;
Retrieves the hr=pWSF. CreateInstance (__uuidof (esriCore: : ShapefileWorkspaceFactory));///////////////this step error/////////////
If (FAILED (hr))
AfxMessageBox (_T (" file "));
IFeatureWorkspacePtr pFWS=(IFeatureWorkspacePtr) (pWSF - & gt; OpenFromFile (_bstr_t (strfolder), 0));
Debugging information is as follows:
HRESULT CreateInstance (const CLSID& Rclsid IUnknown * pOuter=NULL, dwords dwClsContext=CLSCTX_ALL) throw ()
{
Retrieves the hr;
_Release ();
If (dwClsContext & amp; (CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER)) {
IUnknown * pIUnknown;
///////////////to run to the CoCreateInstance function below error, error
Hr=CoCreateInstance (rclsid, pOuter, dwClsContext __uuidof (IUnknown), reinterpret_cast & lt; Void * * & gt; (& amp; PIUnknown));
{if (SUCCEEDED (hr))
Hr=OleRun (pIUnknown);
{if (SUCCEEDED (hr))
Hr=pIUnknown - & gt; QueryInterface (GetIID (), reinterpret_cast & lt; Void * * & gt; (& amp; M_pInterface));
}
PIUnknown - & gt; Release ();
}
}
Error display: hr: 0 x80040111 ClassFactory unable to supply the requested class
PIUnknown: 0 x00000000 -- -- -- -- -- - normally this place is a value, but don't know why not
Parameter pIUnknown shows: __vfptr=CXX0030: error: unable to calculate the value of the expression
Have a great god lend a hand?