🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.language.csharp
Article #118

Re: WM_COPYDATA

#118
From: Ray
Date: Sun, 21 Jan 2007 13:16
46 lines
2251 bytes
Many thanks all working fine now

Ray
"Marc Rohloff [TeamB]" <"on request"> wrote in message 
news:80n5rkq4zz6p.dlg@dlg.marcrohloff.com...
> On Sat, 20 Jan 2007 17:28:43 -0000, Ray wrote:
>
>> Hi
>>
>> I am trying to use WM_COPYDATA to send data between applications. I can 
>> send
>> one integer successfully but if I try to send more than one the second is
>> garbage.
>
>> cds.cbData = Marshal.SizeOf(cds.dwData);
> This should be
> cds.cbData = Marshal.SizeOf(sendData);
>
> A simpler way to call SendMessage would be:
>
> public class Win32
> {
>   [DllImport("user32.dll", CharSet=CharSet.Ansi)]
>   public static extern int SendMessage(
>                                   HandleRef hWnd,
>                                   int msg,
>                                   IntPtr wParam,
>                                   [In, Out,
>                                    MarshalAs(UnmanagedType.LPStruct)]
>                                   CopyDataStruct lParam);
>
>   [StructLayout(LayoutKind.Sequential, Pack=4)]
>   public struct CopyDataStruct
>   {
>     public int dwData;
>     public int cbData;
>     public IntPtr data;
>   }
>
> This way you can just pass a CopyDataStruct into SendMessage without
> having to worry about Marshalling it.
>
>
> -- 
> Marc Rohloff [TeamB]
> marc rohloff -at- myrealbox -dot- com 
Technical Details
Message-ID: <45b3b38e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <45b250bd@newsgroups.borland.com> <80n5rkq4zz6p.dlg@dlg.marcrohloff.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,5bed5c3cf1c76c51
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ray" <noreply@daemon.com>
Newsgroups: borland.public.csharpbuilder.language.csharp
References: <45b250bd@newsgroups.borland.com> <80n5rkq4zz6p.dlg@dlg.marcrohloff.com>
Subject: Re: WM_COPYDATA
Date: Sun, 21 Jan 2007 13:16:37 -0000
Lines: 48
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
NNTP-Posting-Host: 62.56.16.3
Message-ID: <45b3b38e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1169404814 62.56.16.3 (21 Jan 2007 10:40:14 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail