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. C / C++ / MFC
  4. Problem in showing the dialog form in different desktop created using CreateDesktop()?

Problem in showing the dialog form in different desktop created using CreateDesktop()?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++helptutorial
5 Posts 4 Posters 1 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
    Amarelia
    wrote on last edited by
    #1

    Hi Friends Yesterday also I have posted the same question but I didn't get any reply. :( I have my dialog based application which shows one form and it contains one button. When I press the button I create new desktop and then use switch to the new desktop. Now I want to show one more dialog form in this newly created desktop. But I am unable to do it. is there a way to do same? Or is there a way to give parent window or attaching it to other desktop? I am pating my little code here so that you can have exact idea what I am doing. //My CPP file HDESK hOriginalThread; HDESK hOriginalInput; HDESK hNewDesktop; // Save original ... hOriginalThread = GetThreadDesktop(GetCurrentThreadId()); hOriginalInput = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP); // Create a new Desktop and switch to it hNewDesktop = CreateDesktop("MYDesktop", NULL, NULL, 0, GENERIC_ALL, NULL); SetThreadDesktop(hNewDesktop); SwitchDesktop(hNewDesktop); // Here I want to show my new dialog form CMyDlg objDlg; objDlg.DoModal(); or objDlg.ShowWindow(SW_SHOW); // Restore original ... SwitchDesktop(hOriginalInput); SetThreadDesktop(hOriginalThread); // Close the Desktop CloseDesktop(hNewDesktop); return 0; Any idea how to achieve... Regards Mahesh

    R B 2 Replies Last reply
    0
    • A Amarelia

      Hi Friends Yesterday also I have posted the same question but I didn't get any reply. :( I have my dialog based application which shows one form and it contains one button. When I press the button I create new desktop and then use switch to the new desktop. Now I want to show one more dialog form in this newly created desktop. But I am unable to do it. is there a way to do same? Or is there a way to give parent window or attaching it to other desktop? I am pating my little code here so that you can have exact idea what I am doing. //My CPP file HDESK hOriginalThread; HDESK hOriginalInput; HDESK hNewDesktop; // Save original ... hOriginalThread = GetThreadDesktop(GetCurrentThreadId()); hOriginalInput = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP); // Create a new Desktop and switch to it hNewDesktop = CreateDesktop("MYDesktop", NULL, NULL, 0, GENERIC_ALL, NULL); SetThreadDesktop(hNewDesktop); SwitchDesktop(hNewDesktop); // Here I want to show my new dialog form CMyDlg objDlg; objDlg.DoModal(); or objDlg.ShowWindow(SW_SHOW); // Restore original ... SwitchDesktop(hOriginalInput); SetThreadDesktop(hOriginalThread); // Close the Desktop CloseDesktop(hNewDesktop); return 0; Any idea how to achieve... Regards Mahesh

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      Hi, I had a look to your problem yesterday, but could not find any satisfying answer to it. :( Some questions:

      Amarelia wrote:

      CMyDlg objDlg; objDlg.DoModal(); or objDlg.ShowWindow(SW_SHOW);

      Is CMyDlg your main dialog ? Do you want to create another instance of your main dialog in the new desktop ? or is it an instance of another child dialog ? Other question : Do all SomehtingDesktop() functions you use in the provided code snippet return TRUE ? ~RaGE();

      A 1 Reply Last reply
      0
      • R Rage

        Hi, I had a look to your problem yesterday, but could not find any satisfying answer to it. :( Some questions:

        Amarelia wrote:

        CMyDlg objDlg; objDlg.DoModal(); or objDlg.ShowWindow(SW_SHOW);

        Is CMyDlg your main dialog ? Do you want to create another instance of your main dialog in the new desktop ? or is it an instance of another child dialog ? Other question : Do all SomehtingDesktop() functions you use in the provided code snippet return TRUE ? ~RaGE();

        A Offline
        A Offline
        Amarelia
        wrote on last edited by
        #3

        Hi Rage First of all my heart felt thankx that you give some time to look into my question. No CMyDlg is not my main dialog. It's another dialog whose any instance is yet not created. You can say it's another child dialog. Even if it's possible to show another instance of the same dialog in other desktop then also I will be little bit happy. Yes my all SomethingDesktop functions execute perfectly and give TRUE value. Anything else you want to know...I'll be glad to answer u'r questions... Hope to see some positive answers Mahesh

        O 1 Reply Last reply
        0
        • A Amarelia

          Hi Rage First of all my heart felt thankx that you give some time to look into my question. No CMyDlg is not my main dialog. It's another dialog whose any instance is yet not created. You can say it's another child dialog. Even if it's possible to show another instance of the same dialog in other desktop then also I will be little bit happy. Yes my all SomethingDesktop functions execute perfectly and give TRUE value. Anything else you want to know...I'll be glad to answer u'r questions... Hope to see some positive answers Mahesh

          O Offline
          O Offline
          Owner drawn
          wrote on last edited by
          #4

          How are you specifying the position for this dialog!

          Jesus Loves:rose:

          --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

          1 Reply Last reply
          0
          • A Amarelia

            Hi Friends Yesterday also I have posted the same question but I didn't get any reply. :( I have my dialog based application which shows one form and it contains one button. When I press the button I create new desktop and then use switch to the new desktop. Now I want to show one more dialog form in this newly created desktop. But I am unable to do it. is there a way to do same? Or is there a way to give parent window or attaching it to other desktop? I am pating my little code here so that you can have exact idea what I am doing. //My CPP file HDESK hOriginalThread; HDESK hOriginalInput; HDESK hNewDesktop; // Save original ... hOriginalThread = GetThreadDesktop(GetCurrentThreadId()); hOriginalInput = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP); // Create a new Desktop and switch to it hNewDesktop = CreateDesktop("MYDesktop", NULL, NULL, 0, GENERIC_ALL, NULL); SetThreadDesktop(hNewDesktop); SwitchDesktop(hNewDesktop); // Here I want to show my new dialog form CMyDlg objDlg; objDlg.DoModal(); or objDlg.ShowWindow(SW_SHOW); // Restore original ... SwitchDesktop(hOriginalInput); SetThreadDesktop(hOriginalThread); // Close the Desktop CloseDesktop(hNewDesktop); return 0; Any idea how to achieve... Regards Mahesh

            B Offline
            B Offline
            BadKarma
            wrote on last edited by
            #5

            Hi, I never used different desktops, but why not try ... ;) I've paste youre code into a test project and used the CAabout to show in the other desktop. X| could used a warning that everithing would hang. ;P In my case the function SetThreadDesktop(hNewDesktop); fails giving me an error code 170: meaning, requested rescource is busy. When continueing the function SwitchDesktop(hNewDesktop); works switching the desktop. But the main thread is still located running at the original desktop. Sorry :sigh:, don't know anything else to test. Will test some more codito ergo sum

            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