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
  1. Home
  2. General Programming
  3. Windows API
  4. Hosting an application inside a custom window?

Hosting an application inside a custom window?

Scheduled Pinned Locked Moved Windows API
helpcomhostingdebuggingperformance
3 Posts 3 Posters 9 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.
  • A Offline
    A Offline
    Aschratt
    wrote on last edited by
    #1

    Hey there, I have to debug an application and want to write a small tool to watch the memory changing "on demand" while working with the application and reproducing the errors. I thought about hosting the application itself in a custom window to directly include it into my programm, having all debug output windows next to it (something like a TDI interface). So far so good... I decided to hook the CreateWindowEx method for the program to return the HWND of one of my tab pages (the one hosting the app). It would be to easy if it would have worked! ;P I guess the problem is that the application is running in another process/thread and the window itself lays inside the memory area of my process. Now if the application tries to access the window with the handle from a different process the access fails. Is there any way to create a window inside some kind of shared memory to do this? Or am I simply missing something? Would be cool if anyone can help me with this! :) Thank you! http://www.aschratt.com

    F C 2 Replies Last reply
    0
    • A Aschratt

      Hey there, I have to debug an application and want to write a small tool to watch the memory changing "on demand" while working with the application and reproducing the errors. I thought about hosting the application itself in a custom window to directly include it into my programm, having all debug output windows next to it (something like a TDI interface). So far so good... I decided to hook the CreateWindowEx method for the program to return the HWND of one of my tab pages (the one hosting the app). It would be to easy if it would have worked! ;P I guess the problem is that the application is running in another process/thread and the window itself lays inside the memory area of my process. Now if the application tries to access the window with the handle from a different process the access fails. Is there any way to create a window inside some kind of shared memory to do this? Or am I simply missing something? Would be cool if anyone can help me with this! :) Thank you! http://www.aschratt.com

      F Offline
      F Offline
      FlyfishX
      wrote on last edited by
      #2

      Use WindowsAPI "SetParent".

      1 Reply Last reply
      0
      • A Aschratt

        Hey there, I have to debug an application and want to write a small tool to watch the memory changing "on demand" while working with the application and reproducing the errors. I thought about hosting the application itself in a custom window to directly include it into my programm, having all debug output windows next to it (something like a TDI interface). So far so good... I decided to hook the CreateWindowEx method for the program to return the HWND of one of my tab pages (the one hosting the app). It would be to easy if it would have worked! ;P I guess the problem is that the application is running in another process/thread and the window itself lays inside the memory area of my process. Now if the application tries to access the window with the handle from a different process the access fails. Is there any way to create a window inside some kind of shared memory to do this? Or am I simply missing something? Would be cool if anyone can help me with this! :) Thank you! http://www.aschratt.com

        C Offline
        C Offline
        Code o mat
        wrote on last edited by
        #3

        Just a conceptual (and very late) idea: how about hooking the GetDC, GetWindowDC and BeginPaint (...) calls, returning some kind of memory DC with a bitmap selected into it (size equivalent to the window that would be drawn onto normally), letting the process draw its things into this memory DC, then when ReleaseDC or EndPaint (you would need to hook those too) is called, transfer the content of the DC over to your process trough a socket or named pipe or somesuch along with size and position information and then blitting it into your own window. Of course there's also the problem that this method would still leave the original application's window hanging around the desktop undrawn and you would also need to direct input (clicks, mouse move events...) back to the original application for processing which might also pose problems, but maybe this could be a starting point towards something useful...

        > The problem with computers is that they do what you tell them to do and not what you want them to do. < > //TODO: Implement signature here<

        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