🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: FindWindow in different session in XP

#9657
From: Yahia El-Qasem
Date: Mon, 28 Jun 2004 18:42
38 lines
2444 bytes
"Fred W." <fwestphal@tomtec.com> schrieb im Newsbeitrag
news:40DC8965.698A31F6@tomtec.com...
> Is it possible to get the the "handle to a window" that is running in
> another session in Windows XP? I need to "SendMessage" a WM_COPYDATA
> message to a process running in Session 0 from the session for the
> current logged in user. Previously, I would use "FindWindow" in Window
> 2000 and below to send the message, but now under XP that scheme no
> longer works since XP has added Fast User Switching with Multiple
> Desktop Sessions and  it appears that each session maintains a seperate
> WIndows List.

you need several functions from Win32 API :

EnumWindowStations
OpenWindowStation
EnumDesktops
SetProcessWindowStation
OpenInputDesktop / OpenDesktop
EnumDesktopWindows

these functions will allow you to get the handle to a window located on a
different session / desktop.

MS states in the help for these desktop / windowstation functions :
This overview describes the new window station and desktop functionality,
and is primarily intended for developers of Win32 services. Developers of
typical applications that will be run by the logged-on user do not need to
be concerned about window stations and desktops.

I am NOT sure whether you can do a WM_COPYDATA to a different WindowStation
/ a different Desktop... though it should be possible after switching to the
relevant WindowStation / Desktop :-)
take a look at MSDN...


HTH

Yahia
Technical Details
Message-ID: <40e06696@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40DC8965.698A31F6@tomtec.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,21a49dd150875d21
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Yahia El-Qasem" <Yahia.El-Qasemno.spam@mgh.metro-ag.de>
From: "Yahia El-Qasem" <Yahia.El-Qasem@mgh.metro-ag.de>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <40DC8965.698A31F6@tomtec.com>
Subject: Re: FindWindow in different session in XP
Date: Mon, 28 Jun 2004 20:42:13 +0200
Lines: 40
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: 217.230.125.203
Message-ID: <40e06696@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1088448150 217.230.125.203 (28 Jun 2004 11:42:30 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail