IOPCBrowse interface | Classic OPC: DA, A&E, HDA, XML-DA, etc. | Forum

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
IOPCBrowse interface
Avatar
Mounir Ben Abdallah
New Member
Members
Forum Posts: 2
Member Since:
07/17/2019
sp_UserOfflineSmall Offline
1
10/14/2020 - 08:32
sp_Permalink sp_Print

Hi,

I'm using the Browse method (IOPCBrowse interface) to browse the address space (DA 3.0).

void Browse(
[MarshalAs(UnmanagedType.LPWStr)]
string szItemID,
ref IntPtr pszContinuationPoint,
[MarshalAs(UnmanagedType.I4)]
int dwMaxElementsReturned,
OPCBROWSEFILTER dwBrowseFilter,
[MarshalAs(UnmanagedType.LPWStr)]
string szElementNameFilter,
[MarshalAs(UnmanagedType.LPWStr)]
string szVendorFilter,
[MarshalAs(UnmanagedType.I4)]
int bReturnAllProperties,
[MarshalAs(UnmanagedType.I4)]
int bReturnPropertyValues,
[MarshalAs(UnmanagedType.I4)]
int dwPropertyCount,
[MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.I4, SizeParamIndex=8)]
int[] pdwPropertyIDs,
[Out][MarshalAs(UnmanagedType.I4)]
out int pbMoreElements,
[Out][MarshalAs(UnmanagedType.I4)]
out int pdwCount,
[Out]
out IntPtr ppBrowseElements);

Using the method GetBrowseElements, I can read only the first letter for the Item ID. 

I appreciate any thoughts or advice.

Avatar
Randy Armstrong
Admin
Forum Posts: 485
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
10/14/2020 - 14:29
sp_Permalink sp_Print

LPWStr are wchar_t. You cannot cast to char*. If you did you would only see the first character.

Forum Timezone: America/Phoenix
Most Users Ever Online: 202
Currently Online: Z Zhou
Guest(s) 11
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 9
Topics: 764
Posts: 2249