Troubleshooting
Why a WinCC login button does nothing when the hotkey works
Short answer
If the configured Login hotkey opens the password dialog but a button bound to a PWRTLogin C action does nothing, the user database and authentication path are fine. The fault is in the button's mouse-click action or Runtime script execution: confirm the event binding, check whether other scripts run, test the PWRT action and the PASSLoginDialog alternative one at a time, and read the error under APDIAG.

On this page
When the configured Login hotkey opens the password dialog in WinCC Runtime but a button whose mouse-click action calls PWRTLogin('c') does nothing, the user database and the interactive authentication path are already proven good. Do not touch User Administrator, the hotkey table or the accounts. The fault sits in one of three places: the mouse-click event is not bound to the action you think it is, Runtime script execution is broken for that action, or the code itself fails to compile or link. Work through the checks below in order and test one variant at a time.
Confirm what the hotkey already proved #
Start Runtime, press the Login hotkey configured under WinCC Explorer in Project Properties on the Hotkey tab, and enter a login name and password. WinCC compares the user's assigned authorizations with those the editors and installed components require, then unlocks the permitted functions. When that sequence works, the account, the password and the authorization check are all fine. Note which key combinations open login and logout, because you will use them as the control test after every change to the button.
Check the event binding first #
Open the button's properties in Graphics Designer and confirm that the action is attached to the mouse-click event of that specific object, not to another event such as mouse-down or press, and not to a button sitting on a lower layer or inside a different picture. Overlapping objects are a classic cause: an invisible faceplate or a grouped object above the button receives the click. Move the button to the top layer and test again. A click that never reaches the object explains a dead button while every script in the project still runs.
Verify that script execution works at all #
Check whether other C scripts and VBS scripts in the same application execute in Runtime. If they do, Runtime script execution is healthy and the problem is inside this action. If they do not, fix script execution for the whole project before touching the login code; for runtime-wide script backlog rather than a single failing action, the diagnosis differs, and monitoring the action queue without APDIAG is covered in an article on WinCC action queue depth. Run the affected action under APDIAG and read the reported script error before changing any code.
Test the documented PWRT actions #
The documented C action for the login button, on the mouse-click event, is:
#pragma code ("useadmin.dll")
#include "PWRT_api.h"
#pragma code()
PWRTLogin('c');
The matching logout action calls PWRTLogout(); after the same pragma block and include. Test login and logout on separate buttons so one result does not hide the other. Compile the action in the editor, confirm the compile returns no error, save the picture, and restart Runtime, because an action edited while Runtime is open is not guaranteed to reload until the picture or the Runtime restarts. Then click the button.
One engineer restored a dead logout action by adding a semicolon after the closing pragma line, so it read #pragma code();. That is one reported case, not a documented rule: compile both forms in the affected project and keep the one that works. Do not treat the semicolon as a universal fix, and do not add it to actions that already compile and run.
Test the dialog-based alternative separately #
If the PWRT action still does nothing while it compiles clean and other scripts run, bind this alternative to a fresh button and test it alone:
#pragma code("pdlrtapi.dll")
#include "pdlrtint.h"
#pragma code()
if ( SSMIsUserNameEnable( lpszPictureName ))
{
PDLRTAllowSetForegroundWindow(NULL,NULL,NULL);
PASSLoginDialog (SSMGetScreen( lpszPictureName ));
}
This action checks whether the user-name function is enabled for the current picture, lets the Runtime window come to the foreground, and opens the password login dialog on the screen that belongs to the picture. It requires the user-name display to be enabled for that picture, so if SSMIsUserNameEnable returns false the action exits silently and the button appears dead. Never combine this code with the PWRT action in one event: one implementation per button, compiled and tested on its own.
Do not use PWRTSilentLogin as a diagnostic. It was tried in the same failing project without resolving the button, and its prerequisites are not established here, so its result proves nothing about whether button scripting works.
The decision tree #
- Hotkey login and logout both work: the accounts and authentication are good; stop looking at User Administrator.
- No scripts run in Runtime: fix project-wide script execution first; the login code is not the problem.
- Other scripts run but this button does nothing and APDIAG reports an error: fix the reported error in that action.
- Other scripts run, APDIAG reports nothing, and the click never fires: the event binding or an overlapping object is at fault; rebind to mouse-click on the top layer.
- The PWRT action stays dead while everything else checks out: switch the button to the PASSLoginDialog action and verify the user-name function is enabled for the picture.
Test after each change with the hotkey as the control: if the hotkey keeps working and the button changes behavior, you are editing the right thing.
Questions asked
How do I open the WinCC Runtime login dialog from a button?
Bind a C action to the button's mouse-click event that loads useadmin.dll, includes PWRT_api.h, closes the pragma block, and calls PWRTLogin with the character 'c'. Save, compile, restart Runtime, and click the button. If the dialog still does not appear, test the dialog-based PASSLoginDialog action on its own button.
Does the closing pragma line need a semicolon?
One engineer restored a logout action by adding a semicolon after the closing pragma code line, and no documentation makes it a rule. Compile the action both ways in the affected project and keep the form that works; the semicolon is a test, not a fix you should apply everywhere.
Why does the login hotkey work while the button stays dead?
The hotkey path proves the user accounts and the authentication dialog function, so the fault is isolated to the button's event binding or Runtime script execution. Check that the mouse-click event actually carries the C action, confirm other scripts in the same project run, and open the action's error under APDIAG.
Where do I configure the Login hotkey in WinCC?
Open WinCC Explorer, go to Project Properties and the Hotkey tab, and assign a key combination to the Login function. That combination opens the password dialog during Runtime and is the quickest way to prove that accounts, authorizations and the dialog itself all work before you debug a button action.

