plug-in sample in Pascal

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
gpujol
Junior Member
Junior Member
Posts: 16
Joined: 2003-05-10, 22:44 UTC

plug-in sample in Pascal

Post by *gpujol »

Does anybody know of a sample lister plug-in writen in Pascal?

TIA,

George Pujol
User avatar
fabiochelly
Power Member
Power Member
Posts: 603
Joined: 2003-02-05, 12:03 UTC
Location: Rambouillet, France

Post by *fabiochelly »

You can get the sources from my HTTP Browser plugin in Total Commander addons page
Fabio Chelly.
#60241
Lorsqu'on s'occupe d'informatique il faut faire comme les canards...
Paraître calme en surface et pédaler comme un forcené par en dessous
User avatar
André Martin
Senior Member
Senior Member
Posts: 245
Joined: 2003-02-05, 15:46 UTC
Location: Dresden, Germany

Post by *André Martin »

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.
Browse the web with the HTTP SmartBrowserPlugin
Check your mails with the POP3/SMTP EmailPlugin!
gpujol
Junior Member
Junior Member
Posts: 16
Joined: 2003-05-10, 22:44 UTC

Post by *gpujol »

Fabio,

Thanks a lot for the pointer, I got it and will see how to adapt it. And I loved the quote !!!

Regards,

George

=========================

Andre,

That would be great, there is no sample in Pascal for a Lister plug-in, please let me know if you can make the time.

Take care,

George
User avatar
SCHMaster
Member
Member
Posts: 199
Joined: 2003-02-08, 00:39 UTC
Location: Ukraine
Contact:

Post by *SCHMaster »

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 ... :D 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.
gpujol
Junior Member
Junior Member
Posts: 16
Joined: 2003-05-10, 22:44 UTC

Post by *gpujol »

Great !!!

That code helps a lot, SCHMaster (I don't know your name :lol: ), thank you very much !!!

Regards,

George Pujol
User avatar
fabiochelly
Power Member
Power Member
Posts: 603
Joined: 2003-02-05, 12:03 UTC
Location: Rambouillet, France

Post by *fabiochelly »

gpujol wrote:And I loved the quote !!!
I don't understand what you mean
Fabio Chelly.
#60241
Lorsqu'on s'occupe d'informatique il faut faire comme les canards...
Paraître calme en surface et pédaler comme un forcené par en dessous
gpujol
Junior Member
Junior Member
Posts: 16
Joined: 2003-05-10, 22:44 UTC

Post by *gpujol »

Fabio,

This one:

"Lorsqu'on s'occupe d'informatique il faut faire comme les canards...
Paraître calme en surface et pédaler comme un forcené par en dessous"

George
User avatar
JohnFredC
Power Member
Power Member
Posts: 886
Joined: 2003-03-14, 13:37 UTC
Location: Sarasota Florida

Post by *JohnFredC »

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:
MyViewer:=TMyViewer.Create(Application);//in Uses - "Forms", but plugin file size ... or
MyViewer:=TMyViewer.Create(nil);
So, if I have a main form for my viewer then I should use:
MyViewer:=TMyViewer.Create(Application);
Is that right? By creating the Application and mapping my form's parent property to the TC HWND in
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
User avatar
SCHMaster
Member
Member
Posts: 199
Joined: 2003-02-08, 00:39 UTC
Location: Ukraine
Contact:

Post by *SCHMaster »

2JohnFredC
Is that right? By creating the Application and mapping my form's parent property to the TC HWND in
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 incorrect
My form will have an ActiveX control on it. Is there any reason that shouldn't work?
Excuse me, but here I you nothing not to help - I try not to use visual ActiveX classes (do not love I their :) )
User avatar
Valentino
Power Member
Power Member
Posts: 706
Joined: 2003-02-07, 00:21 UTC
Location: Ukraine

Post by *Valentino »

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
And how it's in English? :)
shinca
Junior Member
Junior Member
Posts: 10
Joined: 2003-02-07, 08:36 UTC
Location: Slovenia

Post by *shinca »

Valentino wrote:
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
And how it's in English? :)
Wanted to know the same, so I tried Babelfish: http://babelfish.altavista.com/babelfish/tr
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
User avatar
fabiochelly
Power Member
Power Member
Posts: 603
Joined: 2003-02-05, 12:03 UTC
Location: Rambouillet, France

Post by *fabiochelly »

And how it's in English?
When dealing with computers, one has to act like ducks...
Keep cool on surface and paddle like crazy under the water
Fabio Chelly.
#60241
Lorsqu'on s'occupe d'informatique il faut faire comme les canards...
Paraître calme en surface et pédaler comme un forcené par en dessous
User avatar
Valentino
Power Member
Power Member
Posts: 706
Joined: 2003-02-07, 00:21 UTC
Location: Ukraine

Post by *Valentino »

Thanks! :D
Post Reply