[comp.sys.amiga] Question on System Request

aggaton@diku.dk (Klavs Torben Pedersen) (11/19/90)

  Hi!

     I've got a C programming question, that have been bothering me for some 
time now... I open a screen and a standard window on it, next I attach a console
to the window, all this goes fine, until I begin to access the disks...Suddenly
the screen is changed, and the system request window is shown "Please insert"
bla. bla. bla. How the f*&^$ can I make this Bl*&^% requester to pop up on MY
window?????
     I sincerely hope you can help me with this for me irritating (for you probably
simple) problem...
							Klavs Torben Pedersen
							aggaton@diku.freja.dk

zerkle@iris.ucdavis.edu (Dan Zerkle) (11/20/90)

In article <1990Nov19.151458.7631@diku.dk> aggaton@diku.dk (Klavs Torben Pedersen) writes:
>     I've got a C programming question, that have been bothering me for some 
>time now... I open a screen and a standard window on it, next I attach a console
>to the window, all this goes fine, until I begin to access the disks...Suddenly
>the screen is changed, and the system request window is shown "Please insert"
>bla. bla. bla. How the f*&^$ can I make this Bl*&^% requester to pop up on MY
>window?????

According to the 1.3 Rom Kernel Manual, Libraries and Devices:

System requester are invoked by the operating system; your program has
no control over these.  For example, someone using a text editor might
try to save a file to disk when there is no disk in the drive.  The
system requester comes up and makes sure the user understands the
situation and requests a response from the user.

In other words, you're screwed.  However, I'm sure there's some hack
floating around out there to let you do this, even if it is probably
ugly and nonstandard and will break under the next OS release....

Good luck!

           Dan Zerkle  zerkle@iris.eecs.ucdavis.edu  (916) 754-0240
           Amiga...  Because life is too short for boring computers.

barrett@jhunix.HCF.JHU.EDU (Dan Barrett) (11/20/90)

>In article <1990Nov19.151458.7631@diku.dk> aggaton@diku.dk (Klavs Torben Pedersen) writes:
>>How the f*&^$ can I make this Bl*&^% requester to pop up on MY
>>window?????

In article <7997@ucdavis.ucdavis.edu> zerkle@iris.ucdavis.edu (Dan Zerkle) writes:
>System requester are invoked by the operating system; your program has
>no control over these.
>In other words, you're screwed.

	I think that Klavs is asking how to REDIRECT requestors to HIS 
screen, rather than having them pop up on a different screen (notably
the Workbench screen).  This is easy to do.  Find the appropriate
pointer, save the old value, and repoint it at YOUR window.  When your
program exits, restore the old value.  To disable requestors completely,
give the pointer the value -1.

struct Process *proc;
APTR oldWindowPointer;

DisableRequestors(&proc, &oldWindowPointer);
...do stuff...
EnableRequestors(proc, oldWindowPointer);

/* Turn off system requestors for this process. */

