InitSys.cpp
上传用户:hbzxgg2
上传日期:2009-03-28
资源大小:291k
文件大小:1k
- #include "StdAfx.h"
- #include "InitSys.h"
- #include "RDSTerminal.h"
- void SetDefaultSetting ()
- {
- memset ( &g_Setting, 0, sizeof(t_ProgramSetting) );
- strncpy_s ( g_Setting.szServiceInUsingGUID, L"00001101-0000-1000-8000-00805F9B34FB", LENGTH(g_Setting.szServiceInUsingGUID) );
- }
- BOOL Read_Configuration ()
- {
- CString csConfigFileName;
- csConfigFileName.Format ( L"%s%s.cfg", g_CurDir, AfxGetAppName() );
- return ( ReadDataFromFile ( csConfigFileName, (char*)&g_Setting, sizeof(t_ProgramSetting) ) == sizeof(t_ProgramSetting) );
- }
- void Save_Configuration ()
- {
- CString csConfigFileName;
- csConfigFileName.Format ( L"%s%s.cfg", g_CurDir, AfxGetAppName() );
- WriteDataToFile ( csConfigFileName, (char*)&g_Setting, sizeof(t_ProgramSetting), L"wb" );
- }
- BOOL Init_System ()
- {
- GetProgramDir ( g_CurDir, sizeof(g_CurDir) );
- if ( !Read_Configuration () )
- {
- SetDefaultSetting ();
- }
- m_pBlueTooth_WM = new CBlueTooth_WM;
- if ( !m_pBlueTooth_WM ) return FALSE;
- return TRUE;
- }
- void Uninit_System ()
- {
- if ( m_pBlueTooth_WM ) delete m_pBlueTooth_WM;
- m_pBlueTooth_WM = NULL;
- Save_Configuration ();
- }