次の方法で共有


System.Gadget.Settings.write method

[The Windows Gadget Platform/Sidebar is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. ]

Stores a value of unspecified type with an associated Settings key.

Syntax

System.Gadget.Settings.write(
  strName,
  varValue
)

Parameters

strName [in]

String that specifies the name of the Settings key.

varValue [in]

The value to store.

Return value

This method does not return a value.

Remarks

Use writeString for performance and efficiency reasons if the data type is a String.

There is a 1024 character limit for Settings keys and a 2048 character limit for Settings values; values longer than these limits will be truncated.

Use read or readString to read Settings values.

The Settings values are unique for each user account, even if the same gadget is used.

Examples

The following example demonstrates how to store a Settings value.

// --------------------------------------------------------------------
// Handle the Settings dialog closing event.
// Parameters:
// event - event arguments.
// --------------------------------------------------------------------
function SettingsClosing(event)
{
    // Save the settings if the user clicked OK.
    if (event.closeAction == event.Action.commit)
    {
        System.Gadget.Settings.write(
            "settingsSelectionIndex", selUserEntry.selectedIndex);
    }
    // Allow the Settings dialog to close.
    event.cancel = false;
}

Requirements

Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
End of client support
Windows 7
End of server support
Windows Server 2008
Header
Corecrt_io.h
IDL
Sidebar.idl
DLL
Sidebar.Exe (version 1.00 or later)