Quote from ruby on October 21, 2021, 7:23 pm1- How to add heading in the action list.
2- nbfiletostream function is not defined, how can I use it?
1- How to add heading in the action list.
2- nbfiletostream function is not defined, how can I use it?
Uploaded files:
Quote from HPW on October 21, 2021, 10:40 pmHello,
1: nbAddAction( 0, PChar('MyHeading'), '',[ACTIONPARAM_NONE], 0 );
2: Do you have PlugInUtils.pas in your uses section? There it is defined.
Regards
Hans-Peter
Hello,
1: nbAddAction( 0, PChar('MyHeading'), '',[ACTIONPARAM_NONE], 0 );
2: Do you have PlugInUtils.pas in your uses section? There it is defined.
Regards
Hans-Peter

Quote from AsleyCruz on October 22, 2021, 1:37 amHi,
This is the way how I do it:
nbAddAction( 0, 'Head title', '', [], 0 );
-
Question, guys:
If I use some dialog to select any file from the plugin, How can I save the selected file into the plugin using nbFileToStream? I don't find a way to make it work :/
I would like to access/read the selected file at runtime. Hope it can be possible, thanks.
Hi,
This is the way how I do it:
nbAddAction( 0, 'Head title', '', [], 0 );
-
Question, guys:
If I use some dialog to select any file from the plugin, How can I save the selected file into the plugin using nbFileToStream? I don't find a way to make it work :/
I would like to access/read the selected file at runtime. Hope it can be possible, thanks.

Quote from HPW on October 22, 2021, 7:04 amHello,
nbFileToStream is not made for accessing files in a plugin. It is for reading files from the embedded files of VNW into plugins/VNW memory from a plugin. When you want to save data into your plugin, I think a way would be to save them into the reources and extract it from there. But just a thought and untested. Another option is the baggage feature of the plugin-interface. There you add a file to the plugin-dll and it is unpacked on plugin load. You can also think about a zip to pack your files and deliver it with your plugin.
Regards
Hans-Peter
Hello,
nbFileToStream is not made for accessing files in a plugin. It is for reading files from the embedded files of VNW into plugins/VNW memory from a plugin. When you want to save data into your plugin, I think a way would be to save them into the reources and extract it from there. But just a thought and untested. Another option is the baggage feature of the plugin-interface. There you add a file to the plugin-dll and it is unpacked on plugin load. You can also think about a zip to pack your files and deliver it with your plugin.
Regards
Hans-Peter

Quote from AsleyCruz on October 22, 2021, 9:29 amHi, @hpw
Thanks a lot for clarifying me about nbFileToStream (I didn't know...) and the ideas.
So if I have embedded a small image " [Embedded]MyImage.jpg ", how can I read this image and use it in a TImage? Or maybe you have a couple of code lines to make it work (Hoping it is not too difficult). Thanks, thanks for your time.
Hi, @hpw
Thanks a lot for clarifying me about nbFileToStream (I didn't know...) and the ideas.
So if I have embedded a small image " [Embedded]MyImage.jpg ", how can I read this image and use it in a TImage? Or maybe you have a couple of code lines to make it work (Hoping it is not too difficult). Thanks, thanks for your time.

Quote from HPW on October 22, 2021, 12:04 pmHello,
From the SDK CHM help file for nbFileToSTream:
FUNCTION StreamFileToMemo( CONST FileName : STRING ) : BOOLEAN; VAR Stream : IStream; Ole : TOleStream; BEGIN Result := FALSE; IF Assigned( nbFileToStream ) THEN BEGIN IF nbFileToStream( PChar( FileName ), Stream ) THEN TRY Ole := TOleStream.Create( Stream ); TRY { Load the file from the stream into a memo... } Memo1.Lines.LoadFromStream( Ole ); FINALLY Ole.Free; END; FINALLY { Release the IStream... } Stream := NIL; END ELSE ShowMessage( 'File not found.' ); END ELSE ShowMessage( 'This feature requires NeoBook 5.0.0 or higher.' ); END;Your have to read the delphi-Method for LoadFromStream for TImage of cource.
Regards
Hans-Peter
Hello,
From the SDK CHM help file for nbFileToSTream:
FUNCTION StreamFileToMemo( CONST FileName : STRING ) : BOOLEAN;
VAR Stream : IStream;
Ole : TOleStream;
BEGIN
Result := FALSE;
IF Assigned( nbFileToStream ) THEN
BEGIN
IF nbFileToStream( PChar( FileName ), Stream ) THEN
TRY
Ole := TOleStream.Create( Stream );
TRY
{ Load the file from the stream into a memo... }
Memo1.Lines.LoadFromStream( Ole );
FINALLY
Ole.Free;
END;
FINALLY
{ Release the IStream... }
Stream := NIL;
END
ELSE ShowMessage( 'File not found.' );
END
ELSE ShowMessage( 'This feature requires NeoBook 5.0.0 or higher.' );
END;
Your have to read the delphi-Method for LoadFromStream for TImage of cource.
Regards
Hans-Peter

Quote from AsleyCruz on October 22, 2021, 3:24 pmHi, @hpw
I already know this function is in the help but is not defined in the SDK (or samples) (as you can read in first @ruby post), so I tried before your reply and it didn't never work (internal error when playing an action).
Many thanks.
Hi, @hpw
I already know this function is in the help but is not defined in the SDK (or samples) (as you can read in first @ruby post), so I tried before your reply and it didn't never work (internal error when playing an action).
Many thanks.

Quote from HPW on October 22, 2021, 3:41 pmHello,
As writen in my first post you have to link the PlugInUtils.pas.
But I see that there are different version in the SDK sub folders.
Take the one from ...\PlugIn SDK\Delphi Examples\SpinEdit Example\
There you have this vars:
VAR
nbGetVar : TVarGetProc;
nbSetVar : TVarSetProc;
nbPlayAction : TPlayActionProc;
nbInterface : TInterfaceProc;
nbFileToStream : TStreamProc;
nbAddFile : TAddFileProc;
nbAddAction : TAddActionProc;
nbWinHandle : HWND;Regards
Hans-Peter
Hello,
As writen in my first post you have to link the PlugInUtils.pas.
But I see that there are different version in the SDK sub folders.
Take the one from ...\PlugIn SDK\Delphi Examples\SpinEdit Example\
There you have this vars:
VAR
nbGetVar : TVarGetProc;
nbSetVar : TVarSetProc;
nbPlayAction : TPlayActionProc;
nbInterface : TInterfaceProc;
nbFileToStream : TStreamProc;
nbAddFile : TAddFileProc;
nbAddAction : TAddActionProc;
nbWinHandle : HWND;
Regards
Hans-Peter

Quote from AsleyCruz on October 22, 2021, 5:14 pm@hpw
Yes, that is ok, but the problem that occurred was on the procedure nbRegisterPlugIn at runtime. Thanks, I will try another way.
Yes, that is ok, but the problem that occurred was on the procedure nbRegisterPlugIn at runtime. Thanks, I will try another way.

Quote from HPW on October 22, 2021, 7:20 pmHello,
You have to debug your nbRegisterPlugIn function step by step to catch the error.
Regards
Hans-Peter
Hello,
You have to debug your nbRegisterPlugIn function step by step to catch the error.
Regards
Hans-Peter