HELP ! Bring windows to front and to back

I’m using Qnx4.25, Photon 1.14, I need a way to bring windows back and
forth, same as alt-f2 and alt-f3 do with PWM, all i can find
is PtWindowToFront() and PtWindowToBack(), both needs the address of the
window widget. Unfortunately, I dont have the address
of the window widget, since they are windows started by ‘phditto’.

Ran Zhang wrote:

I’m using Qnx4.25, Photon 1.14, I need a way to bring windows back and
forth, same as alt-f2 and alt-f3 do with PWM, all i can find
is PtWindowToFront() and PtWindowToBack(), both needs the address of the
window widget. Unfortunately, I dont have the address
of the window widget, since they are windows started by ‘phditto’.

Use PtForwardWindowEvent().

PhWindowEvent_t requires RID (region id of the affected region), only
way to get RID is using PtWidgetRid() which still requires address of the
window widget, how do i get the address of the window widget when the window
is started by ‘phditto’?

“Wojtek Lerch” <Wojtek_L@yahoo.ca> wrote in message
news:d2h4ae$f1$1@inn.qnx.com

Ran Zhang wrote:
I’m using Qnx4.25, Photon 1.14, I need a way to bring windows back and
forth, same as alt-f2 and alt-f3 do with PWM, all i can find
is PtWindowToFront() and PtWindowToBack(), both needs the address of the
window widget. Unfortunately, I dont have the address
of the window widget, since they are windows started by ‘phditto’.

Use PtForwardWindowEvent().

Ran Zhang wrote:

PhWindowEvent_t requires RID (region id of the affected region), only
way to get RID is using PtWidgetRid() which still requires address of the
window widget, how do i get the address of the window widget when the window
is started by ‘phditto’?

The widget and its address are only valid in the process that created
the widget, if any (it’s possible to open a window without creating a
PtWindow widget). But there are ways to find the RID without having to
be the process that owns the widget.

One simple way is to spawn phin and parse its output. Something like
popen( “phin -h -Pphditto”, “r” ) should make it pretty easy.

If you can’t afford the overhead of spawning a process (two processes,
if you use popen()), you could also do the work youself. You can use
PhQueryRids() and/or PhRegionQuery() to find the RIDs of all the windows
in your Photon session. What to do next depends on what you know about
the window you’re looking for. Do you know the pid of the phditto
you’re interested in? PhGetConnectInfo() can tell you the pid of the
owner of a region. If all you know is that the owner is a program
called “phditto”, then you’ll need to use some magic devctls to find the
program name based on the pid. This stuff is not very well documented,
but there’s a code sample in the docs that does just that. It’s in

QNX Neutrino RTOS 6.3
Programmer’s Guide
Processes
Detecting process termination
Detecting dumped processes

Look at the function called display_process_info().


You may also find some useful information in the sources to pidin:

http://cvs.qnx.com/cgi-bin/cvsweb.cgi/utils/p/pidin/

Yes, I know the pid of the phditto since i spawn it, I can bring phditto
back and forth now with PtWindowForwardTaskEvent() which only requires the
pid.
thank you for your help.
“Wojtek Lerch” <Wojtek_L@yahoo.ca> wrote in message
news:d2h80l$f1$2@inn.qnx.com

Ran Zhang wrote:
PhWindowEvent_t requires RID (region id of the affected region),
only
way to get RID is using PtWidgetRid() which still requires address of
the
window widget, how do i get the address of the window widget when the
window
is started by ‘phditto’?

The widget and its address are only valid in the process that created
the widget, if any (it’s possible to open a window without creating a
PtWindow widget). But there are ways to find the RID without having to
be the process that owns the widget.

One simple way is to spawn phin and parse its output. Something like
popen( “phin -h -Pphditto”, “r” ) should make it pretty easy.

If you can’t afford the overhead of spawning a process (two processes,
if you use popen()), you could also do the work youself. You can use
PhQueryRids() and/or PhRegionQuery() to find the RIDs of all the windows
in your Photon session. What to do next depends on what you know about
the window you’re looking for. Do you know the pid of the phditto
you’re interested in? PhGetConnectInfo() can tell you the pid of the
owner of a region. If all you know is that the owner is a program
called “phditto”, then you’ll need to use some magic devctls to find the
program name based on the pid. This stuff is not very well documented,
but there’s a code sample in the docs that does just that. It’s in

QNX Neutrino RTOS 6.3
Programmer’s Guide
Processes
Detecting process termination
Detecting dumped processes

Look at the function called display_process_info().


You may also find some useful information in the sources to pidin:

http://cvs.qnx.com/cgi-bin/cvsweb.cgi/utils/p/pidin/