Re: Problems using AddClipboardFormatListener, RemoveClipboardFormatListener and WM_CLIPBOARDUPDATE

Zerro <[email protected]> Tue, 26 Nov 2024 11:14:35 +0100
Newsgroups gmane.comp.gnu.mingw.user
Organization Cebuned
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============4575508882218500849==
Content-Type: multipart/alternative;
 boundary="------------ZLYG155gulUyw0WLDYguZQNB"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------ZLYG155gulUyw0WLDYguZQNB
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hello Test,

The last maintainer in the project Keith Marshall left the project more 
than 5 years ago.
So there are no more updates to be expected.
It is so to say 'orphaned'.

Regards, Zerro

On 11/26/24 10:23 AM, Test User wrote:
> Hello Zerro,
>
> What do you mean by 'orphaned'?
>
> Regards,
> Test.
>
> On Mon, Nov 25, 2024, 3:00 PM Zerro <[email protected]> wrote:
>
>     Hi Paul,
>
>     The MinGW project has been orphaned already for some time.
>
>     Maybe you could try the MinGW-w64 project, which does seem to be
>     maintained well.
>
>     Regards, ~Z
>
>     On 11/25/24 7:24 PM, Paul Dewhirst wrote:
>     > I've written a simple program which reports data placed on the
>     clipboard.
>     > It uses AddClipboardFormatListener,
>     RemoveClipboardFormatListener and
>     > WM_CLIPBOARDUPDATE.
>     > It compiles OK with the Microsoft C/C++ compiler, but fails to
>     compile with gcc.
>     >
>     > The first problem is "error: 'WM_CLIPBOARDUPDATE' undeclared". 
>     So I added
>     > "#define WM_CLIPBOARDUPDATE 0x031D" to the program.  Now it
>     fails to link with
>     > "undefined reference to `AddClipboardFormatListener'" and "undefined
>     > reference to
>     > `RemoveClipboardFormatListener'".
>     >
>     > The winuser.h and libuser32.a in my installation of gcc do not
>     contain
>     > these items.
>     > Perhaps if I download the latest win32api it will have files
>     which do
>     > contain these items.
>     > I downloaded w32api-5.3.4-mingw32-dev.tar.xz and extracted winuser.h
>     > and libuser32.a,
>     > but these don't contain the items either.
>     >
>     > So I produced my own header and library file to include these items.
>     > I used the details for OpenClipboard as a guide because this has the
>     > same parameter
>     > and result profile.
>     >
>     > File listener.h:
>     > #define WM_CLIPBOARDUPDATE 0x031D
>     > WINUSERAPI BOOL WINAPI AddClipboardFormatListener (HWND);
>     > WINUSERAPI BOOL WINAPI RemoveClipboardFormatListener (HWND);
>     >
>     > File listener.def:
>     > LIBRARY user32.dll
>     > EXPORTS
>     > AddClipboardFormatListener@4
>     > RemoveClipboardFormatListener@4
>     >
>     > Then run dlltool:
>     > dlltool -d listener.def -l libextra.a
>     >
>     > Then compile using these files:
>     > gcc -g -o c:\bin\clip_view.exe clip_view.c -L. –lextra
>     >
>     > This compiles and links but it fails when run with "The
>     procedure entry point
>     > AddClipboardFormatListener@4 could not be located in the dynamic
>     link
>     > library user32.dll.
>     > Using findstr /m, AddClipboardFormatListener is found in
>     user32.dll but
>     > AddClipboardFormatListener@4 is not found.  Using findstr /m,
>     > OpenClipboard is found
>     > in user32.dll but OpenClipboard@4 is not found.  I do not
>     understand why
>     > AddClipboardFormatListener fails but OpenClipboard works.
>     >
>     > If I comment out the function declarations in listener.h and remove
>     > the @4 in listener.def,
>     > rerun dlltool and recompile, it compiles, links and runs OK.  I
>     don't
>     > like doing this because
>     > the calling conventions won't agree.  Perhaps it is OK for
>     > AddClipboardFormatListener
>     > which is only called once, but might cause problems for something
>     > called repeatedly.
>     > Can anybody work out what is going on here?
>     >
>     > I compared a user32.def generated using
>     pexports-0.48-mingw32-bin from
>     > my Windows 7
>     > user32.dll with the user32.def from w32api-5.3.4-mingw32-src
>     (with the
>     > @nn stripped).
>     > There are about 200 differences.  I think it would be a big job to
>     > update all the
>     > header files and the library file for these differences, so I don't
>     > expect it to happen.
>     > So it would be good if we could sort out using our own header
>     and library files
>     > to include the needed missing items.
>     >
>     > I'm sorry if this post does not comply with the Posting
>     Etiquette, as
>     > described at
>     > https://mingw.osdn.io/index.html?page=mailing.html#list-etiquette.
>     > I keep trying to view this, but Firefox reports "Unable to
>     connect" and
>     > ping mingw.osdn.io <http://mingw.osdn.io> reports "Request timed
>     out."
>
> _______________________________________________
> MinGW-Users mailing list
> [email protected]
>
> This list observes the Posting Etiquette, as described athttps://mingw.osdn.io/index.html?page=mailing.html#list-etiquette.
> We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.osdn.me/mailman/listinfo/mingw-users
> Also:mailto:[email protected]?subject=unsubscribe


--------------ZLYG155gulUyw0WLDYguZQNB
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Hello Test,</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">The last maintainer in the project
      Keith Marshall left the project more than 5 years ago.</div>
    <div class="moz-cite-prefix">So there are no more updates to be
      expected.</div>
    <div class="moz-cite-prefix">It is so to say 'orphaned'.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Regards, Zerro<br>
    </div>
    <br>
    <div class="moz-cite-prefix">On 11/26/24 10:23 AM, Test User wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAH7jLrtt0i2EV+ScPH6=+pr+ptAGp_tb7LfQOHqj+M2F-u-51Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="auto">
          <div>Hello Zerro,</div>
          <div><br>
          </div>
          <div>What do you mean by 'orphaned'?</div>
          <div><br>
          </div>
          <div>Regards,</div>
          <div>Test.<br>
            <br>
            <div class="gmail_quote">
              <div dir="ltr" class="gmail_attr">On Mon, Nov 25, 2024,
                3:00 PM Zerro &lt;<a href="mailto:[email protected]"
                  target="_blank" moz-do-not-send="true"
                  class="moz-txt-link-freetext">[email protected]</a>&gt;
                wrote:<br>
              </div>
              <blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi
                Paul,<br>
                <br>
                The MinGW project has been orphaned already for some
                time.<br>
                <br>
                Maybe you could try the MinGW-w64 project, which does
                seem to be <br>
                maintained well.<br>
                <br>
                Regards, ~Z<br>
                <br>
                On 11/25/24 7:24 PM, Paul Dewhirst wrote:<br>
                &gt; I've written a simple program which reports data
                placed on the clipboard.<br>
                &gt; It uses AddClipboardFormatListener,
                RemoveClipboardFormatListener and<br>
                &gt; WM_CLIPBOARDUPDATE.<br>
                &gt; It compiles OK with the Microsoft C/C++ compiler,
                but fails to compile with gcc.<br>
                &gt;<br>
                &gt; The first problem is "error: 'WM_CLIPBOARDUPDATE'
                undeclared".  So I added<br>
                &gt; "#define WM_CLIPBOARDUPDATE 0x031D" to the
                program.  Now it fails to link with<br>
                &gt; "undefined reference to
                `AddClipboardFormatListener'" and "undefined<br>
                &gt; reference to<br>
                &gt; `RemoveClipboardFormatListener'".<br>
                &gt;<br>
                &gt; The winuser.h and libuser32.a in my installation of
                gcc do not contain<br>
                &gt; these items.<br>
                &gt; Perhaps if I download the latest win32api it will
                have files which do<br>
                &gt; contain these items.<br>
                &gt; I downloaded w32api-5.3.4-mingw32-dev.tar.xz and
                extracted winuser.h<br>
                &gt; and libuser32.a,<br>
                &gt; but these don't contain the items either.<br>
                &gt;<br>
                &gt; So I produced my own header and library file to
                include these items.<br>
                &gt; I used the details for OpenClipboard as a guide
                because this has the<br>
                &gt; same parameter<br>
                &gt; and result profile.<br>
                &gt;<br>
                &gt; File listener.h:<br>
                &gt; #define WM_CLIPBOARDUPDATE 0x031D<br>
                &gt; WINUSERAPI BOOL WINAPI AddClipboardFormatListener
                (HWND);<br>
                &gt; WINUSERAPI BOOL WINAPI
                RemoveClipboardFormatListener (HWND);<br>
                &gt;<br>
                &gt; File listener.def:<br>
                &gt; LIBRARY user32.dll<br>
                &gt; EXPORTS<br>
                &gt; AddClipboardFormatListener@4<br>
                &gt; RemoveClipboardFormatListener@4<br>
                &gt;<br>
                &gt; Then run dlltool:<br>
                &gt; dlltool -d listener.def -l libextra.a<br>
                &gt;<br>
                &gt; Then compile using these files:<br>
                &gt; gcc -g -o c:\bin\clip_view.exe clip_view.c -L.
                –lextra<br>
                &gt;<br>
                &gt; This compiles and links but it fails when run with
                "The procedure entry point<br>
                &gt; AddClipboardFormatListener@4 could not be located
                in the dynamic link<br>
                &gt; library user32.dll.<br>
                &gt; Using findstr /m, AddClipboardFormatListener is
                found in user32.dll but<br>
                &gt; AddClipboardFormatListener@4 is not found.  Using
                findstr /m,<br>
                &gt; OpenClipboard is found<br>
                &gt; in user32.dll but OpenClipboard@4 is not found.  I
                do not understand why<br>
                &gt; AddClipboardFormatListener fails but OpenClipboard
                works.<br>
                &gt;<br>
                &gt; If I comment out the function declarations in
                listener.h and remove<br>
                &gt; the @4 in listener.def,<br>
                &gt; rerun dlltool and recompile, it compiles, links and
                runs OK.  I don't<br>
                &gt; like doing this because<br>
                &gt; the calling conventions won't agree.  Perhaps it is
                OK for<br>
                &gt; AddClipboardFormatListener<br>
                &gt; which is only called once, but might cause problems
                for something<br>
                &gt; called repeatedly.<br>
                &gt; Can anybody work out what is going on here?<br>
                &gt;<br>
                &gt; I compared a user32.def generated using
                pexports-0.48-mingw32-bin from<br>
                &gt; my Windows 7<br>
                &gt; user32.dll with the user32.def from
                w32api-5.3.4-mingw32-src (with the<br>
                &gt; @nn stripped).<br>
                &gt; There are about 200 differences.  I think it would
                be a big job to<br>
                &gt; update all the<br>
                &gt; header files and the library file for these
                differences, so I don't<br>
                &gt; expect it to happen.<br>
                &gt; So it would be good if we could sort out using our
                own header and library files<br>
                &gt; to include the needed missing items.<br>
                &gt;<br>
                &gt; I'm sorry if this post does not comply with the
                Posting Etiquette, as<br>
                &gt; described at<br>
                &gt; <a
href="https://mingw.osdn.io/index.html?page=mailing.html#list-etiquette"
                  rel="noreferrer noreferrer" target="_blank"
                  moz-do-not-send="true" class="moz-txt-link-freetext">https://mingw.osdn.io/index.html?page=mailing.html#list-etiquette</a>.<br>
                &gt; I keep trying to view this, but Firefox reports
                "Unable to connect" and<br>
                &gt; ping <a href="http://mingw.osdn.io"
                  rel="noreferrer noreferrer" target="_blank"
                  moz-do-not-send="true">mingw.osdn.io</a> reports
                "Request timed out."<br>
              </blockquote>
            </div>
          </div>
        </div>
      </div>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre wrap="" class="moz-quote-pre">_______________________________________________
MinGW-Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>

This list observes the Posting Etiquette, as described at <a class="moz-txt-link-freetext" href="https://mingw.osdn.io/index.html?page=mailing.html#list-etiquette">https://mingw.osdn.io/index.html?page=mailing.html#list-etiquette</a>.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
<a class="moz-txt-link-freetext" href="https://lists.osdn.me/mailman/listinfo/mingw-users">https://lists.osdn.me/mailman/listinfo/mingw-users</a>
Also: <a class="moz-txt-link-freetext" href="mailto:[email protected]?subject=unsubscribe">mailto:[email protected]?subject=unsubscribe</a></pre>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>

--------------ZLYG155gulUyw0WLDYguZQNB--


--===============4575508882218500849==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KTWluR1ctVXNl
cnMgbWFpbGluZyBsaXN0Ck1pbkdXLVVzZXJzQGxpc3RzLm9zZG4ubWUKClRoaXMgbGlzdCBvYnNl
cnZlcyB0aGUgUG9zdGluZyBFdGlxdWV0dGUsIGFzIGRlc2NyaWJlZCBhdCBodHRwczovL21pbmd3
Lm9zZG4uaW8vaW5kZXguaHRtbD9wYWdlPW1haWxpbmcuaHRtbCNsaXN0LWV0aXF1ZXR0ZS4KV2Ug
YXNrIHRoYXQgeW91IGJlIHBvbGl0ZSBhbmQgZG8gdGhlIHNhbWUuICBEaXNyZWdhcmQgZm9yIHRo
ZSBsaXN0IGV0aXF1ZXR0ZSBtYXkgY2F1c2UgeW91ciBhY2NvdW50IHRvIGJlIG1vZGVyYXRlZC4K
Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCllvdSBtYXkg
Y2hhbmdlIHlvdXIgTWluR1cgQWNjb3VudCBPcHRpb25zIG9yIHVuc3Vic2NyaWJlIGF0OgpodHRw
czovL2xpc3RzLm9zZG4ubWUvbWFpbG1hbi9saXN0aW5mby9taW5ndy11c2VycwpBbHNvOiBtYWls
dG86bWluZ3ctdXNlcnMtcmVxdWVzdEBsaXN0cy5vc2RuLm1lP3N1YmplY3Q9dW5zdWJzY3JpYmU=

--===============4575508882218500849==--