• Notepad++, Scintilla, SendMessages and Delphi

    5
    0 Votes
    5 Posts
    2k Views
    PeterJonesP

    @Sun-Bright said in Notepad++, Scintilla, SendMessages and Delphi:

    But it seems that this will be impossible, because from the address space of my program, the scintilla will not be able to get data in the address space of npp.

    You can actually send strings back and forth, even from another process. I’m starting to do it in my developing perl-driving-npp module. I don’t know how to do it in delphi, but the commands involved are VirtualAllocEx, WriteProcessMemory, ReadProcessMemory, and VirtualFreeEx. (Oh, I misinterpreted @Ekopalypse’s response; he was saying the same thing. But now I’ve linked to the official win32 api for you. :-) )

    They may be called something else in Delphi. (For example, in the perl wrapper Win32::GuiTest I am using for issuing the SendMessage to NPP, they call those AllocateVirtualBuffer, WriteToVirtualBuffer, ReadFromVirtualBuffer, and FreeVirtualBuffer.

    For commands that want to get or send a single string, like NPPM_DOOPEN for sending a string via LPARAM, or NPPM_GETFULLPATHFROMBUFFERID for reading a string via LPARAM, I use the following sequences successfully.

    # $obj->SendMessage_getUcs2le( $message_id, $wparam ): # issues a SendMessage, and grabs a string up to 1024 bytes, and # converts them from UCS-2 LE into up to 512 perl characters # (includes the memory allocation necessary for cross-application communication) # RETURN: the Perl string sub SendMessage_getUcs2le { my $self = shift; croak "no object sent" unless defined $self; my $msgid = shift; croak "no message id sent" unless defined $msgid; my $wparam = shift || 0; my $buf_uc2le = Win32::GuiTest::AllocateVirtualBuffer( $self->hwnd, 1024 ); # 1024 byte string maximum Win32::GuiTest::WriteToVirtualBuffer( $buf_uc2le, "\0"x1024 ); # pre-populate my $rslt = $self->SendMessage( $msgid, $wparam, $buf_uc2le->{ptr}); #diag "SendMessage_getStr(@{[$self->hwnd]}, $msgid, $wparam, @{[explain $buf_uc2le]} ) = $rslt"; my $rbuf = Win32::GuiTest::ReadFromVirtualBuffer( $buf_uc2le, 1024 ); Win32::GuiTest::FreeVirtualBuffer( $buf_uc2le ); return substr Encode::decode('ucs2-le', $rbuf), 0, $rslt; # return the valid characters from the raw string } # $obj->SendMessage_sendStrAsUcs2le( $message_id, $wparam , $lparam_string ): # issues a SendMessage, sending a string (encoded as UCS-2 LE) sub SendMessage_sendStrAsUcs2le { my $self = shift; croak "no object sent" unless defined $self; my $msgid = shift; croak "no message id sent" unless defined $msgid; my $wparam = shift; croak "no wparam sent" unless defined $wparam; my $lparam_string = shift; croak "no lparam string sent" unless defined $lparam_string; # convert string to UCS-2 LE my $ucs2le = Encode::encode('ucs2-le', $lparam_string); # copy string into virtual buffer my $buf_str = Win32::GuiTest::AllocateVirtualBuffer( $self->hwnd, length($ucs2le) ); Win32::GuiTest::WriteToVirtualBuffer( $buf_str, $ucs2le ); # send the message with the string ptr as the lparam my $rslt = Win32::GuiTest::SendMessage($self->hwnd, $msgid, $wparam, $buf_str->{ptr}); # clear virtual buffer Win32::GuiTest::FreeVirtualBuffer( $buf_str ); # return return $rslt; }

    (And yes, I successfully use those same sequences for talking with the NPP hwnd and the Scintilla hwnds.)

    Similar sequences, but using Delphi syntax and function names, should work for those commands.

    I’m actually still working on getting the more complicated messages (which want WPARAM as a TCHAR** rather than just a TCHAR*), but the above wrappers work for all the single-string LPARAM messages.

  • Render FF/FormFeed/#12 as a Separator line

    9
    0 Votes
    9 Posts
    1k Views
    Alan KilbornA

    Seems like this would have to be something Scintilla needs to support before Notepad++ could even think about supporting it. So I think the best answer to the original question is “No”.

  • How to compile and sign Notepad++ ?

    4
    0 Votes
    4 Posts
    735 Views
    pnedevP

    @Alan-Kilborn ,

    As @Ekopalypse said the bigger part of the thread is lost during the transition to the new site.

    To make the long story short, I wanted to play a bit with the NUL-ified file contents on sudden reboot / power loss.
    There was no need for signing and I couldn’t build it on my own because I don’t have recent Visual Studio but I used the automatic integration (AppVeyor) to help with that.

    I made this PR (https://github.com/notepad-plus-plus/notepad-plus-plus/pull/6164) which hopefully fixes the issue.
    I don’t think much more can be done without further complications. Just to note that config and session files are still prone to the NUL problem because I didn’t want to introduce changes to TinyXML lib code at this point.

    If this PR gets merged only time will tell if the issue if fixed. If it doesn’t appear again a new patch can be made that uses the same Win32 file API to save also the configs and session files (making their saving safer as well).
    I would also use that same API to load files removing totally C run-time APIs but let’s make things one step at a time. Otherwise changes will be difficult to review and to get merged.

    This topic can be closed / locked.

  • Function list new language parser

    4
    0 Votes
    4 Posts
    774 Views
    IBIT_ZEEI

    Thanks @MAPJe71

    it was the “userDefinedLangName”
    was set to “XXX-…” and should be “xxx-…”
    to exactly match the name of the language
    in the Language menu… (it is case sensitive…)

  • How do I get NP++ to enter characters via hex codes?

    3
    0 Votes
    3 Posts
    1k Views
    ZombieEnderman5Z

    Hmm. Looks like it ought to work, thank you.

  • ARRAY for note pad ++ PLEASE HELP!!

    5
    0 Votes
    5 Posts
    2k Views
    T- BONE TUBET

    lol im willing you to give u my email??? u cant help me out at all??? ill pay you too

  • 0 Votes
    6 Posts
    1k Views
    Alan KilbornA

    @Tyler-Naddy

    So, sadly, the site migration lost a reply I made to this earlier. Luckily I still had the text of most of it in an N++ tab! :)

    Here’s the earlier reply again:

    We can accomplish this by borrowing from the info found here.

    As an example, say you want to skip 3 lines at the top of file, then replace then next 5 lines with something else. Note: Another way to say it is to replace line numbers 4 through 8.

    Use this regular expression search expression to match the lines: (?-s)(?<!\x0A)^(?:.*\R){3}\K(?:.*\R){5} and do a Replace-All with whatever you’d like (replace with nothing to delete those lines).

    Note that you have to do a Replace-All and not a simple Replace due to the \K syntax used. For the details of why this works, see the earlier referenced link.

  • Can't login with my google account

    15
    0 Votes
    15 Posts
    2k Views
    PeterJonesP

    @Alan-Kilborn said in Can't login with my google account:

    Don rarely listens here…Peter, do you have his ear?

    Unfortunately, his email ISP thinks my email ISP is a spam-site, so blocks my emails.

    However, since he’s more likely to check his announcement-threads, I replied over there pointing to here.

  • User-defined language not styling function parameters

    5
    1 Votes
    5 Posts
    929 Views
    PeterJonesP

    @Ekopalypse said :

    I guess you need to do exactly the opposite and using a delimiter.

    Or, use operators 1 for the parens.

    Basically, if parens aren’t defined as anything, then only the rules for byte are applied, and the keyword rules (unless the prefix checkbox is marked) say that the keyword doesn’t count if it’s touching anything. However, once you put the ( ) in the operators 1, that defines the parens as operators which are allowed to touch anything.(*)

    If you do use the delimiter # rather than operators 1, you will have to enable nesting for the various keyword # in the delimiter # > styler dialog. [edit: I see @Ekopalypse already mentioned that; didn’t see it on my first read]

    *: operators 1 don’t require whitespace to be recognized; operators 2 do require whitespace to be recognized. (This is in https://github.com/notepad-plus-plus/npp-usermanual/blob/master/content/docs/user-defined-language-system.md , and will propagate to https://npp-user-manual.org/docs/user-defined-language-system/ at the next document release.)

  • 10.000 Nulls instead of code :o !...

    3
    0 Votes
    3 Posts
    471 Views
    pnedevP

    You can try using Recuva to restore your data as described here:
    https://superuser.com/questions/377904/recover-file-corrupted-due-to-power-cut-off

  • Looking for a simple color picker plugin

    21
    -1 Votes
    21 Posts
    11k Views
    Steven HaymesS

    @G said:

    Thanks, very constructive. Might as well not say anything.

    Yup!

    Yes I should have make backups on 2 drives, BUT, I had sane files with no reasons to ever get corrupted, or almost, because Npp managed to do it.

    I always backup everything. I learned that lesson a long time ago, back in Windows NT days.

    Anyway, I’m done with Npp. Sad because I used it daily for years.

    Have you thought about using Vim instead? I have used it for daily for years too. I still use it.

    Have a good night guys, thanks for those trying to actually help. Bye.

    Bye too…

  • clicking on hits in search results not opening a file

    8
    0 Votes
    8 Posts
    1k Views
    Joe BonnerJ

    I am pretty sure I have worked out that it is the length. It worked to find some stuff but wasn’t find everything in the string. in the search window there is the string and it changes colour for my view (I cant work out how to post a pic here so am using bold=blue italics=green)

    fight_N|figure_N|firefighter_N

    Thanks for your help, I am now just manually going threw all my strings and cutting them down. Pretty sure that it is only when they are too long that I had any problems opening files.

    Cheers!

  • How to go to 'bookmark' ?

    4
    0 Votes
    4 Posts
    735 Views
    EkopalypseE

    @Ak-M

    you can use software like this to see
    the registered global hotkeys.

  • Automatic Data logging

    4
    0 Votes
    4 Posts
    614 Views
    Brent SimpsonB

    Duh! Apologies! Putty is doing the logging…

    It’s an age thing…

  • How to change line distances/spacings?

    Locked
    4
    0 Votes
    4 Posts
    4k Views
    dinkumoilD

    @Gábor-László-Horváth

    I wrote a plugin that can be used to configure an extra spacing above and beneath lines. Its name is ExtSettings. You can download it >>> here <<<. It will also be available soon via PluginsAdmin.

  • Increase Whitespace Size macro issue

    9
    1 Votes
    9 Posts
    1k Views
    dinkumoilD

    @Steve-Messer

    I wrote a plugin that can be used to configure the size of white space indicators. Its name is ExtSettings. You can download it >>> here <<<. It will also be available soon via PluginsAdmin.

  • Join columns of different files using notepad

    13
    0 Votes
    13 Posts
    1k Views
    rinku singhR

    @sakijhon said:

    125:fzpYeX

    now raplace 125: with 125:/r/n

    if you are use 64bit npp use big files plugin

  • Print Margins only in "MM".

    5
    0 Votes
    5 Posts
    958 Views
    PeterJonesP

    @HiJinks said:

    I installed (updated previous version) the 64 bit Zip version (7.1.1) on Windows 10 Home and when I went to reset my Preferences, it did not allow to set the print margins in inches

    This isn’t exactly new behavior. I just checked back in Notepad++ v6.0 from 2012, and then checked v4.0 from 2007, and it was still exclusively in millimeters in both of those ancient versions. It wasn’t your upgrade which changed something for you. It was just never in inches.

    BTW, 0.25" margins are 6mm, not 0.6mm. For an approximate conversion from inch to mm, just multiply inches by 25 to get approximate millimeters. (It’s really 25.4mm/in, but that extra .4 doesn’t matter much: 1.5%).

  • MRU Auto-delete

    2
    0 Votes
    2 Posts
    414 Views
    PeterJonesP

    @David-Pither-Patterson said:

    When that happens, you lose the link

    You might want to enable Settings > Preferences > Recent Files History > ☑ Don’t check at launch time, which should at least prevent them from disappearing from the MRU when you first launch Notepad++.

    I’m not sure that option will be sufficient to save you if you click the MRU before the network drive has connected… but really, you’re asking a program to open a file that does not exist (from the perspective of your whole computer, not just the app). If I were in that situation, and often found myself in a race with the network remap, I would probably make a folder-shortcut to the network drive, and always open that after re-starting; once the folder was open, I would then open the file-under-consideration from the explorer window, rather than from the Notepad++ MRU, because by then, the drive is mapped.

  • Problems with ANSI Characters « and » 0x0171 and 0x187

    2
    0 Votes
    2 Posts
    428 Views
    EkopalypseE

    @Sebastian-Koerner

    I can’t see your reported issue concerning the broken characters

    Regarding the extra char, this happens when you chose Encode in Ansi, which basically is a view of the current bytes and because those chars are encoded in two
    bytes in utf8 you see the additional first byte. If you choose convert to ansi, from a clean state, it shows it correctly.