home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
pocketbk
/
utilsm
/
np52
/
SIGNAL.OPL
< prev
next >
Wrap
Text File
|
1995-06-06
|
2KB
|
58 lines
/* This example shows how to send an IPC message to Notepad
The message resides in a temp file called M:\Npmess.000
Each field in this file carries part of the message for Notepad.
a.mess$ = Filename
a.typ$ = "O" or "C" (Open or Create)
a.front$ = Tells Notepad to come to front before acting
There are two types of messages currently supported.
. Open/Create Notepad file
. Run Plug-in
When sending an open file message, you must supply the complete filename
in a.mess$. You must also supply the type byte "O" or "C", for Open or
Create. Notepad needs to know if it is creating a new notepad, or just
opening one.
When sending a run Plugin message, just put the name of the plugin in
a.mess$, without any path, or extension. (like Np2wrd) That's it.
*/
Proc signal:
local name$(12),z$(1),sspid%,messtyp%
local fc$(128),ch%,front%,off%(6)
z$=chr$(0)
fc$="\note\expand\*.exp"
dinit
dtext"","Send a Message to Noteapd",$302
dchoice messtyp%,"Message Type","Open/Create File,Run Plug-In"
dfile fc$,"Filename",1
dchoice ch%,"Choose","Open,Create"
dchoice front%,"Bring Notepad to Foreground","No,Yes"
if dialog =0 :return :endif
if messtyp%=2
fc$=parse$(fc$,"",off%())
fc$=mid$(fc$,off%(4),off%(5)-off%(4))
endif
trap delete "M:\Npmess.000"
create "M:\Npmess.000",a,mess$,typ$,front$
front%=front%-1 rem (zero = false) (1 = true)
if ch%=1 :a.typ$="O" :else a.typ$="C" :endif
a.mess$=fc$ :a.front$=fix$(front%,0,2)
append :close
name$="notepad.*"+z$
sspid%=call($0188,addr(name$)+1,0,0,0,0)
if call($8c8d,sspid%)>=0
call($92,sspid%,2,0,addr(messtyp%),$28) rem ProcCopyToById
call($0986,sspid%) rem IoSignalByPid
endif
Endp