//////////////////////////////////////////
// PaintBox.cpp
//Copyright (c) 05/02/2022 by BCCSkelton
//////////////////////////////////////////
#include	"PaintBox.h"
#include	"PaintBoxProc.h"

////////////////
// WinMain関数
////////////////
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
					LPSTR lpCmdLine, int nCmdShow) {

	//２重起動防止
	if(!PaintBox.IsOnlyOne()) {
		HWND hWnd = FindWindow("MainWnd", "PaintBox");
		if(IsIconic(hWnd))
			ShowWindow(hWnd, SW_RESTORE);
		SetForegroundWindow(hWnd);
		return 0L;
	}

	//CPICBOXクラスを登録する
	if(!PicBox.Register(hInstance))
		MessageBox(NULL, "PictureBoxが登録できませんでした", "警告", MB_OK | MB_ICONSTOP);

	//モードレスダイアログを作成Create(hParent, DlgName, DlgProc);
	if(!PaintBox.Create(NULL, hInstance, "IDD_MAIN", ModelessProc))
		return 0L;

	//メッセージループに入る
	return PaintBox.Loop();
}
