Dan,
I've been doing 'sticky windows' where Windows remember where they were when they were last closed and reopen there.
In my app I have 80 different windows. I store the coordinates of those windows in arrays in COMMON. Each dialog 'knows' which number it is. In this example, subroutine POP is No. 75.
SUBROUTINE POP(TEXT)
C --------------------
C
C Pops up the text message sent as a parameter with an 'Oops'
C caption, denoting some sort of error. The box will pop up where
C the previous POP box was.
C .
C -----------------------------------------------------------------
C .
INCLUDE <WINDOWS.INS>
INTEGER, EXTERNAL :: GET_POSITION_FN
CHARACTER*(*) TEXT
COMMON/PLACE/ IWINDPOS_X(80), IWINDPOS_Y(80)
COMMON/STICKY/ NPOS, KHAND
C .
NSAVE = NPOS
KSAVE = KHAND
IA = WINIO@('%ca[Oops!]&')
IA = WINIO@('%bg[white]&')
C
NPOS = 75
IA = WINIO@('%sp&', IWINDPOS_X(NPOS), IWINDPOS_Y(NPOS))
IA = WINIO@('%hw%cc&', KHAND, GET_POSITION_FN)
CALL SET_FONT_INFO
C
IA = WINIO@('%cn%si!'//TEXT//'&')
IA = WINIO@('%2nl%cn%`7bt[OK]')
KHAND = KSAVE
NPOS = NSAVE
C
RETURN
END
You have to store the previous handle and dialog box type or you get in a muddle.
INTEGER FUNCTION GET_POSITION_FN()
C ----------------------------------
C
C ... called on closure control %cc of a sticky window to get final
C position, so window can be restored there when next opened.
C
C ------------------------------------------------------------------
COMMON /PLACE/ IWINDPOS_X(80), IWINDPOS_Y(80)
COMMON /STICKY/ NPOS, KHAND
COMMON /FOR_NOW/ NSCREEN, IXSCRN, IYSCRN
INCLUDE <WINDOWS.INS>
C ------------------------------------------------------------------
CALL GET_WINDOW_LOCATION@ (KHAND, IX, IY, IWID, IHT)
IF (NPOS .GT. 0 .AND. NPOS .LE. 80) THEN
IF (IX .GE. 1 .AND. IX .LE. IXSCRN-100) THEN
IWINDPOS_X(NPOS) = IX
ELSE
IWINDPOS_X(NPOS) = 100
ENDIF
IF (IY .GE. 1 .AND. IY .LE. IYSCRN-100) THEN
IWINDPOS_Y(NPOS) = IY
ELSE
IWINDPOS_Y(NPOS) = 100
ENDIF
ENDIF
GET_POSITION_FN = 0 ! Guarantees continue to exit
RETURN
END
continued ...