[MSCE C++ U6]如何打开一个dgn文件并向其添加元素?

DgnModelRefP modelRef;
	CString strDgn = L"E:\\MainDesign.dgn";
	WCharCP inFileName = strDgn;
	if (SUCCESS == mdlWorkDgn_openFile(&modelRef, NULL, NULL, inFileName, NULL, TRUE))
	{
		if (!modelRef) return;

		DPoint3d pts[2] = { { 0 },{ 0,0,10000 } };
		MSElement line;
		mdlLine_create(&line, NULL, pts);

		EditElementHandle eeh(&line, ACTIVEMODEL);
		eeh.AddToModel();
        
        // 返回值是始终为0
		//UInt32 nStatus = mdlElmdscr_addByModelRef(edP1, modelRef);
		UInt32 nStatus = mdlWorkDgn_write(eeh.GetElementDescrP(), -1, modelRef);

		mdlWorkDgn_saveChanges(modelRef);
		mdlWorkDgn_closeFile(modelRef);
	}

以上是我的代码,但总是失败,

我参考的是这个帖子:https://communities.bentley.com/communities/other_communities/chinafirst/f/microstation-projectwise/119458/dgn/368601#368601

请问我的代码问题出在哪?万分感谢