• Login
Community
  • Login

Getting encoding in x64 plugin

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
exceptionpluginencoding
3 Posts 2 Posters 2.1k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    morbac
    last edited by Oct 17, 2016, 8:27 PM

    Hi,

    I’m trying to get the current document encoding by using NPP message NPPM_GETBUFFERENCODING, but I cannot make it work. My code is following:

    int bufferid = ::SendMessage(nppData._nppHandle, NPPM_GETCURRENTBUFFERID, 0, 0);
    LRESULT res = ::SendMessage(nppData._nppHandle, NPPM_GETBUFFERENCODING, bufferid, 0);
    

    The code compiles well but on runtime, NPP crashes with following error, pointing on second line of above code (tested by running NPP and plugin in debug mode):

    Exception levée à 0x00007FF7929A6061 dans notepad++.exe : 0xC0000005 : Violation d’accès lors de la lecture de l’emplacement 0x000000003AC89F1C.
    Le programme ‘[2312] notepad++.exe’ s’est arrêté avec le code 0 (0x0).

    Did anyone already experienced and solved this ?
    Thanks

    1 Reply Last reply Reply Quote 1
    • D
      dail
      last edited by dail Oct 17, 2016, 8:50 PM Oct 17, 2016, 8:49 PM

      Try making bufferid an LRESULT instead of an int. It may be that it is getting downcasted (though you should get a compiler warning).

      M 1 Reply Last reply Oct 17, 2016, 9:05 PM Reply Quote 0
      • M
        morbac @dail
        last edited by Oct 17, 2016, 9:05 PM

        Hi @dail, thanks for your answer, it solved my issue :D

        1 Reply Last reply Reply Quote 0
        • G gstavi referenced this topic on Nov 27, 2023, 9:33 AM
        3 out of 3
        • First post
          3/3
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors