Check Out / Get
Return to Introduction  Previous page  Next page
If these methods are exported from the DLL, they will be called before and after a CheckOut or Get event:

VcsBeforeCheckOut

function VcsBeforeCheckOut( ProjectID, FolderID, FileID, UserID, ViewID: Cardinal;   
                            const Info: PCheckOutInfo;   
                            const strError: PChar ): Boolean; stdcall; export;  

This function is called before a CheckOut or Get action occurs. The parameters define what file is being checked out and where it is being checked out to. You can use this information to validate the Checkout/Get action or, using the Direct API, to modify the action before it occurs. If you want to stop the action occurring, return False from the function, otherwise, return True.

Parameters

Name
Description
ProjectID
ID of the containing Project
FolderID
ID of the Folder that contains the file
FileID
ID of the file
UserID
ID of the user carrying out the action
ViewID
If a View is applied, the ID of the View
Info
A pointer to the TCheckOut structure containing information about how the checkout/get will be handled.

Note: if Info.Lock is True the action is a CheckOut, otherwise it is a Get.
strError
If you return False from this function to cause the action to fail, you can assign a description of the error here.



VcsAfterCheckOut


procedure VcsAfterCheckOut( ProjectID, FolderID, FileID, UserID, ViewID: Cardinal;   
                            Path: PChar; Lock: Boolean; Result: Integer ); stdcall; export;  

This procedure is called after a CheckOut or Get action occurs.

Parameters

Name
Description
ProjectID
ID of the containing Project
FolderID
ID of the Folder that contains the file
FileID
ID of the file
UserID
ID of the user that carried out the action
ViewID
If a View is applied, the ID of the View
Path
The location where the file was checked in from
Lock
If Lock is True, this was a CheckOut action, otherwise it was a Get.
Result
The result code for the action. If the action was successful, Result will be Err_OK otherwise it will be one of the standard error codes defined in TCVcsConst.pas



Example (Delphi)

The following Before Checkout handler simply modifies the Info structure to force the assigning of a predetermined Version Label during the Checkout:

function VcsBeforeCheckOut( ProjectID, FolderID, FileID, UserID, ViewID: Cardinal; const Info: PCheckOutInfo; const strError: PChar ): Boolean;  
begin  
  if Info.Lock then  
  begin  
    // We are checking out the file. Assign a standard label (predetermined elsewhere)  
    if Info.AssignVersionID = 0 then  
      Info.AssignVersionID := 919283  
  end;  
  Result := True;  
end;  
 
 
The following method is called after a Get action and forces the local file to be writable:

procedure VcsAfterCheckOut( ProjectID, FolderID, FileID, UserID, ViewID: Cardinal; Path: PChar; Lock: Boolean; Result: Integer );  
begin  
  if ( Result = Err_OK ) and ( not Lock ) then  
  begin  
    // We are doing a Get, so the file will be readonly. If the file is a dpr, then  
    // make it writable  
    if CompareText( ExtractFileExt( String( Path ) ), '.dpr' ) = 0 then  
      FileSetAttr( String( Path ), FileGetAttr( String( Path ) ) and not faReadOnly );  
  end;  
end;  



 


© 1995-2018 MCN Software