Solved

Sourcesafe api (IVSSItem)  in Delphi

Posted on 2006-10-21
11
689 Views
Last Modified: 2008-01-09
Could some one tell me if it's possible/how to using to invoke the diff functionality in visual sourcesafe in delphi (version 4) ( preferably without usinf third party tools)?

Also how do i acess the version information/checking comments for an item please?

any sample source code would be appreciated

tks


0
Comment
Question by:KevinBadger
  • 6
  • 2
  • 2
11 Comments
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 85 total points
ID: 17787408
If I'm not mistaken, VSS has an automation interface. So all you would have to do is import this as a type library in your project and then check the functionality that it provides to you. Have you tried using that directly?
0
 

Author Comment

by:KevinBadger
ID: 17790167
i've tried importing SourceSafeTypeLib_TLB which is where i get IVSSItem from but it soen't seem to have  much functionality
0
 
LVL 17

Assisted Solution

by:Wim ten Brink
Wim ten Brink earned 85 total points
ID: 17793861
Well, if you have imported the type library then also look at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvss/html/vssauto.asp for more information.
A Google search for http://www.google.nl/search?hl=en&q=SourceSafeTypeLib&btnG=Google+Search is how I found that one, btw. :-)
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 26

Assisted Solution

by:EddieShipman
EddieShipman earned 40 total points
ID: 17821950
In order to check the DIFF on an item, do something like this:
(loose translation of some VBS code I have)

procedure VSSCheckin(AVSSIniFile, AFileName, AVSSItemPath, AVSSUserName, AVSSPassword: String;
                     ACheckinIfDiff: Boolean; ACheckInComment: String; AExclusive: Boolean = True);
var
  oVSSItem: IVSSItem;
  oVSSDatabase: IVSSDatabase;
  iFlags: Integer;
begin
  if AExclusive then
    iFlags := VSSCHECKOUT_EXCLUSIVE
  else
    iFlags := VSSCHECKOUT_SHARED;
  // Create the Database object
  oVSSDatabase := CreateOleObject('SourceSafe') as IVSSDatabase;
  try
    oVSSDatabase.Open(AVSSIniFile, AVSSUserName, AVSSPassword);
    oVSSItem := oVSSDatabase.VSSItem[AVSSItemPath, False];
    // Check it out
    oVSSItem.Checkout('Checked out by automated process', AFileName, iFlags);
    if (oVSSItem.IsDifferent[AFileName]) and (ACheckinIfDiff) then
    begin
      oVSSItem.Checkin(ACheckInComment, AFileName, iFlags);
    end
    oVSSDatabase.Close;
  finally
    oVSSDatabase := nil;
  end;
end;


I don't have the VSS TypeLib imported because I can't find it even though I have VSS Installed on
my system. Oh, wait, here it is... Let me double check that code before I finish this post...

Since I am going to begin working on a VSS project, I needed to know how to do that and I
posted code that works.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 17822027
If you need more, llike how to get the individual version comments, let me know.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 17901502
KevinBadger, have you tried any of our solutions?
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 17902320
Wow, a 'B' for that, huh? You may need to be a little more careful about your grading in the future if you
want expert help.
0
 

Author Comment

by:KevinBadger
ID: 17908762
Sorry Eddie,
I didn't take time to read throught properly.
I was looking for a diff as in file comparison  (Sourcesafe "show differences") though. I suppose I could just launch the diff app if its available as aseperate executable
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 17910078
It was not clear what you wanted to do. I do not know if showing the diff from the VSSItem woul duse the external diff util or not. I will test that and get back with you.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 18237412
From Alin Constantin at:
https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1057737&SiteID=1

...

IVSS is an automation interface, therefore there is no UI associated with it.

If you use VSS 6.0 IVSS API, there is an unsupported Diff-Merge OCX control
providing the diff-merge UI. It is included with the SourceSafe Automation
Sample written by Tim Winter. It's available at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvss/html/msdn_vssole.asp

If you use VSS 2005, the functionality of the unsupported control has been
replaced with command line invocation of SourceSafe Explorer. Syntax and
examples for Edit/View/Diff/Merge can be found at:
http://msdn2.microsoft.com/en-us/library/ms181130(VS.80).aspx
...


0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question