Hi all,
I'm new in Microstation / ProjectWise programming and I'm searching for an example about using of aaApi_FindDocuments2 api in C# because I've some problem in parameters Marshaling. I've seen "MostODaveClasses.cs" where is implemented DocumentRequestColumns, DocumentProperties_stc structs and so on. My goal is select some document by a saved searched to gets its attributes after. All works well, until the call to aaApi_FindDocuments2 that throw an exception about memory corruption: I suspect that is the marshaling of this struct since the C++ method gets an union type. This is the code:
// The callback...
PwWrapper.HandlerFindDocuments2 dd = delegate (int reason, ref PwWrapper._FINDDOC_RESULTS result, IntPtr userData) { return true; };
bool cancel = false;
// The column requested: I've not understood the logic, I would like to retrieve all columns
var wantedColumns = new PwWrapper.CompactPropertyReference[] { new PwWrapper.CompactPropertyReference() { guidPropertySet = PwWrapper.PSET_DOCUMENT_GENERIC, sPropertyName = "", uiResultType = 0, uiPropertyID = 0 }, };
var properties = new PwWrapper.DocumentProperties_stc { eResultFlags = PwWrapper.QueryResultFlags.NoDocVersions, // QRY_RESULT_NO_DOC_VERSIONS I' don't know what is the meaning of this sProperty = wantedColumns, uiPropertyCount = (uint)wantedColumns.Length, };
var request = new PwWrapper.DocumentRequestColumns(); request.padding = new byte[120]; request.properties = new PwWrapper.DocumentProperties_stc { sProperty = wantedColumns, eResultFlags = PwWrapper.QueryResultFlags.NoDocVersions, // QRY_RESULT_NO_DOC_VERSIONS uiPropertyCount = (uint)wantedColumns.Length };
var tre = PwWrapper.aaApi_FindDocuments2(criteriaBuffer, request, dd, IntPtr.Zero, true, ref cancel, 0, 0);
Any help is welcome. Thank you in advance.
Simone
PS: ProjectWise is V8i Select Series 4