|
GIS쪽 프로그램을 만들어볼려고 해서 관련 OCX를 import했구요. 그런데 자꾸 이런 에러가 발생하는군요. 이리저리 바꿔보며 잡을려고 해도 도무지 잡히질 않군요. 도대체 뭐가 잘못된 것인지..고수님들 제발 도와주세요. 며칠째 제자리 걸음입니다.
HRESULT hr;
IWorkspaceFactoryPtr ipWorkspaceFactory;
ipWorkspaceFactory.CreateInstance(CLSID_WorkspaceFactory);
AnsiString asLoc = "F:\\Research\\GIS\\DB_Test";
wchar_t *location = new wchar_t[asLoc.WideCharBufSize()];
location = asLoc.WideChar(location, asLoc.WideCharBufSize());
wchar_t *name;
WideString wlocation2 = "ClearCreek.shp";
name = wlocation2.c_bstr();
IWorkspacePtr iFWorkspace;
iFWorkspace.CreateInstance(CLSID_Workspace);
hr = ipWorkspaceFactory->OpenFromFile(location, 0 ,&iFWorkspace); <----------------
IFeatureWorkspacePtr ipFeatureWKSP = iFWorkspace;
// OpenFromFile의 인자는 OpenFromFile(wchar_t*, long, IWorkspace **)입니다.
일단 컴파일 상에서는 에러가 없는데요, 화살표부분을 실행을 시켜보면 자꾸 다음과 같은 에러가 발생합니다.
intf != 0 @ c:\program files\borland\cbuilder6\include\utils.h/2912
Press[Y]es to terminate, [N]o to continue and [C]ancel to Debug
인터넷에 찾아봤더니 다음의 경우에 위의 에러가 발생한다고 하던데..시키는 데로 고쳐주어도 동일한 문제가 생기는군요.
When using the COM method CreateInstance on a smart pointer in Borland C++ Builder, C++ Builder expects the CLSID rather than the GUID of the COM object you are creating.
얼핏 메모리관련 문제인 것 같은데..
어디서부터 손을 대야할지..초짜의 한계가 느껴집니다. 죽을 맛입니다.
|