AppCtrlScript

MAY Computer

Help

BEGINFOREGROUNDACTION

Applies to  

AppCtrlScript (Module: wmACScr1.dll)

Group  

Other

See also  

ENDFOREGROUNDACTION, ACTIVATEWINDOW

Ensures that Windows recognizes the current process being the active one so that windows opened or dialogs displayed by the current process get in the foreground.

This command is usually needed if you display e.g. a message box or dialog from within your script and the appropriate window is shown in background behind other (currently open and active) windows.

Very important: After every BEGINFOREGROUNDACTION call there must be as soon as possible a call to ENDFOREGROUNDACTION. And you must ensure that BEGINFOREGROUNDACTION is not called twice before a call to ENDFOREGROUNDACTION. If you not follow these rules you might experience system instability.

So do the following:

SUB Main
  MyinitializationStuff
  SomeOtherStuff
  BEGINFOREGROUNDACTION
  MSGBOX "MyMessage"
  ENDFOREGROUNDACTION
  MyFinalizingStuff
END SUB

and NOT:

SUB Main
  BEGINFOREGROUNDACTION
  MyinitializationStuff
  SomeOtherStuff
  MSGBOX "MyMessage"
  MyFinalizingStuff
  ENDFOREGROUNDACTION
END SUB

 

Syntax

BEGINFOREGROUNDACTION