1. Problem Statement
Engineers migrating a WinCC V6.2 HMI project to WinCC V7.0 (or later) often encounter a runtime VBScript error the moment a screen tries to flip the sort direction of an AxAlarmControl (the CCAlarmControl ActiveX inserted from the "Controls" tab of Graphics Designer). The script that worked flawlessly under V6.2 fails immediately under V7.0 with a Windows Script Host error dialog reading:
Object doesn't support this property or method: 'control1.MsgCtrlFlags'
The triggering code is the classic V6.2 pattern that toggled ascending/descending sort on the time column of the message list:
' WinCC V6.2 syntax (NO LONGER VALID in V7.0)
control1.MsgCtrlFlags = 0 ' ascending on time column
control1.MsgCtrlFlags = 1 ' descending on time column
Because the property is invoked on the control instance of the inserted ActiveX at runtime, the error is non-fatal to the picture itself (the picture still loads and the alarm list still displays), but any sort logic tied to the control stops working. In many operational screens this is unacceptable because operators lose the ability to see the newest alarm at the top of the list.
Two related concerns appear repeatedly in field escalations:
- The replacement property name for runtime sort direction.
- An alternative to the toolbar "Sort" dialog (Object ID 30), which renders with a font that is too small to be legible on a 22" or 24" panel.
This reference covers both concerns using the WinCC V7.0 SP1 and V7.4 runtime documentation, and provides verified VBScript and C-Script replacements for the removed MsgCtrlFlags property.
MsgCtrlFlags references. The WinCC V6.2 SP3 (and earlier V6.2) property is also documented in the archived V6.2 manual under "Alarm Control - Properties - Runtime".2. Root Cause: MsgCtrlFlags Removed in WinCC V7.0
The CCAlarmControl ActiveX was re-engineered for WinCC V7.0 as part of the larger migration of the alarm subsystem from the legacy WinCC Alarm OCX to the new Alarm Control that exposes the full set of object properties, methods, and events through COM automation. During that re-engineering, the original MsgCtrlFlags property was renamed and the corresponding interface identifier was retired. Scripts referencing the old name are no longer bound to any COM property on the new control and the VBScript host returns the runtime error shown above.
The official Siemens knowledge base entry covering the WinCC V7.0 SP1 AlarmControl function reference (entry ID 37436840) explicitly enumerates the supported functions on the new control — for example AXC_OnBtnComment, used to switch the message window to display messages from the short-term archive list. None of these functions reference the legacy MsgCtrlFlags field, confirming the retirement.
The direct replacement, as documented by the Siemens runtime reference for the new Alarm Control (entry ID 109736220, "Operating the AlarmControl in runtime — WinCC V7.4"), is the DefaultSort property. The same property is exposed in WinCC V7.0 SP1, V7.0 SP2, V7.0 SP3, V7.1, V7.2, V7.3, and all subsequent V7.x releases.
| WinCC Version | Property name (time-column sort) | Status |
|---|---|---|
| WinCC V6.0 / V6.2 |
MsgCtrlFlags (0 = ascending, 1 = descending) |
Valid |
| WinCC V7.0 base | DefaultSort |
Valid — MsgCtrlFlags removed |
| WinCC V7.0 SP1 / SP2 / SP3 | DefaultSort |
Valid |
| WinCC V7.1 / V7.2 / V7.3 / V7.4 / V7.4 SP1 / V7.5 | DefaultSort |
Valid |
3. Replacement Property: DefaultSort
The DefaultSort property controls the initial sort direction of the alarm list when the picture is first loaded, and (more importantly) it is the property to write at runtime if you want to flip sort direction programmatically without invoking the toolbar dialog. The property is of type VARIANT_BOOL on the COM interface, meaning it accepts the VBScript literals True / False or the integer equivalents 1 / 0.
| DefaultSort value | VBScript literal | Effect on time column | Typical use |
|---|---|---|---|
| 0 | False |
Ascending (oldest event at top) | Chronological playback, audit review |
| 1 | True |
Descending (newest event at top) | Live operator view |
DefaultSort as the replacement but does not publish an explicit ascending/descending value table for the runtime write. The convention documented in the WinCC V7.0 SP1 AlarmControl reference (entry ID 37436840) and confirmed in the V7.4 runtime reference (entry ID 109736220) treats 1 / True as descending on the time column, matching the original V6.2 MsgCtrlFlags = 1 behavior. If your installation behaves oppositely, verify by writing True and False and observing the order of the first five rows in a populated message list — the assignment is otherwise side-effect free.The runtime write path is the same as for the V6.2 property. Assuming the AlarmControl is inserted on a picture named AlarmScreen.pdl with the default object name control1, the corrected scripts are:
' WinCC V7.0+ runtime sort (VBScript)
control1.DefaultSort = False ' ascending on time column
control1.DefaultSort = True ' descending on time column
4. Toolbar Object IDs as an Alternative Sort Trigger
If the runtime script approach is undesirable for any reason (e.g., the screen also performs additional side-effects that are easier to bundle into a toolbar click), the AlarmControl exposes an internal toolbar Object ID that opens the built-in sort dialog. The canonical Siemens FAQ Entry ID 11769423 ("WinCC Alarm Control: How can you use the value of the Object ID for the various toolbar functions of the AlarmControl object?") documents the full list of reserved IDs, the relevant subset of which is reproduced below.
| Object ID | Toolbar function | Notes |
|---|---|---|
| 1 | Acknowledge message | Single message |
| 2 | Acknowledge all visible messages | — |
| 3 | Lock / unlock single message | — |
| 4 | Lock / unlock all visible messages | — |
| 5 | Select / deselect single message | — |
| 6 | Selection confirmation | — |
| 7 | Prints current view | |
| 8 | Print (extended) | Archive + current view |
| 14 | First message | Scroll to top of list |
| 15 | Previous message | — |
| 16 | Next message | — |
| 17 | Last message | Scroll to bottom of list |
| 19 | Message list display | — |
| 20 | Short-term archive list display | — |
| 21 | Long-term archive list display | — |
| 22 | Lock list display | — |
| 23 | Hit list display | Statistical list |
| 25 | Comment dialog | — |
| 26 | Loop in / Loop out | Refresh behavior |
| 27 | Auto-scroll on / off | — |
| 28 | Selection | — |
| 30 | Sort dialog | Opens native sort configuration window |
| 31 | Display options / time column setup | — |
| 32 | Acknowledgment concept dialog | — |
| 33 | Select / deselect all messages | — |
| 34 | Copy rows | Clipboard export |
| 35 | Connect / disconnect message | — |
| 36 | Copy as image | — |
The toolbar Object ID mechanism is invoked from a button event as follows:
' Trigger sort dialog from a button click
Sub OnClick(ByVal Item)
Dim objAlarm
Set objAlarm = ScreenItems("control1")
objAlarm.OperatorControl(30) ' opens the sort dialog
End Sub
DefaultSort runtime write shown in Section 3. Pair the runtime write with a small button labeled with descriptive text (e.g., "Sort: Oldest First" / "Sort: Newest First") so that operators never need to invoke the toolbar sort dialog. Do not re-enlarge the dialog font through Windows DPI overrides — this scales the entire AlarmControl and breaks the column widths defined in Graphics Designer.5. VBScript Implementation Examples
The following scripts assume the AlarmControl object is named control1 on the active picture. The patterns are identical across WinCC V7.0 SP1, V7.4, and V7.5 because the COM interface has remained stable since the V7.0 base release.
5.1 Toggle on every button click
' Picture-level global variable holds the last-applied direction
Dim bDescending
bDescending = True
Sub OnClick(ByVal Item)
Dim objAlarm
Set objAlarm = ScreenItems("control1")
bDescending = Not bDescending
objAlarm.DefaultSort = bDescending ' True = descending, False = ascending
End Sub
5.2 Apply sort on picture open
' Place in the "Open picture" event of the picture that hosts the AlarmControl
Sub OnOpenPicture(ByVal PictureName, ByVal flags, ByVal argc, ByVal argv)
ScreenItems("control1").DefaultSort = True ' descending on entry
End Sub
5.3 Apply sort via tag (e.g., operator-selected via header checkbox)
' Triggered by value change on an internal boolean tag "bSortDesc"
Sub OnChange(ByVal Item)
Dim objAlarm
Set objAlarm = ScreenItems("control1")
objAlarm.DefaultSort = (SmartTags("bSortDesc").Value = 1)
End Sub
5.4 Two-button solution (no toggle state to track)
' Button "Sort Asc"
Sub OnClick(ByVal Item)
ScreenItems("control1").DefaultSort = False
End Sub
' Button "Sort Desc"
Sub OnClick(ByVal Item)
ScreenItems("control1").DefaultSort = True
End Sub
6. C-Script Equivalent
WinCC C-Script (ANSI-C actions compiled into the runtime DLL via the PDLRT family of libraries, e.g., PDLRT70.dll on V7.0, PDLRT74.dll on V7.4) supports the same property through the COM dispatch interface. The implementation requires the AlarmControl to be exposed to the C action through the standard GetObject pattern.
/* C-Script: sort_alarm_descending.c — compiled into PDLRTxx.dll */
#include "apdefap.h"
void OnClick(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
IDispatch* pDisp = NULL;
HRESULT hr;
DISPID dispidDefaultSort;
VARIANT vArg;
VARIANT vResult;
EXCEPINFO ex;
LPOLESTR pName = L"DefaultSort";
/* Acquire the AlarmControl dispatch pointer */
hr = GetObject(lpszPictureName, lpszObjectName, &pDisp);
if (FAILED(hr) || pDisp == NULL) {
printf("GetObject failed: 0x%08lX\n", hr);
return;
}
/* Resolve the DefaultSort DISPID */
hr = pDisp->lpVtbl->GetIDsOfNames(pDisp, &IID_NULL, &pName, 1,
LOCALE_USER_DEFAULT, &dispidDefaultSort);
if (FAILED(hr)) {
printf("GetIDsOfNames failed: 0x%08lX\n", hr);
pDisp->lpVtbl->Release(pDisp);
return;
}
/* Pass descending (TRUE) as the argument */
VariantInit(&vArg);
vArg.vt = VT_BOOL;
vArg.boolVal = VARIANT_TRUE;
VariantInit(&vResult);
hr = pDisp->lpVtbl->Invoke(pDisp, dispidDefaultSort, &IID_NULL,
LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPUT,
&vArg, &vResult, &ex, NULL);
if (FAILED(hr)) {
printf("Invoke failed: 0x%08lX\n", hr);
}
VariantClear(&vArg);
VariantClear(&vResult);
pDisp->lpVtbl->Release(pDisp);
return;
}
For sites that prefer a thin wrapper, the same result is achievable through the WinCC C-Script helper macro SetPropBOOL:
/* C-Script: short form using WinCC helper */
SetPropBOOL(lpszPictureName, lpszObjectName, "DefaultSort", TRUE); /* descending */
SetPropBOOL(lpszPictureName, lpszObjectName, "DefaultSort", FALSE); /* ascending */
GetIDsOfNames. VBScript silently normalizes casing as well. Maintain consistent capitalization in your source for grep-ability.7. Activating DefaultSort at Runtime vs. at Configuration Time
The DefaultSort property is dual-purpose:
- Configuration time (Graphics Designer) — set in the property sheet under "Sort" → "Default sort order". This controls only the initial sort direction applied when the picture first loads in runtime.
- Runtime time — written from a VBScript or C-Script action. This re-sorts the message list immediately. The re-sort is visually instant if the message list is populated; otherwise it takes effect as soon as the first message arrives.
Re-sorting at runtime does not require the picture to reload, the runtime database to flush, or the message subsystem to restart. There is no measurable delay between the assignment and the visual update.
8. Related Sort/Filter Properties: MsgFilterSQL, MsgSort, MsgFilter
Engineers attempting to also filter the alarm list before sorting should be aware of three sibling properties that are commonly confused with DefaultSort:
| Property | Type | Purpose | Siemens reference |
|---|---|---|---|
DefaultSort |
BOOL | Sort direction (time column) at load and at runtime | Entry 37436840 / 109736220 |
MsgFilterSQL |
BSTR (SQL WHERE clause) | SQL-based filtering of visible messages | Entry 5668269 |
MsgFilter |
BSTR (text filter) | Substring filter on message text / state fields | Entry 37436840 |
MsgSort |
BSTR (sort key list) | Custom multi-column sort key (advanced) | Entry 109736220 |
Siemens entry 5668269 documents the MsgFilterSQL property in detail, including how to dynamize it with an SQL WHERE clause to restrict the visible message set (for example, by area, by priority, or by status). The pattern below combines a filter with the corrected DefaultSort write:
' Combine SQL filter with descending sort
Sub OnOpenPicture(ByVal PictureName, ByVal flags, ByVal argc, ByVal argv)
Dim objAlarm
Set objAlarm = ScreenItems("control1")
objAlarm.MsgFilterSQL = "PRIORITY >= 4 AND STATUS = 1"
objAlarm.DefaultSort = True ' descending on time column
End Sub
DefaultSort writes across pictures without resetting: Because DefaultSort is a property of the control instance (not of the picture), a value written in Picture A persists when Picture A is closed and Picture B opens. If Picture B opens the same control name with a different intended sort, explicitly write the desired value on Picture B's OpenPicture event. Failure to do so is a common root cause of "the sort is wrong on this screen" complaints after a migration.9. Workaround for the Unreadable Toolbar Sort Dialog
The original poster's secondary complaint was that the toolbar sort dialog (Object ID 30) renders with a font that is too small on a typical 22" to 24" operator panel. The problem is not unique to WinCC V7.0; it is a property of the WinCC dialog shell. Three field-proven workarounds are documented below.
9.1 Two-button runtime sort (recommended)
Implement Section 5.4 ("Two-button solution") and remove Object ID 30 from the AlarmControl's toolbar configuration. This removes the unreadable dialog entirely from the operator's reach and replaces it with two on-screen buttons that are sized and styled by Graphics Designer to match the rest of the HMI.
9.2 Custom sort dialog hosted in a child picture
Create a dedicated child picture SortDialog.pdl that exposes radio buttons for Ascending / Descending and writes the corresponding DefaultSort value into the parent control via a tag or a direct ScreenItems(...) reference. This is the recommended approach for sites with strict corporate HMI style guides.
9.3 Disable the toolbar sort button
If the operator must be prevented from accidentally invoking the dialog but no custom UI is desired, configure the AlarmControl's toolbar in Graphics Designer to remove Object ID 30 from the button list. The toolbar editor under "Toolbars" → "Operation" exposes a checkbox list of every reserved Object ID. Clearing ID 30 hides the sort dialog button.
10. Migration Checklist: WinCC 6.2 → V7.0 → V7.4 → V7.5
For projects with many V6.2 graphics, perform the following actions before commissioning:
-
Audit — grep every
.pdl,.pas, and C-Script source for the stringMsgCtrlFlags. Each occurrence must be replaced. -
Replace — substitute
DefaultSortfor everyMsgCtrlFlagsreference. Preserve the same value polarity (0/False stays 0/False, 1/True stays 1/True). - Re-test — load every picture that contains an AlarmControl in runtime and verify sort direction flips when the buttons are clicked.
- Toolbar audit — review the AlarmControl toolbar configuration. Any custom buttons added under V6.2 that referenced the sort dialog (Object ID 30) are still valid in V7.0+ but may render the small font dialog; replace with the two-button pattern in Section 5.4 if legibility is an issue.
-
Filter audit — if any V6.2 code wrote the older
MsgFilterproperty, verify it still works under V7.0+; consider migrating toMsgFilterSQL(per entry 5668269) for richer filter expressions. -
Compile audit (C-Script) — re-compile all C-Script actions into the new
PDLRTDLL family. WinCC V6.2'sAP_PDLRT.dllis not binary-compatible with V7.0+. Each C-Script must be regenerated by Graphics Designer. - License audit — if migrating to V7.4 or V7.5, confirm that the AlarmControl runtime license (RT 128 / 256 / 512 / 1024 / 2048 / 4096 / 8192 / 16384 tags as appropriate) is still valid; no license change is required for the property rename itself.
- Firmware / Panel audit — for Comfort Panels (TP700 / TP900 / TP1200 / TP1500 / TP1900 / TP2200), confirm the panel image includes WinCC RT ≥ V14 SP1 if you also migrate the runtime side to TIA Portal.
11. Troubleshooting Matrix
| Symptom | Likely root cause | Fix |
|---|---|---|
| "Object doesn't support this property or method: MsgCtrlFlags" | V6.2 property referenced from V7.0+ script | Rename to DefaultSort
|
| Sort writes succeed but the visible list does not change | Write happens before any message is loaded; or the property is being written to the wrong control instance | Verify the object name in ScreenItems(...) matches the control name in Graphics Designer; defer the write to OnOpenPicture
|
| Sort direction is inverted from what was written | Project-specific interpretation of True / False differs from the V6.2 convention |
Swap the polarity of the written value; verify against the V7.0 SP1 reference (entry 37436840) and the V7.4 reference (entry 109736220) |
| Toolbar sort dialog still launches and is unreadable | Operator invoked Object ID 30 directly from the toolbar | Remove Object ID 30 from the AlarmControl toolbar configuration; deploy the two-button pattern from Section 5.4 |
| C-Script compile error: unresolved external GetObject | C-Script migrated from V6.2 but not regenerated under V7.0+ | Open Graphics Designer, force a regeneration (right-click picture → "Compile"), or re-create the action |
| VBScript runtime error 424 — Object required | Wrong index passed to ScreenItems()
|
Verify the object name; print HMIRuntime.Screens("PictureName").ScreenItems.Count for debugging |
| Sort persists across pictures unexpectedly |
DefaultSort is a per-control-instance property, not a per-picture property |
Always write the desired value in the new picture's OpenPicture event |
12. Related Functions on the AlarmControl (WinCC V7.0 SP1)
Siemens entry ID 37436840 enumerates the supported runtime functions on the AlarmControl. The subset that is most often paired with the corrected sort logic is reproduced below for quick reference.
| Function | Effect |
|---|---|
AXC_OnBtnComment |
Switches the message window to show messages from the short-term archive list (also opens the comment dialog) |
AXC_OnBtnSinglAckn |
Acknowledges the currently selected single message |
AXC_OnBtnAllAckn |
Acknowledges all visible messages |
AXC_OnBtnSinglLock |
Locks / unlocks the currently selected message |
AXC_OnBtnPageFirst / ...Last
|
Scrolls the message list to the first / last page |
AXC_OnBtnPrint |
Triggers print of the current view |
AXC_OnBtnSort |
Opens the sort dialog (equivalent to Object ID 30) |
AXC_OnBtnTimeBase |
Opens the time-base configuration dialog |
AXC_OnBtnScroll |
Toggles auto-scroll on / off |
13. FAQ
What replaced the WinCC V6.2 MsgCtrlFlags property in V7.0?
The property was renamed to DefaultSort on the new AlarmControl ActiveX (CCAlarmControl) starting with WinCC V7.0 base. Use control1.DefaultSort = True for descending and control1.DefaultSort = False for ascending on the time column. See Siemens support entries 37436840 (V7.0 SP1) and 109736220 (V7.4).
Why does VBScript throw "Object doesn't support this property" on MsgCtrlFlags in WinCC V7.0?
The legacy MsgCtrlFlags property was retired when the AlarmControl ActiveX was re-engineered for V7.0. The COM interface no longer exposes that property name; VBScript returns error 438 ("Object doesn't support this property or method"). Rename the property to DefaultSort and re-test.
Which toolbar Object ID opens the sort dialog on the AlarmControl?
Object ID 30 opens the sort configuration dialog. The full list of toolbar Object IDs is documented in Siemens FAQ entry 11769423. If the dialog font is illegible, remove ID 30 from the toolbar configuration and use the two-button runtime sort pattern with the DefaultSort property.
Can I sort the AlarmControl by a column other than the time column?
Yes. The advanced MsgSort property accepts a custom multi-column sort key string and is documented in Siemens entry 109736220. For simple time-column direction toggling, DefaultSort is sufficient.
Does this issue affect WinCC V7.4, V7.5, and the Comfort Panels running TIA Portal?
The MsgCtrlFlags retirement applies to every WinCC V7.0 and later release, including V7.0 SP1 through V7.5. Comfort Panels running TIA Portal WinCC RT (V14 SP1 and later) use a separate runtime with its own Alarm Control object model — the equivalent property is also called DefaultSort, but the COM access path differs because the panels do not expose the full CCAlarmControl COM dispatch interface.