🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problems using "SwitchDesktop"

#11247
From: Remy Lebeau (TeamB)
Date: Fri, 20 Feb 2004 20:04
32 lines
2051 bytes
"Ted Byers" <r.ted.byers@sympatico.ca> wrote in message
news:403642b4$1@newsgroups.borland.com...

> All this code seems to be OK EXCEPT that my application
> does not display itself on the new desktop.

You did not call SetThreadDesktop() after creating the desktop.  Without
that, your calling thread is still associated with the default desktop, and
that is where all of your objects get displayed.

    // you could also call GetInputDesktop() instead of GetThreadDesktop()
    HDESK defaultDesktop = GetThreadDesktop(GetCurrentThreadId());

    HDESK tempDesktop = CreateDesktop(...);
    SetThreadDesktop(tempDesktop);

    // switch to the desktop, display your elements,
    // and wait for the user to be finished...

    SetThreadDesktop(defaultDesktop);
    CloseDesktop(tempDesktop);

> How can I make the main (and at present only) form display
> itself on the new desktop rather than the old one?

Make sure you are associating the correct desktop with the calling thread,
and that you are not creating the form until after you have switched
desktops.


Gambit
Technical Details
Message-ID: <40366663$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <403642b4$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,90c150c625365b29
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-02-20 12:02:11 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <403642b4$1@newsgroups.borland.com>
Subject: Re: Problems using "SwitchDesktop"
Date: Fri, 20 Feb 2004 12:04:18 -0800
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 67.22.138.253
Message-ID: <40366663$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1077306979 67.22.138.253 (20 Feb 2004 11:56:19 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail