I am planning to develop a custom ProjectWise API using C++ in Microsoft Visual Studio 2008 and am having trouble determining which "Project Type" to create. The API will be called from another application and passed a parameter which will search ProjectWise for documents meeting some criteria and then if those documents are found a window would pop up that includes links to each document.
I have developed other PW API's in VS 2005 using MFC Application and WIn32 Console Application types but I don't think they will work because I need to open a window, just not at startup time. I tried starting a project using a Windows Forms Application type and was able to open a custom window later, but when I tried setting it up to use the API functions like I normally would for an MFC application, I got compiler errors from several of the API header files and got stuck. Any suggestions?
Thanks,
Stephanie
Create the type that would best fit the application it will be called from. What kind of a window do you need to open? ProjectWise may be able to do it for you.
Opening an window\dialog etc with MFC as a PW extension is possible (easy)
it look like you are including the wrong header files for mfc or pw lib at link time ?
Any more details on the errors - this shoudl work as MFC.
Best regards
Ian Emery
The resulting window only needs to consist of links to all the documents found in PW, nothing special.
I'm using the same PW header files I always do (aaapidef.h, aadmsdef.h, aawddef.h, aadmsapi.h) but am getting many syntax-type errors (ie C2146: syntax error : missing ';' before identifier 'ulMask' for line 450 of aaapidef.h).
If I create an MFC dialog-based project, how do I prevent the dialog from being created until after the PW search has completed? If nothing is found in PW , I don't want the dialog.
Take a look at this code. you can skip the last two lines if there are no results;
void CreateAndDisplayDocumentSearch(LONG lProjectId)
{
//FILE *fp;
//_TCHAR line[256];
//CStringArray caFolderList;
WCHAR value[64] = L"";
CString line;
CString csSQueryName = _T("");
LONG lIndx = 0;
LONG lSearchCount = 0;
LONG lProjectCount = 0;
HAADMSBUFFER hCriteriaBuf = (VOID *)NULL;
HAADMSBUFFER hSavedSearches = (VOID *)NULL;
//HDSOURCE m_hDataSource;
const GUID pset_DOCUMENT_GENERIC = PSET_DOCUMENT_GENERIC;
LONG lSQueryId = 0; //ID created
AADSCTREEITEM dscItem;
HWND hWndFrame = (HWND)NULL;
HWND hWndList = (HWND)NULL;
HTREEITEM hSearchTree = aaApi_DscTreeSelectSearchResultsItem (NULL, aaApi_GetActiveDatasource ());
//Creating Search Criteria Buffer Contents
_ltow_s(lProjectId, value, 64, 10);
hCriteriaBuf = aaApi_SQueryCriDataBufferAddCriterion(hCriteriaBuf,lIndx+1,VT_SINGLE_VALUE,&pset_DOCUMENT_GENERIC, _T(""),
QRY_DOC_PROP_PROJ_ID, DMS_RELATION_EQUAL,AADMS_ATTRFORM_DATATYPE_BIGINT,
value);
if ( hCriteriaBuf == NULL )
line.Format(_T("project criteria creation failed when trying to add project %d."),lProjectId);
WriteErrorToLog(line);
}
_itow_s(1, value, 64, 10); //Setting Include Subfolders to 1 or TRUE
//This is supposed to be like checking the include subfolders box
hCriteriaBuf = aaApi_SQueryCriDataBufferAddCriterion(hCriteriaBuf, lIndx+1, VT_SINGLE_VALUE, &pset_DOCUMENT_GENERIC,
NULL, QRY_DOC_PROP_INCSUBVAULTS, DMS_RELATION_EQUAL,
AADMS_ATTRFORM_DATATYPE_INT,value);
line.Format(_T("project criteria creation failed when trying to add subfolders for project %d."),lProjectId);
memset (&dscItem, 0, sizeof (dscItem));
dscItem.ulMask = AADSCTIM_TYPEID | AADSCTIM_DATASOURCE | AADSCTIM_ITEMID; // some flags are skipped for simplicity
dscItem.hDataSource = aaApi_GetActiveDatasource();
dscItem.lTypeId = DSCITYPE_SEARCH_RESULTS;
dscItem.hItem = hSearchTree;
hWndFrame = aaApi_CreateDocumentListFrame(aaApi_GetMainFrameWindow(),
0,
512,
&dscItem,
&hWndList);
aaApi_FindDocumentsToDocumentList(hWndList,hCriteriaBuf);
aaApi_DmsDataBufferFree(hCriteriaBuf);
hCriteriaBuf = (VOID *)NULL;