Back to the cPicture start page
cPicture supports function plug-ins to process/display selected pictures.
This function plug-in calls the script cPicture.bat with 5 parameters.
Sample for cPicture.bat :
@echo OFF
echo name =%1
echo file =%2
echo path =%3
echo width =%4
echo height=%5
pause
Sample output:
name ="C:\Documents and Settings\jurgene\Desktop\cPicture\IMG_6038.JPG"
file ="IMG_6038.JPG"
path ="C:\Documents and Settings\jurgene\Desktop\cPicture\"
width =2272
height=1704
Download function plug-in
(88KB)
Installation: copy the plugin to the same folder where you copied cPicture.exe. Put the script files in the same folder.
You can use max 10 scripts.
A function plug-in could be executed for the selected pictures:
or used in a custom action:
A function plug-ins will be executed in 3 steps.
The following example displays a message box for each step.
Step 1:
The function start(...) will be called with a list of all selected pictures.
In this first sample, all picture names will displayed in the message box:
struct request_info
__stdcall CFunctionPluginSample1::start(HWND
hwnd, const
vector<const
TCHAR*>& file_list) { CString list(_T("start\n------\n")); for(vector<const TCHAR*>::const_iterator it = file_list.begin(); it != file_list.end(); ++it) { list += *it; list += _T("\n"); } AfxMessageBox(list, MB_ICONINFORMATION); return request_info(); } |
Step 2:
The function process_picture(...) will be called for each selected picture:
bool
__stdcall CFunctionPluginSample1::process_picture(const
picture_data& _picture_data) { const CString msg(_T("process picture:\n")); AfxMessageBox(msg + _picture_data.m_name, MB_ICONINFORMATION); return
true; |
cPicture can supply each picture with additional picture data. This is controlled by the return value of start(...).
With this you can easily create external display applications (example below) or simply call a script or an external program.
The execution stops if the return value is set to 'false'.
Step 3:
The funktion end() will be called last:
const vector<update_info>&
__stdcall CFunctionPluginSample1::end()
{ AfxMessageBox(_T("end"), MB_ICONINFORMATION); return m_update_info; } |
The return value determines which pictures were modified/deleted or added.
cPicture adjusts the display accordingly.
Download Source code (9KB), function plug-in
(148KB)
The following 2 samples show other possible uses.
This sample shows a simple viewer:
Download source code (12KB), function plug-in (176KB)
This sample shows a simple order client:
(This sample is not functional working. You cannot order pictures but use it as a programming template.)
Download source code (14KB), function plug-in (192KB)