Product: | Elvis |
Version: | from 2.0 |
Booth: | 2002-07-25 |
Summary
In the Elvis operator station from version 2.0, it is possible to switch users via the menu without terminating the operator station. However, the menu is not accessible in kiosk mode (locked full-screen display). To ensure that a user change is still possible, the subsequent event processing of the operator station can be used.
Details
General:
In a calculation, a message can be sent to Elvis that simulates a menu command. In principle, this means that all operations of the operator station that can be triggered via a menu can be triggered. The operation necessary for our purpose is to open the login dialog. Therefore, we send a message corresponding to a menu command (WM_COMMAND = &H0111) with the identification number (ID) of the command to open the login dialog (ID_ELVISRUN_LOGIN = 35000).
Procedure (in Elvis configuration):
1. Several users must be created (of course, otherwise the user cannot be changed).
2. In order for the user change to be triggered, a control element (e.g. StateButtonControl) should be created on a page. In principle, however, any other event can be used to cause the user change. The name of the control should be “User Switch” (on the “Control Item” property page).
3. Open the editor for processing the event of the page (properties dialog of the page>Events…).
4. A page event processing of the operator station is created for the Click event on the “User switch” control element, which looks like this:
CODE:vb:Declare Function GetActiveWindow Lib “user32” () As Long
Declare Function PostMessage Lib “user32” Alias “PostMessageA” (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function GetLastError Lib “kernel32” () As Long
Const WM_COMMAND = &H0111
Const ID_ELVISRUN_LOGIN = 35000
Sub Benutzerwechsel_Click()
‘ Post a WM_COMMAND with ID_ELVISRUN_LOGIN to the main window
Dim hwnd As Long
hwnd = GetActiveWindow()
If PostMessage(hwnd, WM_COMMAND, ID_ELVISRUN_LOGIN, 0&) = 0 Then
MsgBox “PostMessage failed: ” & GetLastError()
End If
End Sub //CODE
ATTENTION – Please download this script as a change_user.txt (2 KB) and then paste it into the page event processing via the clipboard.
Please do not copy from the web – this may contain special characters that lead to malfunctions!