🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #11236

Problems using "SwitchDesktop"

#11236
From: Ted Byers
Date: Fri, 20 Feb 2004 17:28
46 lines
2646 bytes
Here is the declaration of my desktop handles:

  HDESK defaultDesktop, tempDesktop;


And here is the code I'm trying:

  defaultDesktop = GetThreadDesktop(GetCurrentThreadId());
  tempDesktop = CreateDesktop("GetItRightChild",
                              NULL,
                              NULL,
                              0,
                              DESKTOP_CREATEWINDOW | DESKTOP_SWITCHDESKTOP,
                              NULL);
  BOOL rv = SwitchDesktop(tempDesktop);


When the application closes, I have the following to reset things back to
normal:

  BOOL rv = SwitchDesktop(defaultDesktop);
  rv = CloseDesktop(tempDesktop);



All this code seems to be OK EXCEPT that my application does not display
itself on the new desktop.  Rather, it remains hidden because it get
displayed on the original, default desktop.  How can I make the main (and at
present only) form display itself on the new desktop rather than the old
one?  There is, after all, little point in making and switching to a new
desktop with nothing on it except my program if I can't get my program to
display itself there.  I don't want the new desktop to have anything on it,
not even a menu, until my program says its OK (And, I want my program to
simply hid itself when the user wishes to exit, instead of closing, so that
I can relate how long a kid can use the computer based on how well he does
on the test provided and what his parents or teachers say is suitable - this
I have figured out in that I'd have a timer, set its interval based on
parental policy and score, and then switch the user back to the new desktop
and my application in the timer event handler, resetting everything
appropriately).

Any ideas on how to fix this?

Thanks,

Ted
Technical Details
Message-ID: <403642b4$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,90c150c625365b29,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-02-20 09:40:54 PST
From: "Ted Byers" <r.ted.byers@sympatico.ca>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Problems using "SwitchDesktop"
Date: Fri, 20 Feb 2004 12:28:13 -0500
Lines: 48
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 65.95.240.180
Message-ID: <403642b4$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1077297844 65.95.240.180 (20 Feb 2004 09:24:04 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail