Microsoft KB Archive/193582

= PRB: Project Base Class Is Added to Visual SourceSafe =

Article ID: 193582

Article Last Modified on 3/10/2005

-

APPLIES TO


 * Microsoft Visual SourceSafe 6.0 Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q193582



SYMPTOMS
If you have created a Visual FoxPro project (.pjx) that utilizes a ProjectHook class and you add the project to SourceSafe, you receive the following error:

Source Control cannot operate on open file. Close the file and try again.



CAUSE
When you add files to Visual SourceSafe through Visual FoxPro integration, the files must be closed. The ProjectHook class .vcx is opened automatically by the .pjx and cannot be added to Visual SourceSafe.



RESOLUTION
In the "Add Files to Source Control" dialog box, deselect the .vcx that contains the ProjectHook class. If you want to store the ProjectHook class in Visual SourceSafe, create a new .pjx that is not based on a ProjectHook class and add the .vcx there. You can then add the new .pjx to Visual SourceSafe.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
Visual FoxPro version 6.0 allows you to create a .pjx that utilizes a ProjectHook class, which allows you to associate code with certain project events. By default, the .vcx containing the ProjectHook class is added to Visual SourceSafe when the .pjx is added to Visual SourceSafe.

Steps to Reproduce Behavior
 Make sure Visual SourceSafe Integration is available and working.  In the Visual FoxPro command window, type the following command: CREATE CLASS CaptainHook OF CaptainHook.vcx AS ProjectHook NOWAIT   In the QueryAddFile Event of the ProjectHook, add the following code: WAIT WINDOW cFileName  Save the class and close the Class designer.  In the Visual FoxPro command window, type the following command: CREATE PROJECT CaptainHook

</li> Click Project Info, select the Project Class check box and choose the CaptainHook class from CaptainHook.vcx.</li> Close the project and reopen it.</li> Add a program (new or existing) to the project. Note the WAIT WINDOW with the program's name.</li> From the Project menu, click Add Project To Source Control. Logon, using a valid UserName and password, and store the project in the appropriate location in the Visual SourceSafe database.</li> When the Add Files to Source Control dialog box appears, note that the project hook class .vcx is selected in the list of files to be added to Visual SourceSafe.</li> Click OK.</li></ol>

RESULT: The following error message appears:

Source Control cannot operate on open file \captainhook.vcx. Close the file and try again.

<div class="references_section">