Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. can i use two projects in one work space ,, how ???

can i use two projects in one work space ,, how ???

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++helptutorialworkspace
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    Zeeshan Bilal
    wrote on last edited by
    #1

    i have two projects ,, one MFC dialoged base and other is WIN32 i want to place them in 1 workspace.. and also want to communicate between these 2 projects classess. for example .. in MFC i have created a socket by CSocket class ,, now i want to this socket in my WIN32 application ,, how can i do it . Plz help me its urgent thanx

    A M 2 Replies Last reply
    0
    • Z Zeeshan Bilal

      i have two projects ,, one MFC dialoged base and other is WIN32 i want to place them in 1 workspace.. and also want to communicate between these 2 projects classess. for example .. in MFC i have created a socket by CSocket class ,, now i want to this socket in my WIN32 application ,, how can i do it . Plz help me its urgent thanx

      A Offline
      A Offline
      Antti Keskinen
      wrote on last edited by
      #2

      Having two projects in a single workspace is easy. Just open the workspace you want to have both projects in, then go right-click on the workspace name and add an existing item/project to workspace. Remember to take the tick off from 'Dependency of' radio box if it is checked. As the two projects are seperate applications and thus run on seperate processes, the only feasible solution is to use a named pipe between them. Have the MFC application create a named pipe, and write it's data in there. Then signal the Win32 application to open the pipe and read data from there. Remember that in this case, you cannot pass for example a pointer to the CSocket class through the pipe to the other application, as this pointer is no longer valid when it leaves the context: using it will cause a protected-mode memory failure, or in Windows 95/98, the notorius Blue Screen of Death. If you want to share viable data, such as pointers to classes or data, between the two applications, then you must run them under the same process space, on seperate threads. The MFC program can create a new thread, and hit the Win32 application running there. Then it is just a matter of cross-thread messaging to pass stuff between them. Naturally, a named pipe is a useful solution in this case as well. Even simpler solution to use the Win32 application, you can call the LoadLibrary function, get the address of the starting point function (WinMain) from it, then call it manually. This will load the application into the MFC-program's process space and execute it's WinMain function, which simulates running the program. In this case, of course, the WinMain function must be exported from the executable and a definition file is required. There are a few articles available here on CodeProject about cross-thread and inter-process communication. See this area[^] for some examples. -Antti Keskinen ---------------------------------------------- The definition of impossible is strictly dependant on what we think is possible.

      1 Reply Last reply
      0
      • Z Zeeshan Bilal

        i have two projects ,, one MFC dialoged base and other is WIN32 i want to place them in 1 workspace.. and also want to communicate between these 2 projects classess. for example .. in MFC i have created a socket by CSocket class ,, now i want to this socket in my WIN32 application ,, how can i do it . Plz help me its urgent thanx

        M Offline
        M Offline
        Mukkie
        wrote on last edited by
        #3

        To have two projects in one workspace, simply "add existing project" from context menu on workspace (as I remember). If you want to use the other project, you can import/export some data. In case of socket it will be more difficult, cause you will not be able to debug two projects from one workspace in one vc at once :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups