Click here to Skip to main content
11,932,402 members (51,813 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++ MFC CLR
I had made a console application in VC++ Win32 Console which generates different kind of data and now I need to sync the data with another MFC application. But I dont know how to get started. Any suggestion guys on this?

thanks in advance.
Posted 26-Jul-12 21:03pm
Edited 27-Jul-12 3:45am
enhzflep 27-Jul-12 3:06am
Are you able to expand on this a little?
Why not just write to a file from the console-app?
Or how about using sockets to communicate between the two?

What is it you're trying to accomplish?
(damn, that was a lot of questions :blush:)
Generally, not a good idea. Why would you make your life harder? It is possible, but first explain your ultimate purpose. You cannot hope for help too much if experts can suspect the whole idea is wrong...
umeshinator 27-Jul-12 3:44am
well,guys thank you for your reply,actually m sorry i am bound not to share the code,since i work in a company as a fresher,but lemme explain you with example: suppose my console application gives names of different people (john,harry,philip etc)(i have extracted these names from different system using its API) and now there is another application which is in MFC ,now i need to select any name(John,harry,Philip etc) and send to the MFC application in the name section and also when there is other name in the MFC application(which can be from other source) than the name should get updated in the console application too.
pasztorpisti 27-Jul-12 4:08am
First consider building in to two programs into one MFC application. If this is not possible then you have a lot of options to communicate between the two programs from the most simple (text) to the most advanced ways (shared memory). If you keep those programs separated then you will have to use some kind of IPC between the two programs - pipe, loopback socket, or shared memory. If the two processes are always on the same machine then its an easy way to use pipes. Loopback sockets are much similar to pipes, both of these are streams, maybe a Loopback socket is less problematic. You can create a Stream class and hide the actual implementation inside so you can replace it later without heavy efforts. IPC article on codeproject:
Hawkfuture 27-Jul-12 4:19am
pls try shared-memory and event, google for detail.
pasztorpisti 27-Jul-12 4:29am
I think pipes/sockets are less hassle than sharedmemory+event+mutex. The latter solution has a lot of spots to make mistakes especially for beginners: shared memory and multithreading are both advanced topics. On the other hand a single stream is much easier to handle are much flexible if you want to run more process pairs on the same machine or you want to run them on different machines.
umeshinator 27-Jul-12 4:33am
Thanks Pasztorpisti,i go some directions now and another thing,(ref- my last comment).the MFC application im talking about has its database in SQL server and MFC application itself can add names(john,philip etc) so when i synchronize data between my console application and MFC,how should i handle the database,since to put names in the MFC application ,all the fields has to be considered and filled and my console application only gives names.
pasztorpisti 27-Jul-12 4:38am
Sorry but I still understand neither the reason for keeping your code in two separate programs, nor your actual problem with the synchronization. I guess your problem is with the transaction and data inconsistency because you store data in 3 spots (mfc, console prog, database) and if you modify the data in one prog and in the database, then the 3rd prog still has inconsistent state. Reducing 3 spots to 2 is already much better in case of a database prog.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

umeshinator 30-Jul-12 1:25am
Thanks Volynsky.
umeshinator 30-Jul-12 2:15am
Volynsky ,the links you gave was ok,but in my condition the MFC application where i want to send the data from my C++ console application,i dont hab source code of that MFC application..its data's are stored in sql database..and i hab access to that database so Volynsky can u further suggest me how to move ahead in this?
Volynsky Alex 30-Jul-12 15:46pm
Ok. What can you say about this:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 27 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100