Files
HLStock/MakeRefusalList/MakeRefusalList.cpp
2013-08-22 05:27:07 +00:00

143 lines
4.3 KiB
C++

// MakeRefusalList.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "MakeRefusalList.h"
#include "MakeRefusalListDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMakeRefusalListApp
BEGIN_MESSAGE_MAP(CMakeRefusalListApp, CWinApp)
//{{AFX_MSG_MAP(CMakeRefusalListApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMakeRefusalListApp construction
CMakeRefusalListApp::CMakeRefusalListApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CMakeRefusalListApp object
CMakeRefusalListApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CMakeRefusalListApp initialization
BOOL CMakeRefusalListApp::InitInstance()
{
AfxOleInit(); // <= Ãß°¡ÇÑ °ÍÀÓ
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
//#ifdef _AFXDLL
// Enable3dControls(); // Call this when using MFC in a shared DLL
//#else
// Enable3dControlsStatic(); // Call this when linking to MFC statically
//#endif
SetRegistryKey(_T("DnaSoft"));
GetApplicationSettings();
CMakeRefusalListDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
int CMakeRefusalListApp::ExitInstance()
{
SaveApplicationSettings();
return CWinApp::ExitInstance();
}
void CMakeRefusalListApp::GetApplicationSettings()
{
HKEY hSecKey = GetSectionKey("Settings");
/*
DWORD dwType;
m_AppConfig.rcWindow.bottom = 500;
DWORD dwData = sizeof(RECT);
if (RegQueryValueEx(hSecKey, "WindowRect", NULL, &dwType,
(LPBYTE)&m_AppConfig.rcWindow, &dwData) == ERROR_SUCCESS)
{
}
m_AppConfig.strSBAddr = GetProfileString( "SBConfig", "SBAddress", "127.0.0.1" );
m_AppConfig.lSBPort = GetProfileInt( "SBConfig", "SBPort", 5050 );
LPBYTE ppData = 0;
UINT pBytes=0;
if( GetProfileBinary("Config", "Max", &ppData, &pBytes) )
memcpy( &g_AppConfig.fMax, ppData, sizeof(float) );
*/
g_AppConfig.bUsingAmount = GetProfileInt( "Config", "UsingAmount", TRUE );
g_AppConfig.bUsingBM = GetProfileInt( "Config", "UsingBM", TRUE );
g_AppConfig.bUsingExchange = GetProfileInt( "Config", "UsingExchange", TRUE );
g_AppConfig.bUsingKosdaq = GetProfileInt( "Config", "UsingKosdaq", TRUE );
g_AppConfig.nAmount = GetProfileInt( "Config", "AmountValue", 1000 );
g_AppConfig.nBM = GetProfileInt( "Config", "BmValue", 10000 );
}
void CMakeRefusalListApp::SaveApplicationSettings()
{
HKEY hSecKey = GetSectionKey("Settings");
/*
RegSetValueEx(hSecKey, "WindowRect", 0, REG_DWORD,
(LPBYTE)&m_AppConfig.rcWindow, sizeof(RECT));
WriteProfileString( "SBConfig", "SBAddress", m_AppConfig.strSBAddr );
WriteProfileInt( "SBConfig", "SBPort", m_AppConfig.lSBPort );
BYTE pData[4];
UINT nBytes=4;
memcpy( pData, &g_AppConfig.nContinueTime, sizeof(long) );
WriteProfileBinary( "Config", "ContinueTime", pData, nBytes);
*/
WriteProfileInt( "Config", "UsingAmount", g_AppConfig.bUsingAmount );
WriteProfileInt( "Config", "UsingBM", g_AppConfig.bUsingBM );
WriteProfileInt( "Config", "UsingExchange", g_AppConfig.bUsingExchange );
WriteProfileInt( "Config", "UsingKosdaq", g_AppConfig.bUsingKosdaq );
WriteProfileInt( "Config", "AmountValue", g_AppConfig.nAmount );
WriteProfileInt( "Config", "BmValue", g_AppConfig.nBM );
}