473,385 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

what kind of ipc technologies for C# windows form applications.



I know you can use socket to talk to other application . But i have an old
;) MFC app that only
speaks "wm_copydata". I want this appliccation to interact with an other one
written with C#.
Well "web services" are out of question because i do not know if my old MFC
centrique app need
to be bothered with web service.

So what are the other alternatives.
Many thanks in advance
Nov 16 '05 #1
9 2669
wm_copydata?
do you mean some kind of shared memory stuff?

otherwise I have a library which I plan to have shareware, but it's not yet
well documented, not yet on a web site where you could buy, but already
working with Pipes and Shared Memory implementation in C#.
(+ some remoting stuff you don't, unfortunatele, care)
(the problem is I'm slowly learning ASP.NET 2.0 so it will be ... delayed)

eventually if you're interested you could contact me: ld remove at skip
galador dot net

"Bredal Jensen" <br****@jensen.dk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...


I know you can use socket to talk to other application . But i have an old
;) MFC app that only
speaks "wm_copydata". I want this appliccation to interact with an other
one
written with C#.
Well "web services" are out of question because i do not know if my old
MFC
centrique app need
to be bothered with web service.

So what are the other alternatives.
Many thanks in advance

Nov 16 '05 #2
Hi,

You will have to intercept that message, overwriting WndProc of the form
receiving it. after that you can copy the data using marshalling, I dont
have an example here with me but I assure you that if you look in google you
will find plenty.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Bredal Jensen" <br****@jensen.dk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...


I know you can use socket to talk to other application . But i have an old
;) MFC app that only
speaks "wm_copydata". I want this appliccation to interact with an other one written with C#.
Well "web services" are out of question because i do not know if my old MFC centrique app need
to be bothered with web service.

So what are the other alternatives.
Many thanks in advance

Nov 16 '05 #3
Bredal,

If that is the case, then you could very easily define the SendMessage
API function and call that, passing the WM_COPYDATA message (and appropriate
paramters). You just have to make sure you have the windows handle of the
app, and you are set.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bredal Jensen" <br****@jensen.dk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...


I know you can use socket to talk to other application . But i have an old
;) MFC app that only
speaks "wm_copydata". I want this appliccation to interact with an other
one
written with C#.
Well "web services" are out of question because i do not know if my old
MFC
centrique app need
to be bothered with web service.

So what are the other alternatives.
Many thanks in advance

Nov 16 '05 #4
If i understands, this sounds like
p/Invoke, right?
well i would look for examples then. It may turn out to be very usefull .
Thank you
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> skrev i
en meddelelse news:OK**************@TK2MSFTNGP11.phx.gbl...
Bredal,

If that is the case, then you could very easily define the SendMessage
API function and call that, passing the WM_COPYDATA message (and appropriate paramters). You just have to make sure you have the windows handle of the
app, and you are set.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bredal Jensen" <br****@jensen.dk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...


I know you can use socket to talk to other application . But i have an old ;) MFC app that only
speaks "wm_copydata". I want this appliccation to interact with an other
one
written with C#.
Well "web services" are out of question because i do not know if my old
MFC
centrique app need
to be bothered with web service.

So what are the other alternatives.
Many thanks in advance


Nov 16 '05 #5
I do not know much about marshalling although i have heared much about it.
So i guess it is time to read something about it.

Howabout sending message from C# to MFC?

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> skrev
i en meddelelse news:uH**************@TK2MSFTNGP14.phx.gbl...
Hi,

You will have to intercept that message, overwriting WndProc of the form
receiving it. after that you can copy the data using marshalling, I dont
have an example here with me but I assure you that if you look in google you will find plenty.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Bredal Jensen" <br****@jensen.dk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...


I know you can use socket to talk to other application . But i have an old ;) MFC app that only
speaks "wm_copydata". I want this appliccation to interact with an other

one
written with C#.
Well "web services" are out of question because i do not know if my old

MFC
centrique app need
to be bothered with web service.

So what are the other alternatives.
Many thanks in advance


Nov 16 '05 #6
I'm not quiet sure what you library does but i'm not looking for shared
memory
neither Pipe stuff. My old app uses wm_copydata and there is too much code
written
with it to move to an other IPC mechanism.

But thanks anyway.

"Lloyd Dupont" <ld@NewsAccount.galador.net> skrev i en meddelelse
news:ux**************@TK2MSFTNGP15.phx.gbl...
wm_copydata?
do you mean some kind of shared memory stuff?

otherwise I have a library which I plan to have shareware, but it's not yet well documented, not yet on a web site where you could buy, but already
working with Pipes and Shared Memory implementation in C#.
(+ some remoting stuff you don't, unfortunatele, care)
(the problem is I'm slowly learning ASP.NET 2.0 so it will be ... delayed)

eventually if you're interested you could contact me: ld remove at skip
galador dot net

"Bredal Jensen" <br****@jensen.dk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...


I know you can use socket to talk to other application . But i have an old ;) MFC app that only
speaks "wm_copydata". I want this appliccation to interact with an other
one
written with C#.
Well "web services" are out of question because i do not know if my old
MFC
centrique app need
to be bothered with web service.

So what are the other alternatives.
Many thanks in advance


Nov 16 '05 #7
Bredal,

Yes, you will use the P/Invoke layer. Basically, you will want to do
this:

[StructLayout(LayoutKind.Sequential)]
public struct COPYDATASTRUCT
{
[MarshalAs(UnmanagedType.U4)]
public int dwData;
[MarshalAs(UnmanagedType.U4)]
public int cbData;
public IntPtr lpData;
}

And then you could define something very specific for SendMessage, since
it will only pass WM_COPYDATA:

[DllImport("user32.dll")]
private static extern IntPtr SendMessage(
IntPtr hWnd,
[MarshalAs(UnmanagedType.U4)]
int Msg,
IntPtr wParam,
ref COPYDATASTRUCT lParam);

And then define a wrapper method, like this:

public static IntPtr SendCopyDataMessage(IntPtr toHandle, IntPtr fromHandle,
IntPtr data, int length)
{
// Create the structure.
COPYDATASTRUCT dataStruct = new COPYDATASTRUCT();

// Set the fields.
dataStruct.lpData = data;
dataStruct.cbData = length;

// Assume WM_COPYDATA is defined. Make the call.
return SendMessage(toHandle, WM_COPYDATA, fromHandle, ref dataStruct);
}

Of course, you can perform variants on this (passing in a byte array,
etc, etc).

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bredal Jensen" <br****@jensen.dk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
If i understands, this sounds like
p/Invoke, right?
well i would look for examples then. It may turn out to be very usefull .
Thank you
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> skrev i
en meddelelse news:OK**************@TK2MSFTNGP11.phx.gbl...
Bredal,

If that is the case, then you could very easily define the
SendMessage
API function and call that, passing the WM_COPYDATA message (and

appropriate
paramters). You just have to make sure you have the windows handle of
the
app, and you are set.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bredal Jensen" <br****@jensen.dk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
>
>
> I know you can use socket to talk to other application . But i have an old > ;) MFC app that only
> speaks "wm_copydata". I want this appliccation to interact with an
> other
> one
> written with C#.
> Well "web services" are out of question because i do not know if my old
> MFC
> centrique app need
> to be bothered with web service.
>
> So what are the other alternatives.
>
>
> Many thanks in advance
>
>



Nov 16 '05 #8
Hi,

It's the same thing

You have to use marshalling to copy/read unmanaged memory and probably call
some API functions using P/Invoke

Again, search in google for working code.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Bredal Jensen" <br****@jensen.dk> wrote in message
news:eD***************@tk2msftngp13.phx.gbl...
I do not know much about marshalling although i have heared much about it.
So i guess it is time to read something about it.

Howabout sending message from C# to MFC?

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> skrev i en meddelelse news:uH**************@TK2MSFTNGP14.phx.gbl...
Hi,

You will have to intercept that message, overwriting WndProc of the form
receiving it. after that you can copy the data using marshalling, I dont
have an example here with me but I assure you that if you look in google

you
will find plenty.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Bredal Jensen" <br****@jensen.dk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...


I know you can use socket to talk to other application . But i have an old ;) MFC app that only
speaks "wm_copydata". I want this appliccation to interact with an
other one
written with C#.
Well "web services" are out of question because i do not know if my
old MFC
centrique app need
to be bothered with web service.

So what are the other alternatives.
Many thanks in advance



Nov 16 '05 #9
Great thanks!
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> skrev i
en meddelelse news:en**************@TK2MSFTNGP12.phx.gbl...
Bredal,

Yes, you will use the P/Invoke layer. Basically, you will want to do
this:

[StructLayout(LayoutKind.Sequential)]
public struct COPYDATASTRUCT
{
[MarshalAs(UnmanagedType.U4)]
public int dwData;
[MarshalAs(UnmanagedType.U4)]
public int cbData;
public IntPtr lpData;
}

And then you could define something very specific for SendMessage, since it will only pass WM_COPYDATA:

[DllImport("user32.dll")]
private static extern IntPtr SendMessage(
IntPtr hWnd,
[MarshalAs(UnmanagedType.U4)]
int Msg,
IntPtr wParam,
ref COPYDATASTRUCT lParam);

And then define a wrapper method, like this:

public static IntPtr SendCopyDataMessage(IntPtr toHandle, IntPtr fromHandle, IntPtr data, int length)
{
// Create the structure.
COPYDATASTRUCT dataStruct = new COPYDATASTRUCT();

// Set the fields.
dataStruct.lpData = data;
dataStruct.cbData = length;

// Assume WM_COPYDATA is defined. Make the call.
return SendMessage(toHandle, WM_COPYDATA, fromHandle, ref dataStruct);
}

Of course, you can perform variants on this (passing in a byte array,
etc, etc).

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bredal Jensen" <br****@jensen.dk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
If i understands, this sounds like
p/Invoke, right?
well i would look for examples then. It may turn out to be very usefull .. Thank you
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> skrev i en meddelelse news:OK**************@TK2MSFTNGP11.phx.gbl...
Bredal,

If that is the case, then you could very easily define the
SendMessage
API function and call that, passing the WM_COPYDATA message (and

appropriate
paramters). You just have to make sure you have the windows handle of
the
app, and you are set.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bredal Jensen" <br****@jensen.dk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
>
>
> I know you can use socket to talk to other application . But i have an
old
> ;) MFC app that only
> speaks "wm_copydata". I want this appliccation to interact with an
> other
> one
> written with C#.
> Well "web services" are out of question because i do not know if my

old > MFC
> centrique app need
> to be bothered with web service.
>
> So what are the other alternatives.
>
>
> Many thanks in advance
>
>



Nov 16 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

50
by: Jerry Sievers | last post by:
<venting> Fellow coders; I just get off the phone today with some clueless headhunter and after listing for her (very proudly I might add) my OS and dev tools platforms of choice; ...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
44
by: lester | last post by:
a pre-beginner's question: what is the pros and cons of .net, compared to ++ I am wondering what can I get if I continue to learn C# after I have learned C --> C++ --> C# ?? I think there...
0
by: Stylus Studio | last post by:
DataDirect XQuery(TM) is the First Embeddable Component for XQuery That is Modeled after the XQuery API for Java(TM) (XQJ) BEDFORD, Mass.--Sept. 20, 2005--DataDirect Technologies...
1
by: ramesh.teja | last post by:
Hi, Vennela Technologies is a Global Oracle Technologies and Oracle Applications services Provider with a good customer base in Middle East and Europe Vennela started its Training division very...
26
by: Lasse Edsvik | last post by:
Hello I'm trying to build a simple COM+ app in vs.net using C# and i cant register it in component manager..... what more is needed than this: using System; using...
0
by: Piotr Nienaltowski | last post by:
!!! DEADLINE FOR PAPER SUBMISSIONS HAS BEEN EXTENDED UNTIL FEBRUARY 26, 2004 !!! ---------------------------------------------------------------- .NET TECHNOLOGIES 2004 2nd International...
3
by: mminnie | last post by:
After years of working with legacy systems, I am not starting to discover the .NET world. Wow. I am trying to figure out how Visual Basic, Windows Forms, Smart Clients, and all of the other .NET...
11
by: Paul Brady | last post by:
Apparently, I have been living on the wrong planet. I have written 15 databases in Microsoft Access in the past 10 years, some of which are split, one uses ODBC interface with a SQL server, one...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.