Article View: borland.public.cppbuilder.nativeapi
Article #45OLE interface issues
From: Jeff
Date: Wed, 06 Aug 2008 17:21
Date: Wed, 06 Aug 2008 17:21
70 lines
3350 bytes
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();
}
}
//---------------------------------------------------------------------------
Technical Details
Message-ID:
<4899dda4$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,4b56edeeaa96ec2f,start X-Google-Attributes: gid10cc67,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Jeff" <Jeff@nospam.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: OLE interface issues Date: Wed, 6 Aug 2008 11:21:41 -0600 Lines: 72 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 206.104.31.18 Message-ID: <4899dda4$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1218043300 206.104.31.18 (6 Aug 2008 10:21:40 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail