Thread: Child Process & Parent Process Data :: Win32

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348

    Child Process & Parent Process Data :: Win32

    Hi.

    How do you pass data and/or pointer to data in a parent process, both primary and/or child threads, to the primary thread (default) of a child process?

    Jeffrey Richter demonstrates the use of CreateProcess(), but he does not discuss a way to pass in data.

    Thanks,
    Kuphryn

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    You cant simply pass a pointer to data in the main process....

    Remeber that the child process will have its own process space, so therefore if you managed to pass a pointer it would be useless as the data that pointer would try to access would be outside the child's address space....

    Best bet is to keep reading Richter to the section on shared Memory Mapped Files....they provide a nice way to share data amongst processes

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Nice! Thanks.

    I will re-read the chapters about virtual file-mapping.

    Kuphryn

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Which method of passing data across processes performs best?

    Kuphryn

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by kuphryn
    Which method of passing data across processes performs best?

    Kuphryn
    For the most beefy reliable method I suppose memory mapped files....


    Also there's DDE, but its not that great, kind of complex and is quite old (see petzold as he covers this)....there's shared sections amongst dlls (every process that loads a certian dll can share data via a shared section)....

    There are also pipes and mailslots....these work like files and are quite easy to use...

    I read somewhere (cant remember where so I am not too sure) that all the above methods are implemented internally with shared memory mapped files.....

    Look into each and see which is simplest for what you wish to do.

  6. #6
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Okay. Thanks.

    Performance and extensibility is more important to me than simplicity. Well, unless the implementation require ASM or COM.

    Kuphryn

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Understanding fork()
    By NuNn in forum C Programming
    Replies: 8
    Last Post: 02-27-2009, 12:09 PM
  2. Bitmasking Problem
    By mike_g in forum C++ Programming
    Replies: 13
    Last Post: 11-08-2007, 12:24 AM
  3. Data from Child to Parent
    By queen_ayeka in forum C++ Programming
    Replies: 2
    Last Post: 11-01-2007, 04:39 PM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM