It's interesting; this is a lot harder in eVC++ than it is to simply PInvoke it from Compact Framework.
I'm thinking about writing a class that exposes more information. For example, how long time the user has to log on again, etc.
#region
Pocket PC Password PInvokes
/// <summary>
/// Method allows the the Pocket PC password to be set.
/// </summary>
/// <param name="lpszOldpassword">The current password in effect, null if not set.</param>
/// <param name="lspzNewPassword">The new password.</param>
/// <returns>Returns true if set was successful, else false.</returns>
/// <remarks>
/// This should always be a 4 digit number unless a custom log on screen is written.
/// </remarks>
/// <example>
/// MessageBox.Show("Is password active? " + GetPasswordActive().ToString());
/// MessageBox.Show("SetPassword? " + SetPassword(null, "1234").ToString());
/// MessageBox.Show("SetPasswordActive? " + SetPasswordActive(false, "1234").ToString());
/// MessageBox.Show("Is password active? " + GetPasswordActive().ToString());
/// </example>
[DllImport("coredll.dll")]
private static extern bool SetPassword(string lpszOldpassword, string lspzNewPassword);
/// <summary>
/// Method allows the Pocket PC password to be turned on and off.
/// </summary>
/// <param name="bActive">Active flag.</param>
/// <param name="lpszPassword">The current password in effect, null if not set.</param>
/// <returns>Returns true if set was successful, else false.</returns>
[DllImport("coredll.dll")]
private static extern bool SetPasswordActive(bool bActive, string lpszPassword);
/// <summary>
/// Method for determining if the password is being required.
/// </summary>
/// <returns>True if password is required, else false.</returns>
[DllImport("coredll.dll")]
private static extern bool GetPasswordActive();
#endregion