Problem in showing the dialog form in different desktop created using CreateDesktop()?
-
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
-
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
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 allSomehtingDesktop()
functions you use in the provided code snippet return TRUE ? ~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 allSomehtingDesktop()
functions you use in the provided code snippet return TRUE ? ~RaGE();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
-
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
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:
-
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
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 functionSwitchDesktop(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