📄 timerecord.cpp
字号:
//版权有所:李巧平 2003年1月份 电子邮件:liqiaoping@163.com 个人主页:http://mengyuworkroom.y365.com QQ:5542376
// timerecord.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "timerecord.h"
#include "timerecordDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTimerecordApp
BEGIN_MESSAGE_MAP(CTimerecordApp, CWinApp)
//{{AFX_MSG_MAP(CTimerecordApp)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CTimerecordApp construction
CTimerecordApp::CTimerecordApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CTimerecordApp object
CTimerecordApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CTimerecordApp initialization
BOOL CTimerecordApp::InitInstance()
{
m_pingdatabase = new CPingDatabase();
m_pingdatabase->_init();
char msg[255];
if( m_pingdatabase->_connectDatabase("file","record.mdb","","",msg)!=-1)
{
CString temp;
temp.Format("%s",msg);
AfxMessageBox(temp);
return false;
}
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
/*
bool doreg=true;
HKEY hKEY; //定义有关的 hKEY, 在查询结束时要关闭。
LPCTSTR data_Set="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
//打开与路径 data_Set 相关的 hKEY,第一个参数为根键名称,第二个参数表。
//表示要访问的键的位置,第三个参数必须为0,KEY_READ表示以查询的方式。
//访问注册表,hKEY则保存此函数所打开的键的句柄。
long ret0=(::RegOpenKeyEx(HKEY_LOCAL_MACHINE,data_Set, 0, KEY_READ, &hKEY));
if(ret0!=ERROR_SUCCESS) //如果无法打开hKEY,则终止程序的执行
{
doreg=false;
//::MessageBox("错误: 无法打开有关的hKEY!");
//return;
}
//查询有关的数据 (用户姓名 owner_Get)。
LPBYTE path_Get=new BYTE[1000];
DWORD type=REG_SZ ; DWORD cbData=1000;
//hKEY为刚才RegOpenKeyEx()函数所打开的键的句柄,"RegisteredOwner"。
//表示要查 询的键值名,type_1表示查询数据的类型,owner_Get保存所。
//查询的数据,cbData_1表示预设置的数据长度。
long ret1=::RegQueryValueEx(hKEY, "autorunTimeRecordApp", NULL,
&type, path_Get, &cbData);
if(ret1!=ERROR_SUCCESS)
{
doreg=false;
//M/essageBox("错误: 无法查询有关注册表信息!");
//return;
}
if(doreg)
CString str_path=CString(path_Get);
DWORD length=1000;
char c_path[1000];
//GetCurrentDirectory(length,c_path);
GetModuleFileName(NULL,c_path,length);
GetSystemDirectory(c_path,length);
*/
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
CTimerecordDlg 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;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -