Skip to content

Commit 4dc9329

Browse files
authored
Add the Array of Path Strings section, and refererences to it
1 parent e2f0581 commit 4dc9329

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

content/docs/plugin-communication.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ receives the full path names of all the opened files in Notepad++
13721372

13731373
*lParam [in]*
13741374
: int nbFile,
1375-
is the size of the fileNames array. Get this value by using NPPM_GETNBOPENFILES message with constant ALL_OPEN_FILES, then allocate fileNames array with this value.
1375+
is the size of the fileNames array. Get this value by using NPPM_GETNBOPENFILES message with constant ALL_OPEN_FILES, then allocate fileNames array with this value (noting the size requirements for an [Array of Path Strings](#array-of-path-strings)).
13761376

13771377
**Return value**:
13781378
: Returns The number of files copied into fileNames array.
@@ -1391,7 +1391,7 @@ receives the full path names of the opened files in the primary view
13911391

13921392
*lParam [in]*
13931393
: int nbFile,
1394-
is the size of the fileNames array. Get this value by using NPPM_GETNBOPENFILES message with constant PRIMARY_VIEW, then allocate fileNames array with this value.
1394+
is the size of the fileNames array. Get this value by using NPPM_GETNBOPENFILES message with constant PRIMARY_VIEW, then allocate fileNames array with this value (noting the size requirements for an [Array of Path Strings](#array-of-path-strings)).
13951395

13961396

13971397
**Return value**:
@@ -1411,7 +1411,7 @@ receives the full path names of the opened files in the second view
14111411

14121412
*lParam [in]*
14131413
: int nbFile,
1414-
is the size of your fileNames array. You should get this value by using NPPM_GETNBOPENFILES message with constant SECOND_VIEW, then allocate fileNames array with this value.
1414+
is the size of your fileNames array. You should get this value by using NPPM_GETNBOPENFILES message with constant SECOND_VIEW, then allocate fileNames array with this value (noting the size requirements for an [Array of Path Strings](#array-of-path-strings)).
14151415

14161416
**Return value**:
14171417
: Returns The number of files copied into fileNames array.
@@ -1503,7 +1503,7 @@ the path for cloud settings obtained by this message
15031503
*wParam [out]*
15041504
: wchar_t ** sessionFileArray,
15051505
the array in which the files' full path of the same group are written.
1506-
To allocate the array with the proper size, send message NPPM_GETNBSESSIONFILES.
1506+
To allocate the array with the proper size, use the message NPPM_GETNBSESSIONFILES to get the number of strings needed, then allocate each path entry string (noting the size requirements for an [Array of Path Strings](#array-of-path-strings)).
15071507

15081508
*lParam [in]*
15091509
: const wchar_t * sessionFileName,
@@ -2728,3 +2728,13 @@ The BufferID received by a notification is not necessarily the _active_ buffer.
27282728
docIndex = value & 0x3FFFFFFF
27292729
NPPM_ACTIVATEDOC(view, docIndex)
27302730
```
2731+
2732+
### Array of Path Strings
2733+
2734+
Some of the messages have a `wchar_t **` type, which is an array of wide-character strings.
2735+
All such messages require you to pre-allocate the array, with enough strings, and enough
2736+
_wide_ characters (2 bytes each) for each string. Since these messages are dealing with paths,
2737+
you should allocate enough per string for [`MAX_PATH`](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file "MS Learn: MAX_PATH")
2738+
_wide characters_: if your programming interface allocates strings based on number of bytes,
2739+
then you will need to allocate `2*MAX_PATH` for the number of bytes, to be able to hold
2740+
`MAX_PATH` wide characters.

0 commit comments

Comments
 (0)