Hi,
Inspired by this thread
https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/108454/v8i-mdl-how-to-call-projectwise-api-from-native-code-mdl/329450#329450
I'm trying to call the ProjectWise API from MDL/cpp. I would like to get the active datasource, project and document from PW Explorer and I've tried to do it this way:
if (aaApi_Initialize(AAMODULE_EXPLORER)) { aaApi_InitializeModules(AAMODULE_ALL); HDSOURCE dataSource = aaApi_GetActiveDatasource(); if (dataSource == NULL) lifalib_dmsg("NULL"); else lifalib_dmsg("ActiveDatasource OK"); lifalib_dmsg("Count = %d", aaApi_GetProjectCount());
The dataSource is NULL and the number of projects is -1...
There is no problem in find a datasource by name:
HDSOURCE *pdataSource; ULong count; if (aaApi_GetDatasourceHandlesByName(L"Test", &pdataSource, &count)) lifalib_dmsg("OK"); else lifalib_dmsg("NOT OK");
What am I missing or doing wrong ?
Regards,
Evan H. Hansen
Hi Evan,
please be aware this is general Developer and Programming forum. Because you want to use ProjectWise API, I recommend to move the question to ProjectWise Programming forum. To move existing discussion to another forum, use More > Move tool, available under the original post.
Also, please respect the best practices and to share mandatory information about used products and their version (in this case, the combination of MicroStation and ProjectWise client). It's hard to guess anything when information like whether you use V8i or CONNECT Edition (and what build), plus what Visual Studio do you use, is not known.
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi Jan,
The question have now been moved to the PW programming forum...
Evan
EvanH said:The question have now been moved to the PW programming forum...
Unfortunately, it looks like you did not move anything, but you duplicate the post (by asking the same in PWP forum). It breaks the best practices and creates confusing situation, because two quite the same threads exist .. and what is the active one?
Why to do things in a wrong way, when the right one exists and is simple (and I wrote how to do it)?