IOPCBrowseServerAddressSpace 的使用(vc) 点击:1064 | 回复:0



黑羽

    
  • 精华:0帖
  • 求助:0帖
  • 帖子:4帖 | 3回
  • 年度积分:0
  • 历史总积分:15
  • 注册:2003年12月18日
发表于:2004-11-15 17:18:00
楼主
void TryBrowseBranch(IOPCBrowseServerAddressSpace *pBSAS, LPCWSTR lpprestr,LPCWSTR lpcw) { HRESULT r1; OPCNAMESPACETYPE onst; LPWSTR pItemID; WCHAR s,*lp; IEnumString *pEnum = 0; char szBuf[40]; long nPos = 1; HRESULT r2 = S_OK; LPOLESTR pStr; ULONG actual; lp = WSTRFromSBCS("%ls,%ls",pIMalloc); pBSAS->ChangeBrowsePosition(OPC_BROWSE_DOWN,lpcw); r1 = pBSAS->BrowseOPCItemIDs(OPC_FLAT,&s,VT_EMPTY,0,&pEnum); pBSAS->QueryOrganization(&onst); while((r2 = pEnum->Next(1, &pStr, &actual)) == S_OK) { printf("%ls%ls--%ls\n",lpprestr,lpcw, pStr); wprintf(lpprestr,lp,lpcw,pStr); if(onst == OPC_BRANCH) TryBrowseBranch(pBSAS,lpprestr,pStr); } // pBSAS->ChangeBrowsePosition(OPC_BROWSE_DOWN, // printf("OPC_NS_HIERARCHIAL 含有枝干"); // get firset item pIMalloc->Free(lp); pIMalloc->Free(pStr); pEnum->Release(); pBSAS->ChangeBrowsePosition(OPC_BROWSE_UP,lpcw); }


热门招聘
相关主题

官方公众号

智造工程师