` Printed Icetips Article

Icetips Article



Par2: Check for multiple instances of a program
1998-02-07 -- Steven Gallafent
 
You need to make three additions under global embeds:

At "Inside the Global Map" add:
  MODULE('WINAPI')
FindWindow(<*CSTRING>,*CSTRING),UNSIGNED,PASCAL,RAW,
                     NAME('FindWindowA')
    SetForegroundWindow(UNSIGNED),SIGNED,PASCAL
  END

At "Global Data" add:
  FindWindowName     CSTRING(50)
  FindWindowHandle   UNSIGNED

At "Program Setup" add:
  FindWindowName = 'Peoples Favorite Colors'
  FindWindowHandle = FindWindow(,FindWindowName)
  IF FindWindowHandle
    SetForegroundWindow(FindWindowHandle)
    DctKill                !Omit these two lines if not using ABC templates
    GlobalErrors.Kill  !Omit these two lines if not using ABC templates
    RETURN
  END



Printed April 30, 2024, 6:50 am
This article has been viewed/printed 35108 times.