SCARA, 6-Axis and Modules
Technical Support Notes

Article ID: T1088
Date: 10/9/2002
Product: EPSON RC+ (all versions)
Subject: How to disable Operator Window close

In some applications, you may want to disable the close menu selection and close button on the operator window to prevent the operator from closing the window.

Use the following code in your SPEL+ application.  For example, create a program called "oprclose.prg" and paste the code into it.

To disable the operator window close menu selection and close button:

 
EnableOprClose FALSE

To show the operator window close button:

  EnableOprClose TRUE

Since you must run this code to hide the button, you should use the operator window auto start feature, so that the close button will be closed when the Operator Window is first displayed.

#define GWL_STYLE -16
#define WS_SYSMENU &H80000
#define SWP_DRAWFRAME &H20
#define SWP_NOMOVE &H2
#define SWP_NOSIZE &H1
#define SWP_NOZORDER &H4

Declare FindWindow, "user32.dll", "FindWindowA", (className As String, windowName As String) As Long
Declare GetWindowLong, "user32", "GetWindowLongA"(hwnd As Long, nIndex As Long) As Long
Declare SetWindowLong, "user32", "SetWindowLongA"(hwnd As Long, nIndex As Long, dwNewLong As Long) As Long
Declare SetWindowPos, "user32", "SetWindowPos"(hwnd As Long, hWndInsertAfter As Long, x As Long, y As Long, CX As Long, CY As Long, wFlags As Long) As Long

Function EnableOprClose(enable As Boolean)

  Long hwnd
  Long wstyle

  ' Use the title of your Operator Window set in RC+ Setup | Preferences
  ' The default is "Operator Window"
  hwnd = FindWindow("ThunderRT6FormDC", "Operator Window")
  If hwnd <> 0 Then
    wstyle = GetWindowLong(hwnd, GWL_STYLE)
    If enable Then
      wstyle = wstyle Or WS_SYSMENU
    Else
      wstyle = wstyle And Not WS_SYSMENU
    EndIf
    SetWindowLong hwnd, GWL_STYLE, wstyle
    SetWindowPos hwnd, 0, 0, 0, 0, 0, SWP_DRAWFRAME + SWP_NOMOVE + SWP_NOSIZE + SWP_NOZORDER
  EndIf
Fend

Click here to return to the EPSON Robots home page
The Power of Choice!