Community
    • Login

    Getting encoding in x64 plugin

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    exceptionpluginencoding
    3 Posts 2 Posters 2.6k Views 2 Watching
    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 Offline
      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 Offline
        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 Offline
          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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors