C (283/304)

From:Colin Wenzel
Date:31 Aug 2000 at 16:25:35
Subject:OS3/3.5 Workbench Test.

This may be a semantical problem that has poped up,
but I would like to uncover any posible side effects...

I have written a small "batch file" program to
do "Some Stuff" (TM) when any disk is changed.

It is called "WaitDiskChange" which halts the execution
of a batch file until a disk is changed, rather than polling
with "wait" command or some other hackish method...

To get the global DISKINSERTED & DISKREMOVED
messages, I opened a 1 pixel window on the WB screen,
this initialises my message port & makes life a little easier.

The only problem I had was if I "run >nil: s:batchfile"
from the user startup or where ever, when it opens
it's 1 pixel window, it stops iprefs/loadwb from doing it's stuff...

Now the solution I found was to do a:

while( ! FindPort("WORKBENCH"))
Delay(50L);

until it found it, Presto !!, no more problems,
UNTIL I tried it on a WB3.1 installation......

WB3.1 doesn't have a port called "WORKBENCH", Hmmmm.....
So I did a: FindTask("Workbench") instead,
as the "Workbench" task exists on both OS versions....

The problem is, it seems a "messy" way of doing this.....

Is there a SIMPLE way of getting a message port up to receive
diskchange messages without opening a window in the first place...

Enclosed is my source code.......

Regards



_________________________________________

Colin Wenzel. Australia.

EMAIL: colstv@hotkey.net.au
URL: http://www.hotkey.net.au/~colstv/
ICQ: 17608330
AMIGA: 4000T, 68060/50, 150Mb RAM,
OS 3.5, Spectrum Gfx Card.

Need an Image Generator For CATV ??
http://connect.to/products
_________________________________________