CDateTimeCtrl::SetFormat

指定された書式の文字列に従って日時指定コントロールの表示を設定します。

BOOL SetFormat(
   LPCTSTR pstrFormat 
);

パラメーター

  • pstrFormat
    目的の表示を定義する、形式で終わる文字列へのポインター。null にこのパラメーターを設定すると、現在のスタイルの既定の書式指定文字列にコントロールをリセットします。

戻り値

正常終了した場合は 0 以外を返します。それ以外の場合は 0 を返します。

[!メモ]

ユーザー入力は、この呼び出しの成功または失敗を確認しません。

解説

このメンバー関数は Windows SDKに記述されている Win32 メッセージの動作を DTM_SETFORMAT実行します。

使用例

// The control will create itself with a format that matches the 
// locale setting in Control Panel. But we can force a particular 
// format with a call to SetFormat(). This call forces the format 
// dd-MMM-yy, which would show 03-APR-98 for April 3rd, 1998.
m_DateTimeCtrl.SetFormat(_T("dd-MMM-yy"));

必要条件

Header: afxdtctl.h

参照

関連項目

CDateTimeCtrl クラス

階層図