Instructions: Configure the following C actions in a picture in combination with different buttons:
- Action for login (for example, "mouse click" event):
#pragma code ("useadmin.dll")
#include "PWRT_api.h"
#pragma code()
PWRTLogin('c');
- Action for logout (for example, "mouse click" event):
#pragma code ("useadmin.dll")
#include "PWRT_api.h"
#pragma code()
PWRTLogout();
The parameter for PWRTLogin must be a CHAR character. It specifies on which monitor the dialog is displayed. If you are only using one screen, then you can leave the default parameter "c", or specify "1".
Note: You can also use the function PASSLoginDialog instead of the functions PWRTLogin or PWRTLogout. This function requires the same parameters as the PWRTLogin function. The functions PWRTLogin and PASSLoginDialog call the login mask, where you can log in or log out. The function PWRTLogout is executed directly and does not call the login mask.
Both functions return "1" if they are executed correctly. However, the login does not wait to see if the dialog is really displayed.
Note:
If you are using more than one monitor, you need WinCC Basic Process Control(OS Project Editor), so that the Login dialog is displayed on the appropriate monitor.
You can also specify a monitor number without Basic Process Control, but the Login dialog then always appears on the first monitor.
Keywords:
Programming tips
|