🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
1 messages
1 total messages Started by Jeff Wed, 06 Aug 2008 17:21
OLE interface issues
#45
Author: Jeff
Date: Wed, 06 Aug 2008 17:21
70 lines
3350 bytes
I'm writing an application that connects to a Microsoft Visual SourceSafe 
6.0 database and retrieves information.  I can connect and display the 
project and file structure, but I'm having issues trying to get history 
information.  I found an article with example code here: 
http://support.microsoft.com/kb/169927/

I've put my code below to show you what I have.  The issue is that when I 
step past the _NewEnum call the application uses 50% CPU and nothing 
happens.  What am I doing wrong?  Is there a library I'm not including?

void__fastcall TfrmMain::DumpItemHistory(IVSSItem *ptr_VssItem)
{
     BSTR bstrval;
     char lpbuf[200];
     char lpbuf2[200];

     IVSSItem     *vssi;
     IVSSVersion  *vers;
     IVSSVersions *vx;
     LPUNKNOWN    lpunk;
     IEnumVARIANT *ppvobj;
  VARIANT      st;
  ULONG        fetched;
  long         lvnum;

  memLastComment->Lines->Clear();

    if( S_OK == ptr_VssItem->get_Versions( 0l, &vx ) )
    {
   if( S_OK == vx->_NewEnum(&lpunk) )
         {
     if(!FAILED(lpunk->QueryInterface(IID_IEnumVARIANT, (void**)&ppvobj)))
           {
    vssi->get_Spec( &bstrval );
    WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)bstrval, -1, lpbuf, 
sizeof(lpbuf), NULL, NULL );
    memLastComment->Text += "History of: " + (String)lpbuf + "\n";
    memLastComment->Text += "ACTION   USER NAME   VERSION NUMBER\n";

             do
             {
               ppvobj->Next( 1UL, &st, &fetched );
               if( fetched != 0 )
               {
                 if(!FAILED(st.punkVal->
                   QueryInterface(IID_IVSSVersion,(void**)&vers)))
                 {
                   vers->get_Action( &bstrval );
                   WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)bstrval, -1,
                     lpbuf, sizeof(lpbuf), NULL, NULL );
                   vers->get_Username( &bstrval );
                   WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)bstrval, -1,
                     lpbuf2, sizeof( lpbuf2 ), NULL, NULL );
                   vers->get_VersionNumber( &lvnum );
       memLastComment->Text += (String)lpbuf + "  " + (String)lpbuf2 + "  " 
+ lvnum + "\n";

                   vers->Release();
                 }
                 st.punkVal->Release();
               }
             } while( fetched != 0 );
             ppvobj->Release();
           }
           lpunk->Release();
         }
         vx->Release();
       }
}
//--------------------------------------------------------------------------- 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads