Click here to Skip to main content
15,914,109 members
Home / Discussions / C#
   

C#

 
AnswerRe: User Control Pin
aSarafian1-Feb-07 2:15
aSarafian1-Feb-07 2:15 
GeneralRe: User Control Pin
Biswajit Ghosh1-Feb-07 19:48
Biswajit Ghosh1-Feb-07 19:48 
GeneralRe: User Control Pin
aSarafian1-Feb-07 21:16
aSarafian1-Feb-07 21:16 
AnswerRe: User Control Pin
Luc Pattyn1-Feb-07 7:16
sitebuilderLuc Pattyn1-Feb-07 7:16 
GeneralRe: User Control Pin
Biswajit Ghosh1-Feb-07 19:47
Biswajit Ghosh1-Feb-07 19:47 
GeneralRe: User Control Pin
Luc Pattyn1-Feb-07 23:41
sitebuilderLuc Pattyn1-Feb-07 23:41 
QuestionHow to use WM_COPYDATA to send a struct to another process? Pin
huheng_0_031-Jan-07 20:14
huheng_0_031-Jan-07 20:14 
AnswerRe: How to use WM_COPYDATA to send a struct to another process? Pin
Luc Pattyn1-Feb-07 7:38
sitebuilderLuc Pattyn1-Feb-07 7:38 
As far as I understand your code, you managed to create a copy of the WholeInfo struct
in some memory that is accessible to the other process.
Unfortunately, that struct contains only 2 pointers (a string is a reference type),
and these pointers are NOT valid in the other process (which has a different address space).

So you are nowhere yet.

Are you sure you need WM_COPYDATA ?

There are other ways to transfer data.

Some suggestions:

1) the easiest is to make your struct completely value typed (things like int, but not
class objects, nor arrays). This should work with the code you have, but will not solve
your problem for passing strings.

2) use named pipes; it takes some setting up, but there is no address space problem involved,
once the pipe has been established you do WriteFile at one end, and ReadFile at the other;
this does not provide a signal to the other process, so it better has an extra thread
that just opens the pipe and reads (and waits until something is read).
BTW you will need PInvoke for this.

3) use memory mapped files; very similar to named pipes.

4) there must be an easy way based on .NET Remoting; this involves a new serializable class
that contains your data, and a TCP channel to transfer it to the other process. I did this
once but got fed up with Firewall hassles, so I switched to using named pipes for passing
the command line from one app to another (when I want the app to behave as a singleton).
For .NET Remoting there are articles on CodeProject.


Smile | :)





Luc Pattyn

GeneralRe: How to use WM_COPYDATA to send a struct to another process? Pin
huheng_0_01-Feb-07 17:56
huheng_0_01-Feb-07 17:56 
GeneralRe: How to use WM_COPYDATA to send a struct to another process? Pin
Luc Pattyn2-Feb-07 9:41
sitebuilderLuc Pattyn2-Feb-07 9:41 
QuestionHELP: how to select specific node in XML using c# Pin
drifters31-Jan-07 20:13
drifters31-Jan-07 20:13 
AnswerRe: HELP: how to select specific node in XML using c# Pin
Christian Graus31-Jan-07 20:27
protectorChristian Graus31-Jan-07 20:27 
GeneralRe: HELP: how to select specific node in XML using c# Pin
drifters31-Jan-07 20:32
drifters31-Jan-07 20:32 
GeneralRe: HELP: how to select specific node in XML using c# [modified] Pin
bobsugar22231-Jan-07 22:19
bobsugar22231-Jan-07 22:19 
GeneralRe: HELP: how to select specific node in XML using c# [modified] Pin
drifters31-Jan-07 22:32
drifters31-Jan-07 22:32 
GeneralRe: HELP: how to select specific node in XML using c# Pin
Stefan Troschuetz31-Jan-07 22:33
Stefan Troschuetz31-Jan-07 22:33 
GeneralRe: HELP: how to select specific node in XML using c# Pin
drifters1-Feb-07 14:51
drifters1-Feb-07 14:51 
GeneralRe: HELP: how to select specific node in XML using c# Pin
drifters1-Feb-07 16:20
drifters1-Feb-07 16:20 
GeneralRe: HELP: how to select specific node in XML using c# Pin
Stefan Troschuetz1-Feb-07 20:56
Stefan Troschuetz1-Feb-07 20:56 
QuestionCall Java Code Pin
Expert Coming31-Jan-07 20:03
Expert Coming31-Jan-07 20:03 
AnswerRe: Call Java Code Pin
blackjack215031-Jan-07 20:15
blackjack215031-Jan-07 20:15 
Questioncombobox selectedindexchanged event Pin
KrunalC31-Jan-07 19:46
KrunalC31-Jan-07 19:46 
QuestionInterprocess communication using impersonation Pin
ParimalaRadjaram31-Jan-07 19:42
ParimalaRadjaram31-Jan-07 19:42 
QuestionHow to make an User Control in VC# that can be used in VC6? Pin
Andy Rama31-Jan-07 18:42
Andy Rama31-Jan-07 18:42 
AnswerRe: How to make an User Control in VC# that can be used in VC6? Pin
Christian Graus31-Jan-07 20:28
protectorChristian Graus31-Jan-07 20:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.