0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

vs2010でmfc その6

Posted at

概要

vs2010でmfcやってみた。
デジタル時計やってみた。

手順

  • mfcアプリケーション、ダイアログベースでプロジェクト名は、mfc0で作る。
  • IDD_MFC0_DIALOGを開く
  • プロパティを開く。メッセージを開く。
  • WM_TIMERをクリック。
  • OKボタンをクリック。
  • コードを書く。
  • 実行。

サンプルコード


void Cmfc0Dlg::OnBnClickedOk()
{
	SetTimer(1, 1000, NULL);
	SetDlgItemText(IDC_STATIC, _T("start"));
}

void Cmfc0Dlg::OnBnClickedCancel()
{
	// TODO: ここにコントロール通知ハンドラー コードを追加します。
	CDialogEx::OnCancel();
}

void Cmfc0Dlg::OnTimer(UINT_PTR nIDEvent)
{
	if (nIDEvent == 1)
	{
		CTime cTime = CTime::GetCurrentTime();
		CString stime = cTime.Format("%Y/%m/%d %H:%M:%S");
		SetDlgItemText(IDC_STATIC, stime);
	}
	CDialogEx::OnTimer(nIDEvent);
}


以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?