plug-in sample in Pascal
Moderators: Hacker, petermad, Stefan2, white
plug-in sample in Pascal
Does anybody know of a sample lister plug-in writen in Pascal?
TIA,
George Pujol
TIA,
George Pujol
- fabiochelly
- Power Member
- Posts: 603
- Joined: 2003-02-05, 12:03 UTC
- Location: Rambouillet, France
- André Martin
- Senior Member
- Posts: 245
- Joined: 2003-02-05, 15:46 UTC
- Location: Dresden, Germany
2gpujol
Currently there is only a sample lister plug-in written in cpp available (afaik).
I planed to "translate/convert" the sample plugin from cpp code to pascal but have not had the time yet to do this
But you can have a look at Fabio's wfx sample in order to see how to export functions etc.
Currently there is only a sample lister plug-in written in cpp available (afaik).
I planed to "translate/convert" the sample plugin from cpp code to pascal but have not had the time yet to do this

But you can have a look at Fabio's wfx sample in order to see how to export functions etc.
Browse the web with the HTTP SmartBrowserPlugin
Check your mails with the POP3/SMTP EmailPlugin!
Check your mails with the POP3/SMTP EmailPlugin!
library SomeListerPlugin;
uses
Windows,
...
...
//See help for write lister plugin
const
...
{$E .wlx}
type
...
//See help for write lister plugin
{Your custom editor-viewer}
TMyViewer = class(TEdit)
private
...
public
...
end;
type
PData = ^TData;
TData = record
var
HMap: THandle = 0;
Data: PData = nil;
procedure DLLEntryPoint(dwReason: DWORD);
begin
case dwReason of
DLL_PROCESS_ATTACH:
begin
HMap := CreateFileMapping($FFFFFFFF, nil, PAGE_READWRITE, 0, SizeOf(TData), MapID);
Data := MapViewOfFile(HMap, FILE_MAP_ALL_ACCESS, 0, 0, SizeOf(TData))
end;
DLL_PROCESS_DETACH:
begin
UnMapViewOfFile(Data);
CloseHandle(HMap);
end
end
end;
function ListLoad(ParentWin: HWND; FileToLoad: pchar; ShowFlags: integer): HWND; stdcall;
var
MyViewer:TMyViewer;
begin
result:=0;
if UpperCase('*'+ExtractFileExt(FileToLoad)) <> '*.TXT' then exit;
MyViewer:=TMyViewer.Create(Application);//in Uses - "Forms", but plugin file size ...
or
MyViewer:=TMyViewer.Create(nil);
MyViewer.Name:='ED'+IntToStr(ParentWin);
MyViewer.parentwindow:=ParentWin;
MyViewer.Lines.LoadFromFile(FileToLoad);
Result:=MyViewer.Handle;
end;
function ListSendCommand(ListWin: HWND; Command: integer; Parameter: integer): integer; stdcall;
var
ED:MyViewer;
begin
//if "Forms" in uses then
Ed:=TMyViewer(Application.FindComponent('ED'+IntToStr(GetParent(ListWin))));
if Ed <> nil then
begin
...
end;
//Or without "Forms" in uses
SendMessage(ListWin,param1,param2);
end;
...
Similarly all rest functions and procedures
...
exports
ListLoad,
ListCloseWindow,
ListNotificationReceived,
ListSearchText,
ListPrint,
ListSendCommand;
begin
if DLLProc = nil then
DLLProc := @DLLEntryPoint;
DLLEntryPoint(DLL_PROCESS_ATTACH);
end.
uses
Windows,
...
...
//See help for write lister plugin
const
...
{$E .wlx}
type
...
//See help for write lister plugin
{Your custom editor-viewer}
TMyViewer = class(TEdit)
private
...
public
...
end;
type
PData = ^TData;
TData = record
var
HMap: THandle = 0;
Data: PData = nil;
procedure DLLEntryPoint(dwReason: DWORD);
begin
case dwReason of
DLL_PROCESS_ATTACH:
begin
HMap := CreateFileMapping($FFFFFFFF, nil, PAGE_READWRITE, 0, SizeOf(TData), MapID);
Data := MapViewOfFile(HMap, FILE_MAP_ALL_ACCESS, 0, 0, SizeOf(TData))
end;
DLL_PROCESS_DETACH:
begin
UnMapViewOfFile(Data);
CloseHandle(HMap);
end
end
end;
function ListLoad(ParentWin: HWND; FileToLoad: pchar; ShowFlags: integer): HWND; stdcall;
var
MyViewer:TMyViewer;
begin
result:=0;
if UpperCase('*'+ExtractFileExt(FileToLoad)) <> '*.TXT' then exit;
MyViewer:=TMyViewer.Create(Application);//in Uses - "Forms", but plugin file size ...

MyViewer:=TMyViewer.Create(nil);
MyViewer.Name:='ED'+IntToStr(ParentWin);
MyViewer.parentwindow:=ParentWin;
MyViewer.Lines.LoadFromFile(FileToLoad);
Result:=MyViewer.Handle;
end;
function ListSendCommand(ListWin: HWND; Command: integer; Parameter: integer): integer; stdcall;
var
ED:MyViewer;
begin
//if "Forms" in uses then
Ed:=TMyViewer(Application.FindComponent('ED'+IntToStr(GetParent(ListWin))));
if Ed <> nil then
begin
...
end;
//Or without "Forms" in uses
SendMessage(ListWin,param1,param2);
end;
...
Similarly all rest functions and procedures
...
exports
ListLoad,
ListCloseWindow,
ListNotificationReceived,
ListSearchText,
ListPrint,
ListSendCommand;
begin
if DLLProc = nil then
DLLProc := @DLLEntryPoint;
DLLEntryPoint(DLL_PROCESS_ATTACH);
end.
- fabiochelly
- Power Member
- Posts: 603
- Joined: 2003-02-05, 12:03 UTC
- Location: Rambouillet, France
Hi SCHMaster
Thanks for your code. I have started a little viewer in Delphi and have been successful in getting it to initialize cleanly and recognize the proper extension in wincmd.ini. However, I haven't been able to get it to display a form in TC.
You wrote:
... then my form should appear in the QuickView panel?
My form will have an ActiveX control on it. Is there any reason that shouldn't work?
TIA
Thanks for your code. I have started a little viewer in Delphi and have been successful in getting it to initialize cleanly and recognize the proper extension in wincmd.ini. However, I haven't been able to get it to display a form in TC.
You wrote:
So, if I have a main form for my viewer then I should use:MyViewer:=TMyViewer.Create(Application);//in Uses - "Forms", but plugin file size ... or
MyViewer:=TMyViewer.Create(nil);
Is that right? By creating the Application and mapping my form's parent property to the TC HWND inMyViewer:=TMyViewer.Create(Application);
MyViewer.ParentWindow:=ParentWin;
... then my form should appear in the QuickView panel?
My form will have an ActiveX control on it. Is there any reason that shouldn't work?
TIA
Licensed, Mouse-Centric, moving (slowly) toward Touch-centric
2JohnFredC
)
Hmm ... In any event you should install the parent window of the your window. Then (IMO) in any event will it is correct. But here else depends on used by you class of the component. In some cases MyViewer:=TMyViewer.Create(nil); will be incorrectIs that right? By creating the Application and mapping my form's parent property to the TC HWND in
Excuse me, but here I you nothing not to help - I try not to use visual ActiveX classes (do not love I theirMy form will have an ActiveX control on it. Is there any reason that shouldn't work?

Wanted to know the same, so I tried Babelfish: http://babelfish.altavista.com/babelfish/trValentino wrote:And how it's in English?gpujol wrote:Fabio,
This one:
"Lorsqu'on s'occupe d'informatique il faut faire comme les canards...
Paraitre calme en surface et pedaler comme un forcene par en dessous"
George
Babelfish translation:
When one deals with data processing it is necessary to make like ducks... To appear calm surface some and to pedal like exaggerated by below
It's a funny translation, but you can see, what the quote means...

have fun,
shinca
- fabiochelly
- Power Member
- Posts: 603
- Joined: 2003-02-05, 12:03 UTC
- Location: Rambouillet, France