void DisableRequestors(struct Process **proc, APTR *oldWindowPtr)
{
	*proc = (struct Process *)FindTask(NULL);	(* find process *)
	*oldWindowPtr = (*proc)->pr_WindowPtr;		(* save old pointer*)
	(*proc)->pr_WindowPtr = (APTR)(-1L);		(* turn off req's *)
}

/* In the above function, you could send requestors to YOUR window
 * instead with:
 *
 *	(*proc)->pr_WindowPtr = (APTR)myWindow;
*/

/* Turn on system requestors for this process, after they have been
 * turned off by DisableRequestors(), above. */

void EnableRequestors(struct Process *proc, APTR oldWindowPtr)
{
	proc->pr_WindowPtr = oldWindowPtr;
}

                                                        Dan

 //////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
| Dan Barrett, Department of Computer Science      Johns Hopkins University |
| INTERNET:   barrett@cs.jhu.edu           |                                |
| COMPUSERVE: >internet:barrett@cs.jhu.edu | UUCP:   barrett@jhunix.UUCP    |
 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////

ken@cbmvax.commodore.com (Ken Farinsky - CATS) (11/21/90)

In article <7997@ucdavis.ucdavis.edu> zerkle@iris.ucdavis.edu (Dan Zerkle) writes:
>In article <1990Nov19.151458.7631@diku.dk> aggaton@diku.dk (Klavs Torben Pedersen) writes:
>>...open a screen and a standard window on it...begin to access the disks...
>>the screen is changed, and the system request window is shown "Please insert"
>>bla. bla. bla. How the f*&^$ can I make this Bl*&^% requester to pop up on MY
>>window?????
>
>According to the 1.3 Rom Kernel Manual, Libraries and Devices:
>System requester are invoked by the operating system; your program has
>no control over these...In other words, you're screwed....
>
>           Dan Zerkle  zerkle@iris.eecs.ucdavis.edu  (916) 754-0240


You can control the DOS error requesters by setting the pr_WindowPtr
variable in the process structure.  Setting it to zero causes error
requesters to appear on the workbench screen (default behavior.)
Setting it to -1 causes the requesters to not appear, with the
error returned to the program.  Or you can put a pointer to a window
in it, and the requester should appear in that window (or at least
on the same screen as the window.)  This is documented in "The
AmigaDOS Manual" by Bantam Books, ISBN 0-553-34294-0.  It is near
the end, in the section on AmigaDOS Data Structures.
-- 
--
Ken Farinsky - CATS - (215) 431-9421 - Commodore Business Machines
uucp: ken@cbmvax.commodore.com   or  ...{uunet,rutgers}!cbmvax!ken
bix:  kfarinsky

ridder@elvira.enet.dec.com (Hans Ridder) (11/21/90)

In article <1990Nov19.151458.7631@diku.dk> aggaton@diku.dk (Klavs Torben Pedersen) writes:
> I open a screen and a standard window on it, next I attach a console to
>the window, all this goes fine, until I begin to access the
>disks...Suddenly the screen is changed, and the system request window is
>shown "Please insert" bla. bla. bla. How the f*&^$ can I make this
>Bl*&^% requester to pop up on MY window?????

Normally I'd just answer the question and let it go, but I find the tone
of your request a bit obnoxious.  So...try reading the f*&^$ing manual!

There, I feel better.  You have to set the pr_WindowPtr field of your
process structure to point to your Window.  Remember to save the old
value and set it back before your program exits.

>							Klavs Torben Pedersen
>							aggaton@diku.freja.dk

-hans
------------------------------------------------------------------------
  Hans-Gabriel Ridder			Digital Equipment Corporation
  ridder@elvira.enet.dec.com		Customer Support Center
  ...decwrl!elvira.enet!ridder		Colorado Springs, CO

dewolfe@ug.cs.dal.ca (Colin DeWolf) (11/21/90)

In article <7997@ucdavis.ucdavis.edu> zerkle@iris.ucdavis.edu (Dan Zerkle) writes:
>In article <1990Nov19.151458.7631@diku.dk> aggaton@diku.dk (Klavs Torben Pedersen) writes:
>>     I've got a C programming question, that have been bothering me for some 
>>time now... I open a screen and a standard window on it, next I attach a console
>>to the window, all this goes fine, until I begin to access the disks...Suddenly
>>the screen is changed, and the system request window is shown "Please insert"
>>bla. bla. bla. How the f*&^$ can I make this Bl*&^% requester to pop up on MY
>>window?????
>
>According to the 1.3 Rom Kernel Manual, Libraries and Devices:
>
>System requester are invoked by the operating system; your program has
>no control over these.  For example, someone using a text editor might
>try to save a file to disk when there is no disk in the drive.  The
>system requester comes up and makes sure the user understands the
>situation and requests a response from the user.
>
>In other words, you're screwed.  However, I'm sure there's some hack
>floating around out there to let you do this, even if it is probably
>ugly and nonstandard and will break under the next OS release....
>
Not according to my 1.3 RKM, L's and D's

On page 138, (reprinted without permission of course):
	System requests appear on the workbench screen by default. They can be
	made to appear on custom screens by changing the WindowPtr field of
	Process structure to point to a window on a custom screen  The original
	value of WindowPtr should be cached and restored before the window is
	closed.

There you have it.  I wonder if I can get in trouble reciting from the RKM's?

Colin DeWolfe
dewolfe@ug.cs.dal.ca
dewolfe@iris1.ucis.dal.ca

>           Dan Zerkle  zerkle@iris.eecs.ucdavis.edu  (916) 754-0240
>           Amiga...  Because life is too short for boring computers.

aggaton@diku.dk (Klavs Torben Pedersen) (11/28/90)

dewolfe@ug.cs.dal.ca (Colin DeWolf) writes:

>In article <7997@ucdavis.ucdavis.edu> zerkle@iris.ucdavis.edu (Dan Zerkle) writes:
>>In article <1990Nov19.151458.7631@diku.dk> aggaton@diku.dk (Klavs Torben Pedersen) writes:
>>>     I've got a C programming question, that have been bothering me for some 
>>>time now... I open a screen and a standard window on it, next I attach a console
>>>to the window, all this goes fine, until I begin to access the disks...Suddenly
>>>the screen is changed, and the system request window is shown "Please insert"
>>>bla. bla. bla. How the f*&^$ can I make this Bl*&^% requester to pop up on MY
>>>window?????
>>
>>According to the 1.3 Rom Kernel Manual, Libraries and Devices:
>>
>>System requester are invoked by the operating system; your program has
>>no control over these.  For example, someone using a text editor might
>>try to save a file to disk when there is no disk in the drive.  The
>>system requester comes up and makes sure the user understands the
>>situation and requests a response from the user.
>>
>>In other words, you're screwed.  However, I'm sure there's some hack
>>floating around out there to let you do this, even if it is probably
>>ugly and nonstandard and will break under the next OS release....
>>
>Not according to my 1.3 RKM, L's and D's

>On page 138, (reprinted without permission of course):
>	System requests appear on the workbench screen by default. They can be
>	made to appear on custom screens by changing the WindowPtr field of
>	Process structure to point to a window on a custom screen  The original
>	value of WindowPtr should be cached and restored before the window is
>	closed.

>There you have it.  I wonder if I can get in trouble reciting from the RKM's?

   Thanks a lot everybody, a stone fell off my heart.

About the RKM L's D's. My question actually originated in the above passage.
And it mentions nothing about the Process struture :) It just, merely,
summarizes (what we all know), why requesters have a right to exists. Perhaps
my edition has a bug. (It has least one more, since half of a listing is
missing, about menus I think)...
I'm sorry about my harsh tone in my previous letter, but I just felt lost,
panicked and in every way irritated :)
					-Klavs Pedersen

      -If you are outside inside, you are at least inside outside-

ken@cbmvax.commodore.com (Ken Farinsky - CATS) (12/07/90)

In article <1990Nov27.191811.5808@diku.dk> aggaton@diku.dk (Klavs Torben Pedersen) writes:
>About the RKM L's D's. My question actually originated in the above passage.
>And it mentions nothing about the Process struture :) It just, merely,
>summarizes (what we all know), why requesters have a right to exists.

To get information on using DOS, you need "The AmigaDOS Manual" (Bantam Books).
The information was not included in the Addison Wesley manuals for
contractual reasons.

>Perhaps my edition has a bug. (It has least one more, since half of a
>listing is missing, about menus I think)...

There is a listing in Libraries & Devices that looks like it falls off of the
end of the page, with the next page being blank.  In reality, it is only
missing two closing braces ('}').

>					-Klavs Pedersen

-- 
--
Ken Farinsky - CATS - (215) 431-9421 - Commodore Business Machines
uucp: ken@cbmvax.commodore.com   or  ...{uunet,rutgers}!cbmvax!ken
bix:  kfarinsky