1. 直接用VBS中的属性
HMIRuntime.ActiveProject.Path 测试结果正常E:\Test
2. 用API函数
GetSystemDirectoryA(strPath,255) 测试结果 c:\windows\system32
3. 斑竹的例子拷贝过来的 测试结果 \\xp\wincc60_Project_test
char MyProjectPath[_MAX_PATH + 1];
char * psz=NULL;
CMN_ERROR Error;
BOOL bRet=FALSE;
bRet=DMGetRuntimeProject(MyProjectPath,_MAX_PATH+1,&Error);
if (bRet==FALSE)
{
return ;
}
psz=strrchr(MyProjectPath,'\\');
if (psz==NULL)
{
return ;
}
*(psz+1)=0;