Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OLE interface issues

1 view
Skip to first unread message

Jeff

unread,
Aug 6, 2008, 1:21:41 PM8/6/08
to
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();
}
}
//---------------------------------------------------------------------------


0 new messages