Author |
Topic: WM_COPYDATA (Read 2810 times) |
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: WM_COPYDATA
« Reply #7 on: Sep 8th, 2011, 4:07pm » |
|
on Sep 8th, 2011, 1:37pm, Nick wrote: Bear in mind that, as a rule, any pointers sent in a message are only valid until the receiving end returns. So make sure you do everything you need with the values contained in the COPYDATASTRUCT before the '= return_value%'. Arguably you would be better off making it a LOCAL structure rather than a Global structure, to guarantee this.
Quote:return_value%=97 REM arbitrary choice! = return_value% |
|
MSDN says you should return TRUE (=1), so it's not really an "arbitrary choice".
Richard.
|
|
Logged
|
|
|
|
Nick
New Member
member is offline


Gender: 
Posts: 33
|
 |
Re: WM_COPYDATA
« Reply #8 on: Sep 8th, 2011, 4:33pm » |
|
on Sep 8th, 2011, 4:07pm, Richard Russell wrote:| Bear in mind that, as a rule, any pointers sent in a message are only valid until the receiving end returns. |
|
Yes, I was going to add that once the IPC bit of it was working properly.
Unfortunately mine still doesn't work. Does the COPYDATA statement at the sending end need similar 'magic'?
At present:
SYS "SendMessage", target_hwnd%, WM_COPYDATA, @hwnd%, COPYDATASTRUCT {}
Thanks Nick
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: WM_COPYDATA
« Reply #9 on: Sep 8th, 2011, 9:34pm » |
|
on Sep 8th, 2011, 4:33pm, Nick wrote:At present: SYS "SendMessage", target_hwnd%, WM_COPYDATA, @hwnd%, COPYDATASTRUCT {} |
|
That looks OK to me (except that there's a space between COPYDATASTRUCT and the opening brace, which isn't allowed). Anyway, you said your receiving application was seeing the message successfully so it must be working.
Incidentally, I presume you realise that COPYDATASTRUCT is the name of the generic structure; typically not of a particular instantiation (of which there could be several in a program). Although there's nothing stopping you calling your structure that, I would normally use a more succinct name such as cds{}.
Richard.
|
|
Logged
|
|
|
|
Nick
New Member
member is offline


Gender: 
Posts: 33
|
 |
Re: WM_COPYDATA
« Reply #10 on: Sep 10th, 2011, 05:30am » |
|
on Sep 8th, 2011, 9:34pm, Richard Russell wrote:| That looks OK to me (except that there's a space between COPYDATASTRUCT and the opening brace, which isn't allowed). Anyway, you said your receiving application was seeing the message successfully so it must be working. |
|
Yes, after some tidying up, it works nicely.
Quote:| Incidentally, I presume you realise that COPYDATASTRUCT is the name of the generic structure; typically not of a particular instantiation |
|
Yes, I did. I have it like this while authoring - it helps me to see more clearly which variable is what.
Thanks again - your help is much appreciated.
Nick
|
|
Logged
|
|
|
|
|