BBC BASIC for Windows
« WM_COPYDATA problem »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:55pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: WM_COPYDATA problem  (Read 290 times)
Nick
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 33
xx WM_COPYDATA problem
« Thread started on: Sep 25th, 2013, 08:39am »

Hi Richard

I have subclassed WM_COPYDATA like this:

PROC_subclasswin(@hwnd%,WM_COPYDATA, FN_copydata()) REM subclass the WM_COPYDATA command

I have previously installed the library:

INSTALL @lib$+"SUBCLASSW"

My FN_copydata()) routine is below. The size of COPYBUFFER% is well over what is needed for the data to be transferred.

But when FN_copydata is invoked, I get an error:

"No such variable in module c:\Users\Nick\AppData\Local\Temp\BBCCCA4.tmp\SUBCLASSW "

I can't see any way to get further into the error reporting to see what is wrong...

Ideas?

Thanks

Nick

------------------------

DEF FN_copydata(m%,w%,l%)
LOCAL x,w
REM This has to be fast - just get the data and return
!(^RECEIVED_COPYDATA{}+4) = l%
REM Equate structures - but will this pass data, not just parameters?
REC_DW=RECEIVED_COPYDATA{}.dw%: REC_CB=RECEIVED_COPYDATA{}.cb%: REC_HWIN=w%
x=0
REPEAT
w=RECEIVED_COPYDATA{}.lpdata%?x
COPYBUFFER%?x=w
x=x+1
UNTIL x=RECEIVED_COPYDATA{}.cb%
REM add a final null to be sure
x=x+1: COPYBUFFER%?x=0
REC_COPYFLAG=1
= 1
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: WM_COPYDATA problem
« Reply #1 on: Sep 25th, 2013, 12:58pm »

on Sep 25th, 2013, 08:39am, Nick wrote:
I have subclassed WM_COPYDATA like this...

I see that you have cross-posted to the Yahoo group. Does that mean you don't want a response from me?

Richard.
User IP Logged

Nick
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 33
xx Re: WM_COPYDATA problem
« Reply #2 on: Sep 25th, 2013, 1:18pm »

on Sep 25th, 2013, 12:58pm, Richard Russell wrote:
I see that you have cross-posted to the Yahoo group. Does that mean you don't want a response from me?

Richard.


No - I posted this earlier, but then saw that the Yahoo group was continuing to generate messages, so decided to cover my options - I have a developer who is making something for me today - and I need to send him a simple test app - but I can't because of this glitch in WM_COPY...

Nick
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: WM_COPYDATA problem
« Reply #3 on: Sep 25th, 2013, 1:40pm »

on Sep 25th, 2013, 1:18pm, Nick wrote:
I posted this earlier, but then saw that the Yahoo group was continuing to generate messages

It's unavoidable that discussions about the group's closure, and where it will eventually be transferred, take place there. So I am going to the trouble of reading messages posted in that thread (I can do that by using my laptop, which is faster and has a newer version of IE).

But I'm not reading other messages posted there - I see the subject line but I don't bother to try to open the thread.

Quote:
I can't because of this glitch in WM_COPY...

It's difficult to comment without seeing a self-contained program; for example you didn't show your declaration of the RECEIVED_COPYDATA{} structure nor your allocation of the COPYBUFFER% buffer.

All I can say is that receiving a 'No such variable' message is consistent with heap corruption, so that's something to investigate.

Incidentally - although it can't be the source of the problem - your comment 'This has to be fast' seems rather incongruous alongside the actual code, which appears to have been written to be about as slow as possible!

Richard.
User IP Logged

Nick
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 33
xx Re: WM_COPYDATA problem
« Reply #4 on: Sep 25th, 2013, 1:52pm »

[quote author=Richard Russell
All I can say is that receiving a 'No such variable' message is consistent with heap corruption, so that's something to investigate. [/quote]

OK - I will double check...

[quote author=Richard Russell
Incidentally - although it can't be the source of the problem - your comment 'This has to be fast' seems rather incongruous alongside the actual code, which appears to have been written to be about as slow as possible!

Richard. [/quote]

Thanks for that. Like many experienced programmers with precious little time to go up the learning curve, I usually opt for things that are least likely to be additional reasons for something to break. But I am sure it can be re-written to be faster - your suggestions would be most welcome.

Nick
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: WM_COPYDATA problem
« Reply #5 on: Sep 27th, 2013, 11:23am »

on Sep 25th, 2013, 1:52pm, Nick wrote:
OK - I will double check...

Did you find the fault?

Quote:
But I am sure it can be re-written to be faster - your suggestions would be most welcome.

If the amount of data is substantial (say a kilobyte or more) I would recommend using SYS "RtlMoveMemory" to transfer it:

http://msdn.microsoft.com/en-us/library/windows/hardware/ff562030.aspx

If it's relatively small, a FOR...NEXT loop using static integer variables won't be too bad:

Code:
      S% = source%
      D% = destination%
      FOR I% = 0 TO bytecount%-1 : D%?I%=S%?I% : NEXT 

Of course if you know that the byte count is an exact multiple of 4 this will be faster:

Code:
      S% = source%
      D% = destination%
      FOR I% = 0 TO bytecount%-4 STEP 4 : D%!I%=S%!I% : NEXT 

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls