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.
    • morbacM
      morbac
      last edited by

      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
      • dailD
        dail
        last edited by dail

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

        morbacM 1 Reply Last reply Reply Quote 0
        • morbacM
          morbac @dail
          last edited by

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

          1 Reply Last reply Reply Quote 0
          • gstaviG gstavi referenced this topic on
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors