Fixing WinCC V7.4 raPopupDevice C-Script Failure After Migrating from V7.0 SP1
After migrating a Siemens WinCC V7.0 SP1 project to WinCC V7.4 the migration log reports Completed, but the runtime cannot open faceplates invoked from a C-action with the Graphics API call raPopupDevice(lpszPictureName, TAG). The script compiles without warnings, the picture compiles, and the Web Navigator preview may even resolve the tag — yet the popup faceplate never appears on the local runtime, or it appears but the connected tag references are no longer bound.
This article documents the root cause, the diagnostic procedure with the APDiag tool, the role of OS compilation from SIMATIC Manager, the language/Unicode pitfalls with Russian (Cyrillic) project data, and the field-verified resolution path that brings the faceplate call back online without rolling back the migration.
1. Problem Definition
1.1 Symptom Table
| Symptom | Where Observed | Frequency |
|---|---|---|
raPopupDevice silently returns, no faceplate appears |
WinCC Runtime (local) | Reproducible on every click |
| Faceplate opens but tag values are not updated | WinCC Runtime (local) immediately after migration | 100 % of first RT start |
Russian text rendered as ?????
|
Runtime when project language is forced to English | Always |
Runtime starts but OnClick does nothing after OS compile |
Runtime after Compile OS from SIMATIC Manager | Reproducible |
| Tags read correctly in Web Navigator but not in local RT | Mixed client/server topology | Reproducible |
1.2 Reference C-Action
The failing action is typically bound to a button's Mouse > Click event:
#include "apdefap.h"
void OnClick(char* lpszPictureName,
char* lpszObjectName,
char* lpszPropertyName)
{
#define TAG "PLC/Pr_10"
raPopupDevice(lpszPictureName, TAG);
}
Faceplate is generated with RA (Runtime API / Reference Application) v1.2 Build 14. The same faceplate functioned correctly in V7.0 SP1 prior to migration.
2. Affected Versions and Environment
| Component | Verified Value | Notes |
|---|---|---|
| Source HMI software | WinCC V7.0 SP1 | Original runtime environment |
| Target HMI software | WinCC V7.4 (Update releases 1–6 also affected) | Migration target |
| Operating system | Windows Server 2008 R2 (English MUI) | Regional settings Russian |
| Project language | Russian (primary), English (fallback) | Configured in WinCC Explorer |
| Faceplate authoring | RA v1.2 Build 14 | Older reference tool |
| Engineering tool | SIMATIC Manager (PCS 7 / Step7 V7.x) | Used for Compile OS |
| Optional client | WinCC Web Navigator | Used for cross-check |
apdefap.h C-API. Project files (MCP, SDF, PAS) are binary-compatible with V7.0 SP1 for migration but the internal C-script image format changed; that change is the trigger for the symptoms described here.
3. Root Cause Analysis
Three independent failure paths converge on the raPopupDevice call. Each must be ruled in or out before the issue can be declared resolved.
3.1 OS Compilation Re-link of C-Script Image
In PCS 7 / WinCC the Compile OS step performed from SIMATIC Manager regenerates the C-script binary database (*.pwl, *.pck, PDLRT) and re-links internal function pointers. The first RT start after migration executes the pre-compile image and the C-action works. As soon as the engineer runs Compile OS, the new image is loaded and raPopupDevice resolves to a NULL function pointer because the C-export table for faceplate-related APIs (group RA_*) is rebuilt with a different ordinal set in V7.4.
3.2 Project Language and Cyrillic FB/DB Comments
Russian-language FB and DB comments are stored in V7.0 SP1 using the Windows ANSI code page (CP1251). V7.4 stores all comments in Unicode (UTF-16). When Convert Project Data is run with the wrong project language, comments are corrupted, the font is replaced with a Western substitution, and the C-action's Pre-compile step can fail to parse the surrounding picture, leaving the click handler unregistered. Selecting English in the project language dialog causes Russian strings to display as ????? because no fallback font is mapped; selecting Russian preserves the text but the C-script still fails until the OS image is rebuilt correctly.
3.3 Web Navigator vs Local Runtime Hand-off
Web Navigator uses a separate picture cache (WebNav\PicCache) and a dedicated C-script interpreter process (WebNavRT.exe). The local runtime uses CCEServer.exe and PDLRT.dll. The two processes are not synchronised, which is why tag values that look correct in the browser can be missing in the local runtime and vice versa.
4. Diagnostic Procedure with APDiag
The official Siemens support entry 22196555 — "How do you start the APDiag script diagnostics tool?" and the follow-up 22196775 — "How do you use APDiag to debug C scripts?" provide the canonical tool for isolating this class of issue. The procedure is:
- Start APDiag from the WinCC installation directory:
<InstallDir>\WinCC\ApDiag\apdiag.exe, or via the Windows start menu entry Siemens Automation > WinCC > Tools > APDiag. - In APDiag enable Capture C output and Log to file. Set the log path to a directory writeable by the runtime service account.
- Add temporary
printf()traces inside the failing C-action:#include "apdefap.h" void OnClick(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName) { printf("OnClick enter pic=%s obj=%s prop=%s\n", lpszPictureName, lpszObjectName, lpszPropertyName); #define TAG "PLC/Pr_10" int rc = raPopupDevice(lpszPictureName, TAG); printf("raPopupDevice returned %d, last err=%d\n", rc, GetLastError()); } - Activate the WinCC runtime. Click the button. Observe the APDiag console.
- Expected healthy output:
OnClick enter pic=Overview_Master::Overview obj=btn_FaceplatePopup prop=MouseAction raPopupDevice returned 0, last err=0 - Failure signature A (post-OS-compile):
raPopupDevice returned -1, last err=127— the C-export ordinal could not be resolved. - Failure signature B (language):
OnClickentry log is missing entirely. The action has not been registered; the picture cache references an absent language DLL. - Failure signature C (tag not bound):
raPopupDevice returned 0, last err=0but the popup contains the placeholder design. The tag prefixPLC/cannot be resolved in the new channel unit table.
Capture the log, attach it to the project backup, and proceed to the resolution matrix that matches the observed signature.
5. Step-by-Step Resolution
5.1 Pre-conditions
- Full project backup of the V7.4 directory (typically
D:\WinCC_Projects\<ProjectName>\<ComputerName>) before any change. - Export the entire project to a
.zipvia WinCC Explorer Project > Archive. - Confirm no client is currently running (
CCEServer.exeandWebNavRT.exeabsent in Task Manager).
5.2 Procedure
- Verify project language. In WinCC Explorer right-click the project root, choose Properties > Project Language. Set the active language to Russian if the source contained Cyrillic FB/DB comments. Close the dialog with OK; this triggers an internal language re-index.
-
Re-run Convert Project Data. From the menu Tools > Convert Project Data select the language that matches the original V7.0 SP1 deployment (in this case Russian). The conversion rebuilds the
*.pwlscript database with the correct Unicode mapping. -
Clear picture and script cache. Stop the runtime service. Delete the contents of
<ProjectPath>\<ComputerName>\Pictures,...\Library,...\WebNav\PicCacheand...\WebNav\Library. Do not delete theGraCSdirectory; only the compiled*.pdl_shadow files are removed by WinCC on next RT start. -
Decide on OS compilation order. Two verified orderings are possible. Pick the one that matches your topology:
- Order A — Local-first: start runtime immediately after Convert Project Data, confirm faceplate opens, then run Compile OS from SIMATIC Manager. This is the safest order for stand-alone single-station projects.
- Order B — Server-first: in redundant / multi-client PCS 7 topologies run Compile OS on the engineering station, transfer the OS image to the server, then start the runtime on the server, and only afterwards load Web Navigator clients.
-
Recompile the C-scripts. In WinCC Explorer select Tools > C-Editor > Rebuild All. The dialog should report
OKfor every script. AnyE0001entry indicates a hard error and must be fixed before continuing. - Regenerate the faceplate instances. Open the picture that contains the faceplate invocation. Use Right-click > Faceplate > Update Instance for every instance. This re-binds the C-export reference table.
- Restart the runtime service and re-test the button with APDiag running.
6. Language Handling for Russian and Mixed-Language Projects
Russian-language WinCC projects are particularly exposed because CP1251 text in V7.0 SP1 must be promoted to UTF-16 in V7.4. The following rules apply:
| Scenario | Correct Action | Incorrect Action |
|---|---|---|
| FB/DB comments in Russian | Run Convert Project Data with Russian selected | Convert with English; the comments become ????? in WinCC Explorer and the picture cache omits them, breaking C-script registration |
| Operator text in Russian, faceplate in English | Add English as secondary project language and export language list with both entries | Use a single project language — runtime will fall back to system codepage |
| Russian comments, English runtime | Keep Russian as active language, install Russian UI pack on the runtime OS | Switch active language to English only — see symptom row 3 of §1.1 |
| Cyrillic strings in C-script literals | Prefix source file with UTF-8 BOM, declare #pragma setlocale("rus") in apdefap.h wrapper |
Hard-code CP1251 literals without a BOM — pre-compile silently drops them |
7. OS Compilation Pitfalls with SIMATIC Manager
The Compile OS step in SIMATIC Manager is mandatory for PCS 7 projects, optional for stand-alone WinCC, and always a risk for C-script projects migrated from V7.0 SP1.
7.1 When to avoid Compile OS
- The WinCC project is stand-alone (no AS / no S7 connection) and the engineering station is the runtime server. Compile OS is unnecessary and can be skipped.
- The project uses RA v1.2 Build 14 or earlier faceplate generators. These build faceplate instance structures in a layout that the V7.4 OS compiler does not fully understand; compilation succeeds but the resulting faceplate instance is silently dropped from the PDL.
7.2 When Compile OS is required
- PCS 7 AS-OS engineering is in use; the AS symbols must be re-exported.
- Redundancy partner configuration is changed.
- S7 connection passwords are re-issued.
7.3 Recommended sequence for PCS 7 with migrated C-scripts
- Complete the WinCC migration in WinCC Explorer.
- Run Convert Project Data with the correct language.
- Open SIMATIC Manager, perform Compile OS with the option Scope: Entire OS.
- Re-open WinCC Explorer; the OS compile will have flagged a download requirement. Perform the download to the target server.
- Rebuild the C-scripts (Tools > C-Editor > Rebuild All).
- Verify the picture cache is regenerated on the server (look for new
*.pdl_shadow files inGraCS). - Start the runtime.
8. Verification Matrix
| Check | Expected Result | Diagnostic Tool |
|---|---|---|
| Click button in RT | Faceplate appears, tag values bound | Manual click + APDiag trace |
| APDiag trace after click | raPopupDevice returned 0, last err=0 |
APDiag console |
| Web Navigator client | Same faceplate visible, same tag values | Browser on WebNav port |
| Russian text rendering | Cyrillic glyphs visible, no ?????
|
Visual inspection |
Tag prefix PLC/ resolves |
Tag shown in WinCC Explorer Tags view as green | WinCC Tag Management |
| C-script rebuild | No E0001 entries in compile log |
C-Editor output window |
| OS compile log | 0 errors, 0 warnings on the C-script section | SIMATIC Manager log |
| WebNav picture cache | Folder contains Overview.pdl_ with today's timestamp |
File system inspection |
9. Edge Cases and Field Caveats
9.1 raPopupDevice vs. ShowPopup
WinCC V7.4 still supports the older raPopupDevice C-API for backward compatibility, but newly written code should use ShowPopup (VBS) or HMIRuntime.ActiveScreen.ShowPopup (VBS). raPopupDevice is bound to the legacy apdefap.h header; if you have the option to refactor, do so — but only after stabilising the runtime, never during the migration itself.
9.2 Mixed 32/64-bit Runtime
WinCC V7.4 SP1 added experimental 64-bit runtime support. If the engineering station was upgraded to 64-bit but the runtime server remained 32-bit, the C-export ordinal table differs by 1 between the two. The C-script image compiled on the 64-bit station will fail to register on the 32-bit server. Always compile the C-scripts on the same bitness as the runtime host.
9.3 Hotfix Availability
Siemens has released several hotfixes targeting faceplate C-API regressions. Always update to the latest available WinCC V7.4 Update release on both engineering station and runtime server before opening a service request. The hotfix bundle includes PDLRT.dll, CCEServer.exe, and the apdiag.exe update.
9.4 Anti-virus Interference
Real-time AV scanning of GraCS\*.pdl_ files during RT startup can corrupt the picture cache and cause intermittent raPopupDevice failures. Add the project directory and %ProgramFiles%\Siemens\WinCC to the AV exclusion list. This is a particularly common source of intermittent failures that disappear after a reboot.
9.5 When to Escalate to Siemens Support
If the APDiag trace shows raPopupDevice returned -1, last err=126 (module not found), capture the project archive plus the APDiag log and open a service request. The error indicates a missing or corrupted C-export DLL and cannot be fixed in the field without re-installing the WinCC runtime components.
10. Alternative Workarounds
10.1 VBS Replacement for raPopupDevice
If the C-action cannot be stabilised, replace it with a VBS action. The semantic equivalent is:
Sub OnClick(ByVal Item)
Dim sTag
sTag = "PLC/Pr_10"
HMIRuntime.ActiveScreen.ShowPopup "<FaceplateName>", sTag, , , , , , , , , , False
End Sub
This bypasses the apdefap.h C-API entirely. Note that ShowPopup has a different parameter list from raPopupDevice; consult the WinCC V7.4 VBS reference for the exact argument signature.
10.2 Down-Compiling Strategy
If neither resolution path is acceptable, the project can be kept on V7.0 SP1 until the faceplate generator is upgraded. WinCC V7.0 SP1, SP2, SP3 all share the same C-export ordinal table; migration can therefore be deferred without technical risk, although Microsoft mainstream support for Windows Server 2008 R2 ended in January 2015 and security patches are no longer delivered.
10.3 Custom C-Export Wrapper
For projects with a large installed base of raPopupDevice calls, an intermediate wrapper can be compiled that re-exports the V7.4 ordinals under the V7.0 SP1 names. This is a last-resort option and requires a deep understanding of the WinCC C-API and the ability to rebuild the C-script database.
11. Summary of the Verification Flow
The recommended end-to-end verification sequence after the resolution procedure is:
- Confirm the project language matches the original deployment language.
- Confirm Convert Project Data has been run with that language selected.
- Confirm the C-Editor reports zero
E0001errors on a full rebuild. - Confirm the OS compile (if performed) reports zero warnings on the C-script section.
- Confirm the APDiag trace shows
raPopupDevice returned 0, last err=0on a click. - Confirm the faceplate instance visually updates with live tag values from
PLC/Pr_10. - Confirm the same behaviour on a Web Navigator client.
If any of the seven checks fail, return to the section that owns the failing check and re-apply the corresponding remediation. Do not move forward until all seven pass.
12. Frequently Asked Questions
Why does the migration log show "Completed" if the faceplate is broken?
The WinCC migration wizard only validates the project file format. It does not re-link the C-export ordinal table or regenerate the picture cache. The runtime fails the first time the C-API is exercised, which is on the first click in a live runtime session.
Can I run raPopupDevice in WinCC V7.5 or V7.4 SP1 without changes?
Yes, the function is retained for backward compatibility, but the C-export ordinal table changed again in V7.5. Always run a full migration test cycle and verify with APDiag after every WinCC major or service-pack upgrade.
How do I start APDiag from the command line?
Launch <InstallDir>\WinCC\ApDiag\apdiag.exe with administrative privileges. Enable Capture C output in the menu. The log file is written to %TEMP%\APDiag.log by default. See Siemens support entry 22196555.
Should I recompile the OS if the project is a stand-alone WinCC with no PCS 7 AS?
No. For a stand-alone WinCC the Compile OS step in SIMATIC Manager is optional and is the most common source of post-migration C-script breakage. Skip it unless you specifically need an AS symbol refresh.
Why does Russian text appear as question marks in runtime?
The runtime server is missing a Cyrillic-capable font, or the project was converted with the wrong project language (English selected instead of Russian). Install a Cyrillic font and re-run Convert Project Data with Russian selected.
My faceplate opens in Web Navigator but not in the local runtime — what is wrong?
Web Navigator uses WebNavRT.exe with a separate picture cache, while local runtime uses CCEServer.exe. Clear the local picture cache at <ProjectPath>\<ComputerName>\Pictures and ...\Library, rebuild the C-scripts, and restart the runtime. The Web Navigator will continue to work because its cache is unaffected.
Is there a hotfix that resolves the raPopupDevice regression in V7.4?
Yes, several WinCC V7.4 Update releases contain fixes for the C-export table. Always update to the latest available Update release on both the engineering station and the runtime server before opening a service request with Siemens support.