View Full Version : Development of plugins
Being an advanced user of BC, I have started to write plugins to do our own comparision on special of results. At our company we do many mathematical calculations and differences between results can indicate all sorts of problems.
I have downloaded the sample code for a plugin in C++, loaded it in MS Visual Studio, but it fails to compile. I wonder I someone has experience in using this sample code to write own plugins.
Thanks.
Erik
12-Mar-2004, 10:39 AM
The MFC Sample Viewer was developed by a German company called Humbach Datentechnik. In the project options, they included a post-build command line to copy the dll to a folder that only exists on German Windows. Download the new MFC Sample Viewer (http://www.scootersoftware.com/SampleView-MFC.zip) which replaces this step with a copy of dll to the source folder as a bcp. You will have to copy the bcp to your Beyond Compare 2 program folder to use it.
Please keep me updated on your progress. We'd be happy to try out any plug-in that you develop.
kmolenmaker
26-Mar-2004, 06:17 AM
I have managed to get the plugin compiled in Visual Studio and made some simple changes to it. So far so good.
Appearently there is a difference in file compare when using the Sample viewer and when using a rules based compare. The method CViewerDlg::CompareFiles() is called only when the viewer is used to compare. In my case I mostly want to use a command line compare and a plugin to compare the results, no user intervention is allowed. It is all part of an automated proces flow. Any suggestions on how to proceed.
Thanks.
Erik
26-Mar-2004, 10:21 AM
Quick comparisons using plug-ins has been added to the plug-in interface. The MFC Sample Viewer is not up to date. However, the Delphi Sample Viewer (http://www.scootersoftware.com/SampleView.zip) is.
Here are the key elements:
enum EBCMatchtype
{
BC_MATCH_UNKNOWN = 0x0001, // Files haven't been compared or comparison failed
BC_MATCH_COMPARING = 0x0002, // Comparison in progress
BC_MATCH_DIFFERENT = 0x0003, // Files are different
BC_MATCH_SIMILAR = 0x0004, // Files are different, but only in "insignificant" ways
BC_MATCH_EXACT = 0x0005 // Files match exactly
};
Word __stdcall QuickCompare(void* AFile1, void* AFile2, Word AFormat, LongInt* Complete, LongBool* Canceled)
mage7223
22-Feb-2005, 02:29 PM
Word __stdcall QuickCompare(void* AFile1, void* AFile2, Word AFormat, LongInt* Complete, LongBool* Canceled)
Is this exported from the DLL like the
GetBCPluginInfo,
GetBCPropertiesInfo,
GetBCViewerInfo,
OnLoadDone, and
OnUnload
Exports?
-Kevin
Craig
02-Mar-2005, 04:49 PM
No, it's not exported, it's part of the TBCViewerPlugin record. Put the following right after the UpdateCompareResults function declaration (~line 435)
// Added in Plugin Interface 2.3
// Lets Beyond Compare know when the viewer has gained and lost focus so it can
// handle accelerator keys. This must be called by non-Delphi plugins to allow
// keyboard accelerators to work properly.
void (__stdcall* ViewerActivated)(HWND hViewer, LongBool bIsFocused, HACCEL hAccelTable);
// Added in Plugin Interface 2.4
// Called by Beyond Compare to have the viewer perform a rules-based comparison
// of two files. The files are passed in using the same format passed to LoadFiles,
// and the result should be one of the BC_MATCH constants. Optional, if not provided
// BC will do a binary comparison.
//
// While performing the comparison the plugin can write a percentage done to the Complete
// variable, and can read the Cancel variable to detect a user abort.
Word (__stdcall* QuickCompare)(const char* strAFile1, const char* strAFile2,
Word nAFormat, LongInt* pnComplete, LongBool* pbCanceled);
You also need to change BC_INTERFACE_VERSION to 0x00020004.
The format (nAFormat) will always be either BC_TRANSFER_PCHAR or BC_TRANSFER_STREAM, so it's safe to treat the filenames as null terminated strings. If you don't want to deal with the extended directory support (zips and ftps), you only need to pay attention to BC_TRANSFER_PCHAR, where strAFile1 and strAFile2 will be fully qualified paths with either a drive letter or a UNC path.
I doubt it will matter, but any QuickCompare() function you provide will only be called if the files have binary differences. BC will automatically do a binary comparison first in rules-based mode, and will skip the plugin if the files match.
vBulletin® v3.7.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.