Visual studio project type for ProjectWise API

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

Parents Reply Children
  • 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);

    if ( hCriteriaBuf == NULL )

    {

    line.Format(_T("project criteria creation failed when trying to add subfolders for project %d."),lProjectId);

    WriteErrorToLog(line);

    }

    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,

    0,

    512,

    512,

    &dscItem,

    &hWndList);

    aaApi_FindDocumentsToDocumentList(hWndList,hCriteriaBuf);

    aaApi_DmsDataBufferFree(hCriteriaBuf);

    hCriteriaBuf = (VOID *)NULL;

    }

  • What version of Visual Studio are you using to compile your module ?



  • 2010.

    WRT DeanLyon's code, I'm haven't used the functions to create queries before, but since my search procedure is taking so long to process I'm going to give it a whirl and use the documentlistframe function to display. I do have a couple of questions about how to adapt this to my search. There are several specific parent folders (and all their subs) that I want to perform the search on. Is there are way to specify these projects in the query? Also, since I'm getting  compiler errors when including some of the PW header files, I'm not sure how to get a Win32 Project to work or if I should create a different Visual Studio project type to start with.

  • Take a look at the sample Visual Studio solutions/projects that are shipped with the ProjectWise SDK. We compile those solutions as part of our product build to ensure that they work on users' computers, so you should be able to look at the build settings used in the samples and compare them to the build settings you are using for your project.

    HTH

    Mike