Carlos,
Thanks for your reply. I'd already read those articles and I'd guessed
about the scope of the event handler being a problem and already made
it a private member variable.
In order to help anyone see where I'm going wrong, here's a pared down
version of the code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace CIUSVSSHandler
{
public class VSSHandler : SourceSafeTypeLib.IVSSEventHandler
{
private SourceSafeTypeLib.VSSApp pIVSS;
#region IVSSEventHandler Members
void SourceSafeTypeLib.IVSSEventHandler.Init(SourceSafeTypeLib.VSSApp
pIVSS)
{
this.pIVSS =3D pIVSS;
this.pIVSS.BeginCommand +=3D new
SourceSafeTypeLib.IVSSEvents_BeginCommandEventHandler(pIVSS_BeginCommand);
this.pIVSS.EndCommand +=3D new
SourceSafeTypeLib.IVSSEvents_EndCommandEventHandler(pIVSS_EndCommand);
this.pIVSS.BeforeEvent +=3D new
SourceSafeTypeLib.IVSSEvents_BeforeEventEventHandler(pIVSS_BeforeEvent);
this.pIVSS.AfterEvent +=3D new
SourceSafeTypeLib.IVSSEvents_AfterEventEventHandler(pIVSS_AfterEvent);
this.pIVSS.BeforeCheckin +=3D new
SourceSafeTypeLib.IVSSEvents_BeforeCheckinEventHandler(pIVSS_BeforeCheckin);
}
void pIVSS_EndCommand(int unused)
{
MessageBox.Show("pIVSS_EndCommand");
}
bool pIVSS_BeforeEvent(int iEvent, SourceSafeTypeLib.VSSItem pIItem,
string Str, object var)
{
MessageBox.Show("pIVSS_BeforeEvent");
return true;
}
void pIVSS_AfterEvent(int iEvent, SourceSafeTypeLib.VSSItem pIItem,
string Str, object var)
{
MessageBox.Show("pIVSS_AfterEvent");
}
bool pIVSS_BeginCommand(int unused)
{
MessageBox.Show("pIVSS_BeginCommand");
return true;
}
bool pIVSS_BeforeCheckin(SourceSafeTypeLib.VSSItem pIItem, string
Local, string Comment)
{
MessageBox.Show("pIVSS_BeforeCheckin");
return true;
}
#endregion
}
}
As I said, the only events I get when I compile this are the
BeginCommand and EndCommand and the checkout command fails to work with
the handler installed.
Any help would be appreciated.
Regards,
[quoted text, click to view] Carlos J. Quintero [VB MVP] wrote:
> Hi,
>
> I suppose that you have already read:
>
> Visual SourceSafe 6.0 Automation
>
http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/dnvss/=
html/vssauto.asp
>
> and
>
> Microsoft Visual SourceSafe OLE Automation
>
http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/dnvss/=
html/msdn_vssole.asp
>
> If you are using C#, ensure that you are not incurring in the problem with
> C# event handlers and COM Interop when using procedure variables that I
> described at:
>
> PRB: Visual Studio .NET events being disconnected from add-in.
>
http://www.mztools.com/articles/2005/MZ012.htm >
> --
>
> Best regards,
>
> Carlos J. Quintero
>
> MZ-Tools: Productivity add-ins for Visual Studio
> You can code, design and document much faster:
>
http://www.mztools.com >
>
> "IsItBuxton" <isitbuxton@gmail.com> escribi=F3 en el mensaje
> news:1155570488.305249.171980@75g2000cwc.googlegroups.com...
> > I've created an event handler to react to the events that are fired by
> > SourceSafeTypeLib. The handler installs OK, but the only events that I
> > get called to handle are Init, BeginCommand and EndCommand. The Init
> > and EndCommand events are always called, but the BeginCommand is only
> > called if I don't create handlers for any other event.
> >
> > I'm using VSS 6.0d and I'm trying to create the handler in c# written
> > in VS2005. I've made the utility com interop registered so that it can
> > be used by VSS.
> >
> > I've looked around and found that others have had a similar experience,
> > even some who say that they've got it working, but I've not found
> > anyone who has published a solution.
> >
> > If you've done this and got it to work - c# / VB.Net, I don't mind
> > which - or know of any coding sites with up-to-date examples then I'd
> > appreciate it if you could give me some pointers.
> >
> > Thanks.
> >