#pragma once

#include "stdafx.h"

#include "Includes.h"

using namespace std;

int SaveDialogRect(CString Dialog, HWND hDialog)
{
	WINDOWPLACEMENT wp;
	GetWindowPlacement(hDialog,&wp);
	AfxGetApp()->WriteProfileInt(Dialog,"VertPos",wp.rcNormalPosition.top);
	AfxGetApp()->WriteProfileInt(Dialog,"HorizPos",wp.rcNormalPosition.left);
	AfxGetApp()->WriteProfileInt(Dialog,"Height",wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
	AfxGetApp()->WriteProfileInt(Dialog,"Width",wp.rcNormalPosition.right - wp.rcNormalPosition.left);

	return 0;
}

int LoadDialogRect(CString Dialog,HWND hDialog)
{
	int iVert = AfxGetApp()->GetProfileInt(Dialog,"VertPos",9999);
	int iHoriz = AfxGetApp()->GetProfileInt(Dialog,"HorizPos",9999);
	int Width = AfxGetApp()->GetProfileInt(Dialog,"Width",9999);;
	int Height = AfxGetApp()->GetProfileInt(Dialog,"Height",9999);

	if (iVert != 9999 && iHoriz != 9999 && Width != 9999 && Height != 9999) {
		SetWindowPos(hDialog,NULL,iHoriz,iVert,Width,Height, NULL);
	}

	return 0;
}
