locked
Multi window application RRS feed

  • Question

  • Hi there. Can anyone tell me how do I handle multiple windows in my application ? so far I know how to create window and hook directX 11 to it, but now I'm in need of two windows, I want to develop tile map editor app witch will have two windows, one will render the tile map texture, and the other will render the editable tile map, but I don't really know where to start. I don't understand how should I create second window, should I just copy the main window creation code, change class name and window name, create separated "WndProc" and set it as second window wcex.lpfnWndProc ? or there is a different way to do this ? Can you please point me to resource or tutorial. I will want to use both windows with directX 11 as the tile map and sprite system is based on DirectXTK, and the app is for win32 platform in c++ 

    Regards.


    • Edited by _Rafal_ Saturday, July 16, 2016 7:37 PM
    Saturday, July 16, 2016 7:36 PM

Answers

All replies

  • Hello,

     I rarely do any programming in C++ for DirectX apps. However, I did a search based on your

    topic and found these results;

    Similar Topic

    http://stackoverflow.com/questions/2886609/how-to-make-multiple-windows-using-win32-api

    http://stackoverflow.com/questions/6632793/create-two-windows-in-one-application

    Video Tutorials

    https://www.youtube.com/watch?v=B3Uv9UwvHMM

    https://www.youtube.com/watch?v=gpIZ3wvNxbo

    Example/HowTo

    https://msdn.microsoft.com/en-us/library/bb384845.aspx?f=255&MSPPError=-2147217396

    Hope these are helpful. :)

    Sunday, July 17, 2016 10:59 PM
  • Hi _Rafal_,

    thanks for posting here.

    >>Can you please point me to resource or tutorial. I will want to use both windows with directX 11 as the tile map and sprite system is based on DirectXTK, and the app is for win32 platform in c++ 

    For your case, I suggest you use IDXGISwapChain interface to implement one or more surfaces for storing rendered data before presenting it to an output.You can create a swap chain by  calling IDXGIFactory2::CreateSwapChainForHwnd, IDXGIFactory2::CreateSwapChainForCoreWindow, or IDXGIFactory2::CreateSwapChainForComposition. You can also create a swap chain when you call D3D11CreateDeviceAndSwapChain; however, you can then only access the sub-set of swap-chain functionality that the IDXGISwapChain interface provides.

    Here is a document for you as a reference.

    https://msdn.microsoft.com/en-us/library/windows/desktop/bb147290(v=vs.85).aspx

    Hope these could be help of you.

    Best Regards,

    Sera Yu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.


    • Edited by Baron Bi Monday, July 18, 2016 7:33 AM
    • Proposed as answer by Baron Bi Thursday, July 21, 2016 7:41 AM
    • Marked as answer by _Rafal_ Thursday, July 21, 2016 10:55 AM
    Monday, July 18, 2016 7:33 AM
  • Thank you that was my biggest concern,  and now it turns out that all I have to do to render to two Windows is multiple swap chains.

    Thank a lot !

    Monday, July 18, 2016 11:53 AM
  • Glad to be help of you.

    if your case has been solved, please help to mark answer.

    Your understanding and cooperation will be grateful.

    Best Regards,

    Sera Yu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Thursday, July 21, 2016 7:41 AM
  • Ok so what I did is I've separated the directX device and context from the resources in two classes  Device and Output, modified  game class, basically just added few simple methods to create Output when a new window is created,    I firsts create device and the output for main window in game, and when new window is created I call the method in game class to create Output for it. Each output is associated with window by  (LONG_PTR) value so I can access it in WinProc and process scrolling etc.  Thanks for help !
    Thursday, July 21, 2016 11:12 AM