| 1 |
library Sample; |
| 2 |
|
| 3 |
{$mode objfpc}{$H+} |
| 4 |
{$include calling.inc} |
| 5 |
|
| 6 |
uses |
| 7 |
{$IFDEF MSWINDOWS} |
| 8 |
Windows, |
| 9 |
{$ENDIF} |
| 10 |
{$IFDEF unix} |
| 11 |
baseunix, |
| 12 |
{$ENDIF} |
| 13 |
Classes, |
| 14 |
WfxPlugin, |
| 15 |
SysUtils; |
| 16 |
|
| 17 |
{$E wfx} |
| 18 |
{$R *.res} |
| 19 |
|
| 20 |
var |
| 21 |
gPluginNr: integer; |
| 22 |
gProgressProc: tProgressProc; |
| 23 |
gLogProc: tLogProc; |
| 24 |
gRequestProc: tRequestProc; |
| 25 |
|
| 26 |
function FsInit(PluginNr:integer;pProgressProc:tProgressProc;pLogProc:tLogProc; |
| 27 |
pRequestProc:tRequestProc):integer; dcpcall; |
| 28 |
begin |
| 29 |
gPluginNr:= PluginNr; |
| 30 |
gProgressProc:= pProgressProc; |
| 31 |
gLogProc:= pLogProc; |
| 32 |
gRequestProc:= pRequestProc; |
| 33 |
Result:= 0; |
| 34 |
end; |
| 35 |
|
| 36 |
function FsFindFirst(path :pchar;var FindData:tWIN32FINDDATA):thandle; dcpcall; |
| 37 |
begin |
| 38 |
FillChar(FindData, SizeOf(FindData), 0); |
| 39 |
FindData.dwFileAttributes :=0; //0 - обычный файл без каких-либо атрибутов |
| 40 |
StrPCopy(FindData.cFileName,'Hello, world.txt'); //имя файла |
| 41 |
Result:= 1985; //функция нормально отработала} |
| 42 |
end; |
| 43 |
|
| 44 |
function FsFindNext(Hdl:thandle;var FindData:tWIN32FINDDATA): BOOL; dcpcall; |
| 45 |
begin |
| 46 |
// gRequestProc(gPluginNr, RT_URL, nil, nil, nil, 0); |
| 47 |
Result:= False; |
| 48 |
end; |
| 49 |
|
| 50 |
function FsFindClose(Hdl:thandle):integer; dcpcall; |
| 51 |
begin |
| 52 |
Result:= 0; |
| 53 |
end; |
| 54 |
|
| 55 |
function FsRenMovFile(OldName,NewName:pchar;Move,OverWrite:bool; |
| 56 |
RemoteInfo:pRemoteInfo):integer; dcpcall; |
| 57 |
begin |
| 58 |
gRequestProc(gPluginNr, RT_MsgOK, OldName, NewName, nil, 0); |
| 59 |
Result:= FS_FILE_OK; |
| 60 |
end; |
| 61 |
|
| 62 |
function FsExecuteFile(MainWin:thandle;RemoteName,Verb:pchar):integer; dcpcall; |
| 63 |
begin |
| 64 |
gRequestProc(gPluginNr, RT_MsgOK, RemoteName, Verb, nil, 0); |
| 65 |
Result:= FS_EXEC_OK; |
| 66 |
end; |
| 67 |
|
| 68 |
exports |
| 69 |
// mandatory |
| 70 |
FsInit, |
| 71 |
FsFindFirst, |
| 72 |
FsFindNext, |
| 73 |
FsFindClose, |
| 74 |
// optional |
| 75 |
FsRenMovFile, |
| 76 |
FsExecuteFile; |
| 77 |
|
| 78 |
begin |
| 79 |
end. |