Re: Problems using AddClipboardFormatListener, RemoveClipboardFormatListener and WM_CLIPBOARDUPDATE

Test User <[email protected]> Tue, 26 Nov 2024 04:23:17 -0500
Newsgroups gmane.comp.gnu.mingw.user
Message-ID <CAH7jLrtt0i2EV+ScPH6=+pr+ptAGp_tb7LfQOHqj+M2F-u-51Q@mail.gmail.com>
--===============3595424958031270798==
Content-Type: multipart/alternative; boundary="000000000000d47c4e0627cd66a9"

--000000000000d47c4e0627cd66a9
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hello Zerro,

What do you mean by 'orphaned'?

Regards,
Test.

On Mon, Nov 25, 2024, 3:00=E2=80=AFPM 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 clipboar=
d.
> > 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. =E2=80=93lextra
> >
> > 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 wh=
y
> > 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=3Dmailing.html#list-etiquette.
> > I keep trying to view this, but Firefox reports "Unable to connect" and
> > ping mingw.osdn.io reports "Request timed out."
> >
> > _______________________________________________
> > MinGW-Users mailing list
> > [email protected]
>
> _______________________________________________
> MinGW-Users mailing list
> [email protected]
>
> This list observes the Posting Etiquette, as described at
> https://mingw.osdn.io/index.html?page=3Dmailing.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=3Dunsubscribe

--000000000000d47c4e0627cd66a9
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"auto"><div>Hello Zerro,</div><div><br></div><d=
iv>What do you mean by &#39;orphaned&#39;?</div><div><br></div><div>Regards=
,</div><div>Test.<br><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=
=3D"gmail_attr">On Mon, Nov 25, 2024, 3:00=E2=80=AFPM Zerro &lt;<a href=3D"=
mailto:[email protected]" target=3D"_blank">[email protected]</a>&gt; wrote:<=
br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;borde=
r-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&#39;ve written a simple program which reports data placed on the cli=
pboard.<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 &quot;error: &#39;WM_CLIPBOARDUPDATE&#39; undecla=
red&quot;.=C2=A0 So I added<br>
&gt; &quot;#define WM_CLIPBOARDUPDATE 0x031D&quot; to the program.=C2=A0 No=
w it fails to link with<br>
&gt; &quot;undefined reference to `AddClipboardFormatListener&#39;&quot; an=
d &quot;undefined<br>
&gt; reference to<br>
&gt; `RemoveClipboardFormatListener&#39;&quot;.<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<b=
r>
&gt; and libuser32.a,<br>
&gt; but these don&#39;t contain the items either.<br>
&gt;<br>
&gt; So I produced my own header and library file to include these items.<b=
r>
&gt; I used the details for OpenClipboard as a guide because this has the<b=
r>
&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. =E2=80=93lextra<br>
&gt;<br>
&gt; This compiles and links but it fails when run with &quot;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 bu=
t<br>
&gt; AddClipboardFormatListener@4 is not found.=C2=A0 Using findstr /m,<br>
&gt; OpenClipboard is found<br>
&gt; in user32.dll but OpenClipboard@4 is not found.=C2=A0 I do not underst=
and 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.=C2=A0 I d=
on&#39;t<br>
&gt; like doing this because<br>
&gt; the calling conventions won&#39;t agree.=C2=A0 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.=C2=A0 I think it would be a big job t=
o<br>
&gt; update all the<br>
&gt; header files and the library file for these differences, so I don&#39;=
t<br>
&gt; expect it to happen.<br>
&gt; So it would be good if we could sort out using our own header and libr=
ary files<br>
&gt; to include the needed missing items.<br>
&gt;<br>
&gt; I&#39;m sorry if this post does not comply with the Posting Etiquette,=
 as<br>
&gt; described at<br>
&gt; <a href=3D"https://mingw.osdn.io/index.html?page=3Dmailing.html#list-e=
tiquette" rel=3D"noreferrer noreferrer" target=3D"_blank">https://mingw.osd=
n.io/index.html?page=3Dmailing.html#list-etiquette</a>.<br>
&gt; I keep trying to view this, but Firefox reports &quot;Unable to connec=
t&quot; and<br>
&gt; ping <a href=3D"http://mingw.osdn.io" rel=3D"noreferrer noreferrer" ta=
rget=3D"_blank">mingw.osdn.io</a> reports &quot;Request timed out.&quot;<br=
>
&gt;<br>
&gt; _______________________________________________<br>
&gt; MinGW-Users mailing list<br>
&gt; <a href=3D"mailto:[email protected]" rel=3D"noreferrer" target=
=3D"_blank">[email protected]</a><br>
<br>
_______________________________________________<br>
MinGW-Users mailing list<br>
<a href=3D"mailto:[email protected]" rel=3D"noreferrer" target=3D"_=
blank">[email protected]</a><br>
<br>
This list observes the Posting Etiquette, as described at <a href=3D"https:=
//mingw.osdn.io/index.html?page=3Dmailing.html#list-etiquette" rel=3D"noref=
errer noreferrer" target=3D"_blank">https://mingw.osdn.io/index.html?page=
=3Dmailing.html#list-etiquette</a>.<br>
We ask that you be polite and do the same.=C2=A0 Disregard for the list eti=
quette may cause your account to be moderated.<br>
<br>
_______________________________________________<br>
You may change your MinGW Account Options or unsubscribe at:<br>
<a href=3D"https://lists.osdn.me/mailman/listinfo/mingw-users" rel=3D"noref=
errer noreferrer" target=3D"_blank">https://lists.osdn.me/mailman/listinfo/=
mingw-users</a><br>
Also: mailto:<a href=3D"mailto:[email protected]" rel=3D"no=
referrer" target=3D"_blank">[email protected]</a>?subject=
=3Dunsubscribe</blockquote></div></div></div>
</div>

--000000000000d47c4e0627cd66a9--


--===============3595424958031270798==
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=

--===============3595424958031270798==--