Article View: borland.public.cppbuilder.nativeapi
Article #13958Re: Windows wierdness (SendMessage, Win98, Win2000) repeat
From: David
Date: Sun, 31 Aug 2003 08:29
Date: Sun, 31 Aug 2003 08:29
33 lines
2884 bytes
2884 bytes
Keith wrote:
> * Above post refers to settings for your original problem app.
>
> If you will make this compiler option change, then debug across the prior shown call to SendMessage
> then what you will observe is that while the code generated in your file WinComboBox.cpp doesn't
> change, the action of SendMessageA does, in that the contents of the ESP register are correctly
> updated across the call to SendMessageA, as the four parameters are pitched off of the stack before
> returning control to you in the add() method, whereas with the C-calling convention, the ESP is not
> updated since the four parameters are left on the stack by SendMessageA.
>
> If, instead of changing the calling convention option, you were to add the following after EVERY
> SendMessage() call (at least in your WinComboBox.cpp file), then it would also work correctly:
>
> asm {
> pop ebx
> pop ebx
> pop ebx
> pop ebx
> }
>
> So that you would be manually removing the four parameters from the stack. Hokey? Somewhat, but not
> really, because it's a machine, and you make it do as you wish.
Thank you. Changing to stdcall did the trick. Trying the above 'asm' approach failed. I
recieved a 'Access violation at address E816F156. Read of address FFFFFFFF' error upon
returning. Changing to stdcall means that you can't use std::mem_fun for object function
pointers, interestingly enough. So more fuel for the fire of those who still write out their
'for' loops instead of std::for_each. But it is working. I'll send you a license key as
soon as I have updated the web site with the fixed version.
Again, many thanks.
David
Technical Details
Message-ID:
<3F51B1EE.50203@anonymous_one.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3F50A23C.1090706@anonymous_one.com> <3F50C002.901B2CC9@sbcglobal.net> <3F5164FE.8000803@anonymous_one.com> <3F519DFF.B2345F35@sbcglobal.net> <3F51A27B.1A59EF47@sbcglobal.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,d5c2d7b43b5c1d37 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-08-31 01:31:18 PST Message-ID: <3F51B1EE.50203@anonymous_one.com> Date: Sun, 31 Aug 2003 03:29:34 -0500 From: David <david@anonymous_one.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Windows wierdness (SendMessage, Win98, Win2000) repeat References: <3F50A23C.1090706@anonymous_one.com> <3F50C002.901B2CC9@sbcglobal.net> <3F5164FE.8000803@anonymous_one.com> <3F519DFF.B2345F35@sbcglobal.net> <3F51A27B.1A59EF47@sbcglobal.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 67.30.16.9 X-Trace: newsgroups.borland.com 1062318441 67.30.16.9 (31 Aug 2003 01:27:21 -0700) Lines: 34 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail