<html> <head> <title>Jam Example</title> <style TYPE="text/css"> <!-- BODY {font: 12px/16px verdana, arial, sans-serif !important; text-align: left; margin-left: 2cm; color:#000000 !important;} .cell {font: 12px/16px verdana, arial, sans-serif !important; text-align: left; color:#000000 !important;} TD {font: 12px/16px verdana, arial, sans-serif !important; text-align: left; color:#000000 !important;} H1 {font: 18px/18px verdana, arial, sans-serif !important; text-align: left; color:#333333 !important;} H2 {font: 18px/18px verdana, arial, sans-serif !important; text-align: left; color:#333333 !important; font-weight: bold; margin-bottom: 14px} H3 {font: 14px/14px verdana, arial, sans-serif !important; text-align: left; color:#333333 !important; font-weight: bold; margin-bottom: 14px} pre { border-right: #646464 1px solid; padding-right: 0.5em; border-top: #646464 1px solid; padding-top: 0.5em; border-left: #646464 1px solid; padding-left: 0.5em; border-bottom: #646464 1px solid; padding-bottom: 0.5em; white-space: pre; background-color: #f6e6e6; color: black; margin-left: 1em; width: 90%; display: table; font-size: 100%; } --> </style> </head> <body> <h1><a name="top"></a>P4COM - COM Interface to Perforce C++ API on Windows</h1> <p>p4com is contributed by <a href="http://public.perforce.com/guest/robert_cowham/pcp.html"> Robert Cowham</a> of Vaccaperna Systems Ltd.</p> <p>See the paper I presented at the Perforce User Conference in 2001: <a href="http://www.perforce.com/perforce/conf2001/index.html#myth">Adventures in API Land</a> for an overview of the API and how I use it. In particular pay attention to the section on error handling!</p> <p>This DLL is similar to p4vb which is part of <a href="http://www.perforce.com/perforce/products/plugins-ofc.html">P4OFC - the integration between Microsoft Office and Perforce</a> and thus is stable and tested.</p> <h2>Compiler</h2> <p>This COM DLL has been built with MS VC++ 6.0 (SP5). Future versions will be built with VC++ 7.0.</p> <p>Use either of the project settings:</p> <ul> <li>Debug</li> <li>Release Min Dependency</li> </ul> <p>You can download the complete source and a pre-built (release) version of the resulting DLL from <a href="p4com.zip">p4com.zip</a>.</p> <p>To use it, you need to register the DLL (run regsvr32.exe on the DLL). I suggest you install in "<a href="file:///c:/program%20files/perforce">c:\program files\perforce</a>" or wherever you installed Perforce.</p> <p>An installer will be provided in the future.</p> <h2 ALIGN="LEFT">Main Interface</h2> <p ALIGN="LEFT">The interface has been reworked from previous incarnations and is similar to that implemented by Tony Smith for Ruby.</p> <p ALIGN="LEFT">There is a single object P4COMLib.p4 which should be instantiated and used.</p> <p>Note that the command will pick up Perforce environment information in the the normal way - so global settings are used, or P4CONFIG settings are used. Make sure the current directory where your code is executing is set appropriately.</p> <h2>Examples</h2> <p>As an example of using it, in a VB project, make sure you have set a reference to COM object "p4com 1.0 Type Library".</p> <p>You can then execute a simple command such as "p4 info":</p> <pre>Dim p4 As P4COMLib.p4 Dim InfoArr() As String Dim ErrorArr() As String p4.Connect InfoArr = m_p4.run("info") Dim i as integer For i = LBound(InfoArr) To UBound(InfoArr) ResultBox.AddItem InfoArr(i) Next p4.Disconnect </pre> <p ALIGN="LEFT">This assumes a Listbox called ResultBox.</p> <h3 ALIGN="LEFT">Example Projects</h3> <p ALIGN="LEFT">These are to be found in the zip file.</p> <p ALIGN="LEFT">They demonstrate how to read and set environment values (p4.port, p4.client), and also how to perform a submit using a combination of "p4 change -o", manipulate the results and then execute the command with "p4 submit -i"</p> <p ALIGN="LEFT">There are 3 example projects (very similar functionality):</p> <ul> <li> <p ALIGN="LEFT">VB6</p> </li> <li> <p ALIGN="LEFT">VB.NET</p> </li> <li> <p ALIGN="LEFT">C# (.NET)</p> </li> </ul> <p ALIGN="LEFT">Just load them up, compile and run and you should be fine (provided DLL was previously registered).</p> <p> <a href="#top">Top</a> </p> </body> </html>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#23 | 10878 | Robert Cowham | Update doc and also .zip file. | ||
#22 | 8062 | Robert Cowham | Link to P4API.Net | ||
#21 | 7460 | Robert Cowham | Update with SetTicketFile | ||
#20 | 7455 | Robert Cowham | Update version of visual studio referenced | ||
#19 | 6050 | Robert Cowham |
- Use P4API 2007.2 - Added SetProg, SetVersion, SetProtocol and GetProtocol |
||
#18 | 5969 | Robert Cowham | Add pointer to P4.Net | ||
#17 | 5197 | Robert Cowham | Updated to use 2005.1 P4API | ||
#16 | 5195 | Robert Cowham | Tidied | ||
#15 | 5194 | Robert Cowham |
Changes (2005.1.0.0) Added Dropped() to detect dropped connections Added Input property to provide input e.g. for passwords Added FormatDateTime() as a convenience for calling C Runtime function (for VB use) Imported changes from p4ofc which made it more reliable. |
||
#14 | 4742 | Robert Cowham |
New version 2004.2.0.1 Added Scons for building zip file. |
||
#13 | 4242 | Robert Cowham |
Fixed some String leaks. Fixed problem with writing to temporary files. Updated p4API to released version of 2003.2. Start of Delphi example. |
||
#12 | 4182 | Robert Cowham | Release 1.0.0.4 - put output of Diff in normal output array. | ||
#11 | 4156 | Robert Cowham | Updated to support Variant Arrays (as required by VBScript). | ||
#10 | 3880 | Robert Cowham | Reference Nick's Lisp interface. | ||
#9 | 3615 | Robert Cowham | Tidied up | ||
#8 | 3612 | Robert Cowham |
Version 1.0.0.2 New interface for ServerVersion. New put property ArrayVarVar which is the same as ArrayVar but takes an Array of Variants rather than strings (for Lisp compatibility!). |
||
#7 | 3561 | Robert Cowham | Renamed P4COMLib to P4COM and run from property to method. | ||
#6 | 3546 | Robert Cowham | Tidied up | ||
#5 | 3545 | Robert Cowham | More examples | ||
#4 | 3544 | Robert Cowham | Updated docs. | ||
#3 | 3535 | Robert Cowham | Update title | ||
#2 | 3534 | Robert Cowham | Added complete test projects for VB6, VB.NET and C#(.NET) | ||
#1 | 3530 | Robert Cowham | Docs and simple VB demo. |