diff --git a/Debug/ObjeqtNote.exe b/Debug/ObjeqtNote.exe index 77f65c8..6e641e5 100644 Binary files a/Debug/ObjeqtNote.exe and b/Debug/ObjeqtNote.exe differ diff --git a/ObjeqtNote/EditBox.cpp b/ObjeqtNote/EditBox.cpp new file mode 100644 index 0000000..9191d8e --- /dev/null +++ b/ObjeqtNote/EditBox.cpp @@ -0,0 +1,19 @@ +// 二重インクルード防止 +#pragma once // #pragma onceで二重インクルード防止. + +// ヘッダのインクルード +// 独自のヘッダ +#include "EditBox.h" // エディットボックスクラス + +// コンストラクタCEditBox() +CEditBox::CEditBox() : CCustomControl() { + +} + +// ウィンドウ作成関数Create(lpctszClassName省略) +BOOL CEditBox::Create(LPCTSTR lpctszWindowName, DWORD dwStyle, int x, int y, int iWidth, int iHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance){ + + // ウィンドウの作成. + return CCustomControl::Create(_T("Edit"), lpctszWindowName, dwStyle, x, y, iWidth, iHeight, hWndParent, hMenu, hInstance); // CCustomControl::Createでウィンドウを作成し, その戻り値をreturnで返す. + +} \ No newline at end of file diff --git a/ObjeqtNote/EditBox.h b/ObjeqtNote/EditBox.h new file mode 100644 index 0000000..e500ec8 --- /dev/null +++ b/ObjeqtNote/EditBox.h @@ -0,0 +1,19 @@ +// 二重インクルード防止 +#pragma once // #pragma onceで二重インクルード防止. + +// 独自のヘッダ +#include "CustomControl.h" // カスタムコントロールクラス + +// エディットボックスクラスCEditBox +class CEditBox : public CCustomControl { + + // publicメンバ + public: + + // コンストラクタ・デストラクタ + CEditBox(); // コンストラクタCEditBox() + + // メンバ関数 + virtual BOOL Create(LPCTSTR lpctszWindowName, DWORD dwStyle, int x, int y, int iWidth, int iHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance); // ウィンドウ作成関数Create(lpctszClassName省略) + +}; diff --git a/ObjeqtNote/MainWindow.cpp b/ObjeqtNote/MainWindow.cpp index 3bfa172..980ade8 100644 --- a/ObjeqtNote/MainWindow.cpp +++ b/ObjeqtNote/MainWindow.cpp @@ -17,7 +17,7 @@ CMainWindow::CMainWindow() : CStandardWindow() { // メンバの初期化 m_pUserControl = NULL; // m_pUserControlをNULLで初期化. - m_pCustomControl = NULL; // m_pCustomControlをNULLで初期化. + m_pEditBox = NULL; // m_pEditBoxをNULLで初期化. } @@ -25,9 +25,9 @@ CMainWindow::CMainWindow() : CStandardWindow() { CMainWindow::~CMainWindow() { // メンバの終了処理. - if (m_pCustomControl != NULL) { - delete m_pCustomControl; // deleteでm_pCustomControlを解放. - m_pCustomControl = NULL; // m_pCustomControlをNULLで埋める. + if (m_pEditBox != NULL) { + delete m_pEditBox; // deleteでm_pEditBoxを解放. + m_pEditBox = NULL; // m_pEditBoxをNULLで埋める. } if (m_pUserControl != NULL) { delete m_pUserControl; // deleteでm_pUserControlを解放. @@ -54,9 +54,9 @@ int CMainWindow::OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct) { m_pUserControl = new CUserControl(); // CUserControlオブジェクトを作成し, ポインタをm_pUserControlに格納. m_pUserControl->Create(_T("UserControl"), _T(""), WS_BORDER, 50, 50, 100, 100, hwnd, (HMENU)(WM_APP + 1), lpCreateStruct->hInstance); // m_pUserControl->Createでウィンドウクラス名"UserControl"なウィンドウを作成. - // カスタムコントロールの作成. - m_pCustomControl = new CCustomControl(); // CCustomControlオブジェクトを作成し, ポインタをm_pCustomControlに格納. - m_pCustomControl->Create(_T("Edit"), _T(""), WS_BORDER | ES_MULTILINE | ES_AUTOVSCROLL, 150, 150, 200, 50, hwnd, (HMENU)(WM_APP + 2), lpCreateStruct->hInstance); // m_pCustomControl->Createでウィンドウクラス名"Edit"なウィンドウを作成. + // エディットボックスの作成. + m_pEditBox = new CEditBox(); // CEditBoxオブジェクトを作成し, ポインタをm_pEditBoxに格納. + m_pEditBox->Create(_T(""), WS_BORDER | ES_MULTILINE | ES_AUTOVSCROLL, 150, 150, 200, 50, hwnd, (HMENU)(WM_APP + 2), lpCreateStruct->hInstance); // m_pEditBox->Createでエディットボックスを作成. // 成功. return 0; // 成功なので0を返す. diff --git a/ObjeqtNote/MainWindow.h b/ObjeqtNote/MainWindow.h index 9667dd0..451a7b2 100644 --- a/ObjeqtNote/MainWindow.h +++ b/ObjeqtNote/MainWindow.h @@ -3,7 +3,7 @@ // 独自のヘッダ #include "StandardWindow.h" // スタンダードウィンドウクラス -#include "CustomControl.h" // カスタムコントロールクラス +#include "EditBox.h" // エディットボックスクラス #include "UserControl.h" // ユーザコントロールクラス // メインウィンドウクラスCMainWindow @@ -14,7 +14,7 @@ class CMainWindow : public CStandardWindow { // publicメンバ変数 CUserControl *m_pUserControl; // CUserControl *型ユーザコントロールオブジェクトポインタm_pUserControl - CCustomControl *m_pCustomControl; // CCustomControl *型カスタムコントロールオブジェクトポインタm_pCustomControl + CEditBox *m_pEditBox; // CEditBox *型エディットボックスオブジェクトポインタm_pEditBox // publicメンバ関数 // staticメンバ関数 diff --git a/ObjeqtNote/ObjeqtNote.rc b/ObjeqtNote/ObjeqtNote.rc index 9c91cda..01dfd78 100644 Binary files a/ObjeqtNote/ObjeqtNote.rc and b/ObjeqtNote/ObjeqtNote.rc differ diff --git a/ObjeqtNote/ObjeqtNote.vcxproj b/ObjeqtNote/ObjeqtNote.vcxproj index 267df9b..6192b3f 100644 --- a/ObjeqtNote/ObjeqtNote.vcxproj +++ b/ObjeqtNote/ObjeqtNote.vcxproj @@ -150,6 +150,7 @@ + @@ -165,6 +166,7 @@ + diff --git a/Release/ObjeqtNote.exe b/Release/ObjeqtNote.exe index 37e06a7..f905815 100644 Binary files a/Release/ObjeqtNote.exe and b/Release/ObjeqtNote.exe differ