Commit 9fa9d892 authored by 王炳鑫's avatar 王炳鑫

重启工程

Signed-off-by: 王炳鑫's avatarwangbingxin <imbald@magicare.me>
parents

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HealthHutUi", "HealthHutUi\HealthHutUi.vcxproj", "{420A459D-54F3-4838-871A-E2AB195E217D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{420A459D-54F3-4838-871A-E2AB195E217D}.Debug|Win32.ActiveCfg = Debug|Win32
{420A459D-54F3-4838-871A-E2AB195E217D}.Debug|Win32.Build.0 = Debug|Win32
{420A459D-54F3-4838-871A-E2AB195E217D}.Release|Win32.ActiveCfg = Release|Win32
{420A459D-54F3-4838-871A-E2AB195E217D}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
#include "stdafx.h"
#include "FileList.h"
#ifdef _DEBUG
#include <iostream>
#endif
#include "SqliteUtil.h"
#include "MD5Checksum.h"
#include "utils.h"
#include "SqliteUtil.h"
#include <algorithm>
#include <windows.h>
#include <string>
CFileList::CFileList(void)
{
}
CFileList::~CFileList(void)
{
}
BOOL CFileList::list_files(LPCTSTR pstr) {
CFileFind finder;
CStringW strWildcard(pstr);
strWildcard += _T("\\*.*");
BOOL bWorking = finder.FindFile(strWildcard);
BOOL ret = false;
char newPath[MAX_PATH_LENGTH];
while (bWorking) {
bWorking = finder.FindNextFile();
if (finder.IsDots()) {
continue;
}
if (finder.IsDirectory()) {
CStringW str = finder.GetFilePath();
list_files(str);
} else {
CString str = finder.GetFileName();
if (-1 != str.Find(_T("jpg"))){
if (CSqliteUtil::instance()->exist(finder.GetFilePath())) {
continue;
}
DEBUG_OUTW(finder.GetFilePath().GetString());
if (rename_files(finder.GetFilePath(), newPath)) {
mFiles.push_back(CString(newPath));
}
}
}
}
finder.Close();
sort_files();
return mFiles.empty();
}
bool SortByName(const CString &v1, const CString &v2)
{
return v1 < v2;//
}
bool SortByCreateTime(const CString &v1, const CString &v2)
{
CFileStatus status;
CFile::GetStatus(v1.GetString(), status);
CTime t1 = status.m_atime;
CFile::GetStatus(v2.GetString(), status);
CTime t2 = status.m_atime;
return t1 < t2;
}
BOOL CFileList::sort_files()
{
std::sort(mFiles.begin(), mFiles.end(), SortByCreateTime);
return true;
}
CString& CFileList::getPath()
{
CString path("");
if (mFiles.empty())
return path;
else
return mFiles.at(0);
}
BOOL CFileList::rename_files(const CString& path, char *newPath)
{
char source[MAX_PATH_LENGTH];
CString md5sum = CMD5Checksum::GetMD5(path.GetString());
USES_CONVERSION;
_snprintf(source, MAX_PATH_LENGTH, "%s", T2A(path));
std::string oldPath(source);
size_t pos = oldPath.find_last_of("\\");
if (std::string::npos == pos) {
return false;
}
DEBUG_OUT("rename_files: "+oldPath);
memcpy(newPath, source, pos + 1);
_snprintf(newPath + pos + 1, MAX_PATH_LENGTH - pos - 1, "%s.jpg", T2A(md5sum));
DEBUG_OUT("rename_files: "+std::string(newPath));
if (0 == strcmp(source, newPath)) {
return false;
}
if (0 != rename(source, newPath)) {
return false;
}
return true;
}
#pragma once
#include <vector>
class CFileList
{
public:
CFileList(void);
~CFileList(void);
BOOL list_files(LPCTSTR pstr);
CString& getPath();
private:
BOOL sort_files();
BOOL rename_files(const CString& path, char *newPath);
private:
std::vector<CString> mFiles;
};
// HealthHutUi.cpp : 定义应用程序的类行为。
//
#include "stdafx.h"
#include "HealthHutUi.h"
#include "HealthHutUiDlg.h"
// CHealthHutUiApp
BEGIN_MESSAGE_MAP(CHealthHutUiApp, CWinApp)
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
// CHealthHutUiApp 构造
CHealthHutUiApp::CHealthHutUiApp()
{
// 支持重新启动管理器
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
}
// 唯一的一个 CHealthHutUiApp 对象
CHealthHutUiApp theApp;
// CHealthHutUiApp 初始化
#ifdef _DEBUG
void init_console()
{
AllocConsole();
freopen("CON", "r", stdin );
freopen("CON", "w", stdout);
freopen("CON", "w", stderr);
}
#endif // _DEBUG
BOOL CHealthHutUiApp::InitInstance()
{
// 如果一个运行在 Windows XP 上的应用程序清单指定要
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 将它设置为包括所有要在应用程序中使用的
// 公共控件类。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
#ifdef _DEBUG
init_console();
#endif
AfxEnableControlContainer();
// 创建 shell 管理器,以防对话框包含
// 任何 shell 树视图控件或 shell 列表视图控件。
CShellManager *pShellManager = new CShellManager;
// 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
// 标准初始化
// 如果未使用这些功能并希望减小
// 最终可执行文件的大小,则应移除下列
// 不需要的特定初始化例程
// 更改用于存储设置的注册表项
// TODO: 应适当修改该字符串,
// 例如修改为公司或组织名
SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
CHealthHutUiDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
// TODO: 在此放置处理何时用
// “取消”来关闭对话框的代码
}
else if (nResponse == -1)
{
TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
}
// 删除上面创建的 shell 管理器。
if (pShellManager != NULL)
{
delete pShellManager;
}
// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
// 而不是启动应用程序的消息泵。
return FALSE;
}
// HealthHutUi.h : PROJECT_NAME 应用程序的主头文件
//
#pragma once
#ifndef __AFXWIN_H__
#error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件"
#endif
#include "resource.h" // 主符号
// CHealthHutUiApp:
// 有关此类的实现,请参阅 HealthHutUi.cpp
//
class CHealthHutUiApp : public CWinApp
{
public:
CHealthHutUiApp();
// 重写
public:
virtual BOOL InitInstance();
// 实现
DECLARE_MESSAGE_MAP()
};
extern CHealthHutUiApp theApp;
\ No newline at end of file
B// Microsoft Visual C++ generated resource script.
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{420A459D-54F3-4838-871A-E2AB195E217D}</ProjectGuid>
<RootNamespace>HealthHutUi</RootNamespace>
<Keyword>MFCProj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>D:\workspace\git\HealthHut\HealthHutUi\curl;D:\workspace\git\HealthHut\HealthHutUi\HealthHutUi;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_WARNINGS;BUILDING_LIBCURL;HTTP_ONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>D:\workspace\git\HealthHut\HealthHutUi\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libcurld.lib;ws2_32.lib;winmm.lib;wldap32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="MD5Checksum.h" />
<ClInclude Include="FileList.h" />
<ClInclude Include="HealthHutUi.h" />
<ClInclude Include="HealthHutUiDlg.h" />
<ClInclude Include="MainApp.h" />
<ClInclude Include="RegegitKey.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="sqlite3.h" />
<ClInclude Include="SqliteUtil.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="MD5ChecksumDefines.h" />
<ClInclude Include="Upload.h" />
<ClInclude Include="utils.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="FileList.cpp" />
<ClCompile Include="HealthHutUi.cpp" />
<ClCompile Include="HealthHutUiDlg.cpp" />
<ClCompile Include="json_reader.cpp" />
<ClCompile Include="json_value.cpp" />
<ClCompile Include="json_writer.cpp" />
<ClCompile Include="MainApp.cpp" />
<ClCompile Include="MD5Checksum.cpp" />
<ClCompile Include="RegegitKey.cpp" />
<ClCompile Include="sqlite3.c" />
<ClCompile Include="SqliteUtil.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Upload.cpp" />
<ClCompile Include="utils.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="HealthHutUi.rc" />
</ItemGroup>
<ItemGroup>
<None Include="res\HealthHutUi.rc2" />
</ItemGroup>
<ItemGroup>
<Image Include="res\HealthHutUi.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties RESOURCE_FILE="HealthHutUi.rc" />
</VisualStudio>
</ProjectExtensions>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="HealthHutUi.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="HealthHutUiDlg.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="FileList.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="sqlite3.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="SqliteUtil.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="MainApp.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="MD5ChecksumDefines.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="MD5Checksum.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="utils.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="RegegitKey.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Upload.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="HealthHutUi.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="HealthHutUiDlg.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FileList.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="sqlite3.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="SqliteUtil.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="MainApp.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="MD5Checksum.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="RegegitKey.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="utils.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="Upload.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="json_reader.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="json_value.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="json_writer.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="HealthHutUi.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="res\HealthHutUi.rc2">
<Filter>资源文件</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Image Include="res\HealthHutUi.ico">
<Filter>资源文件</Filter>
</Image>
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
\ No newline at end of file
// HealthHutUiDlg.cpp : 实现文件
//
#include "stdafx.h"
#include "HealthHutUi.h"
#include "HealthHutUiDlg.h"
#include "afxdialogex.h"
#include "SqliteUtil.h"
#include "RegegitKey.h"
#include "Upload.h"
#include "utils.h"
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg();
// 对话框数据
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()
CHealthHutUiDlg::CHealthHutUiDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(CHealthHutUiDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CHealthHutUiDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIST1, mList);
DDX_Control(pDX, IDC_EDIT1, mName);
DDX_Control(pDX, IDC_EDIT2, mCard);
}
BEGIN_MESSAGE_MAP(CHealthHutUiDlg, CDialogEx)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_TIMER()
ON_BN_CLICKED(IDOK, &CHealthHutUiDlg::OnBnClickedOk)
ON_WM_CREATE()
ON_WM_CLOSE()
ON_NOTIFY(NM_CLICK, IDC_LIST1, &CHealthHutUiDlg::OnNMClickList1)
END_MESSAGE_MAP()
// CHealthHutUiDlg 消息处理程序
BOOL CHealthHutUiDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// 将“关于...”菜单项添加到系统菜单中。
// IDM_ABOUTBOX 必须在系统命令范围内。
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
BOOL bNameValid;
CString strAboutMenu;
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
ASSERT(bNameValid);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
// 执行此操作
SetIcon(m_hIcon, TRUE); // 设置大图标
SetIcon(m_hIcon, FALSE); // 设置小图标
TCHAR rgtsz[3][10] = {_T("姓名"), _T("身份证"), _T(" ")};
LV_COLUMN lvcolumn;
CRect rect;
mList.GetWindowRect(&rect);
for(int i=0;i<3;i++)
{
lvcolumn.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH | LVCF_ORDER|LVS_EX_FULLROWSELECT;
lvcolumn.fmt = LVCFMT_CENTER;
lvcolumn.pszText = rgtsz[i];
lvcolumn.iSubItem = i;lvcolumn.iOrder = i;
if(i==0) {
lvcolumn.cx = rect.Width()*1/5 ;
}
else
lvcolumn.cx = rect.Width()*2/5;
mList.InsertColumn(i, &lvcolumn);
}
int row=0, column=0;
char **result = 0;
result = CSqliteUtil::instance()->read_all(&row, &column);
int l = 0;
for (int j = 0; j < row; j++) {
mList.InsertItem(j , CString(result[(j+1) * column + 2]).GetString());
mList.SetItemText(j, 1, CString(result[(j+1) * column + 3]).GetString());
mList.SetItemText(j, 2, _T("选择"));
}
CSqliteUtil::instance()->clear(result);
if (CRegegitKey::check_reg()) {
MessageBox(_T("初始化完成"),_T("欢迎使用"),MB_OK);
CDialogEx::OnOK();
return TRUE;
}
if (0 != Login()) {
MessageBox(_T("登录失败,请检查网络,如仍有错误,请联系技术支持!"),_T("错误"),MB_OK);
CDialogEx::OnOK();
return TRUE;
}
if (mMain.start()) {
MessageBox(_T("当前没有文件需要上传"),_T("提示信息"),MB_OK);
CDialogEx::OnOK();
}
return TRUE;
}
void CHealthHutUiDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialogEx::OnSysCommand(nID, lParam);
}
}
// 如果向对话框添加最小化按钮,则需要下面的代码
// 来绘制该图标。对于使用文档/视图模型的 MFC 应用程序,
// 这将由框架自动完成。
void CHealthHutUiDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // 用于绘制的设备上下文
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// 使图标在工作区矩形中居中
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// 绘制图标
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialogEx::OnPaint();
}
}
//当用户拖动最小化窗口时系统调用此函数取得光标
//显示。
HCURSOR CHealthHutUiDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CHealthHutUiDlg::OnBnClickedOk()
{
CString name;
mName.GetWindowText(name);
CString idCard;
mCard.GetWindowText(idCard);
if (name.GetLength() == 0)
{
MessageBox(_T("请填写姓名"),_T("提示"),MB_OK);
return;
}
if (idCard.GetLength() == 0)
{
MessageBox(_T("请填写身份证"),_T("提示"),MB_OK);
return;
}
int ret = search(name, idCard);
if (1 == ret)
{
MessageBox(_T("查询信息失败"),_T("提示"),MB_OK);
}
std::vector<CString> names = getNames();
std::vector<CString> ids = getIds();
if (0 == names.size() || 0 == ids.size())
{
MessageBox(_T("抱歉,机构内无此长者,请确认!"),_T("提示"),MB_OK);
mName.SetWindowTextW(_T(""));
mCard.SetWindowTextW(_T(""));
return;
}
mList.DeleteAllItems();
for (int i = 0; i < names.size(); i++)
{
mList.InsertItem(i, names.at(i));
mList.SetItemText(i, 1, ids.at(i));
mList.SetItemText(i, 2, _T("选择"));
}
}
void CHealthHutUiDlg::OnTimer(UINT_PTR nIDEvent)
{
}
int CHealthHutUiDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialogEx::OnCreate(lpCreateStruct) == -1)
return -1;
SetTimer(LOCAL_TIMER, 3000, 0);
mMain.init();
CSqliteUtil::instance()->init();
return 0;
}
void CHealthHutUiDlg::OnClose()
{
CDialogEx::OnOK();
}
void CHealthHutUiDlg::OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
DWORD dwPos = GetMessagePos();
CPoint point( LOWORD(dwPos), HIWORD(dwPos) );
mList.ScreenToClient(&point);
LVHITTESTINFO lvinfo;
lvinfo.pt = point;
lvinfo.flags = LVHT_ABOVE;
int nItem = mList.SubItemHitTest(&lvinfo);
if(nItem != -1)
{
if (lvinfo.iSubItem != 2) {
return;
}
CString name = mList.GetItemText(lvinfo.iItem, 0);
CString idCard = mList.GetItemText(lvinfo.iItem, 1);
CString path = mMain.getPath();
if (CUpload::upload(path, name, idCard)) {
MessageBox(_T("数据上传成功"),_T("提示"),MB_OK);
}
else {
MessageBox(_T("数据上传失败"),_T("提示"),MB_OK);
}
}
CDialogEx::OnOK();
*pResult = 0;
}
// HealthHutUiDlg.h : 头文件
//
#pragma once
#include "MainApp.h"
#include "afxcmn.h"
#include "afxwin.h"
// CHealthHutUiDlg 对话框
class CHealthHutUiDlg : public CDialogEx
{
// 构造
public:
CHealthHutUiDlg(CWnd* pParent = NULL); // 标准构造函数
// 对话框数据
enum { IDD = IDD_HEALTHHUTUI_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
HICON m_hIcon;
// 生成的消息映射函数
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedOk();
public:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
private:
CMainApp mMain;
public:
afx_msg void OnClose();
CListCtrl mList;
afx_msg void OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult);
CEdit mName;
CEdit mCard;
};
This diff is collapsed.
#pragma once
#if !defined(AFX_MD5CHECKSUM_H__2BC7928E_4C15_11D3_B2EE_A4A60E20D2C3__INCLUDED_)
#define AFX_MD5CHECKSUM_H__2BC7928E_4C15_11D3_B2EE_A4A60E20D2C3__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/*****************************************************************************************
*****************************************************************************************/
#include "stdafx.h"
class CMD5Checksum
{
public:
static CString GetMD5OfString(CString strString);
//interface functions for the RSA MD5 calculation
static CString GetMD5(const CString& strFilePath);
protected:
//constructor/destructor
CMD5Checksum();
virtual ~CMD5Checksum() {};
//RSA MD5 implementation
void Transform(BYTE Block[64]);
void Update(BYTE* Input, ULONG nInputLen);
CString Final();
inline DWORD RotateLeft(DWORD x, int n);
inline void FF( DWORD& A, DWORD B, DWORD C, DWORD D, DWORD X, DWORD S, DWORD T);
inline void GG( DWORD& A, DWORD B, DWORD C, DWORD D, DWORD X, DWORD S, DWORD T);
inline void HH( DWORD& A, DWORD B, DWORD C, DWORD D, DWORD X, DWORD S, DWORD T);
inline void II( DWORD& A, DWORD B, DWORD C, DWORD D, DWORD X, DWORD S, DWORD T);
//utility functions
inline void DWordToByte(BYTE* Output, DWORD* Input, UINT nLength);
inline void ByteToDWord(DWORD* Output, BYTE* Input, UINT nLength);
private:
BYTE m_lpszBuffer[64]; //input buffer
ULONG m_nCount[2]; //number of bits, modulo 2^64 (lsb first)
ULONG m_lMD5[4]; //MD5 checksum
};
#endif // !defined(AFX_MD5CHECKSUM_H__2BC7928E_4C15_11D3_B2EE_A4A60E20D2C3__INCLUDED_)
\ No newline at end of file
#pragma once
//Magic initialization constants
#define MD5_INIT_STATE_0 0x67452301
#define MD5_INIT_STATE_1 0xefcdab89
#define MD5_INIT_STATE_2 0x98badcfe
#define MD5_INIT_STATE_3 0x10325476
//Constants for Transform routine.
#define MD5_S11 7
#define MD5_S12 12
#define MD5_S13 17
#define MD5_S14 22
#define MD5_S21 5
#define MD5_S22 9
#define MD5_S23 14
#define MD5_S24 20
#define MD5_S31 4
#define MD5_S32 11
#define MD5_S33 16
#define MD5_S34 23
#define MD5_S41 6
#define MD5_S42 10
#define MD5_S43 15
#define MD5_S44 21
//Transformation Constants - Round 1
#define MD5_T01 0xd76aa478 //Transformation Constant 1
#define MD5_T02 0xe8c7b756 //Transformation Constant 2
#define MD5_T03 0x242070db //Transformation Constant 3
#define MD5_T04 0xc1bdceee //Transformation Constant 4
#define MD5_T05 0xf57c0faf //Transformation Constant 5
#define MD5_T06 0x4787c62a //Transformation Constant 6
#define MD5_T07 0xa8304613 //Transformation Constant 7
#define MD5_T08 0xfd469501 //Transformation Constant 8
#define MD5_T09 0x698098d8 //Transformation Constant 9
#define MD5_T10 0x8b44f7af //Transformation Constant 10
#define MD5_T11 0xffff5bb1 //Transformation Constant 11
#define MD5_T12 0x895cd7be //Transformation Constant 12
#define MD5_T13 0x6b901122 //Transformation Constant 13
#define MD5_T14 0xfd987193 //Transformation Constant 14
#define MD5_T15 0xa679438e //Transformation Constant 15
#define MD5_T16 0x49b40821 //Transformation Constant 16
//Transformation Constants - Round 2
#define MD5_T17 0xf61e2562 //Transformation Constant 17
#define MD5_T18 0xc040b340 //Transformation Constant 18
#define MD5_T19 0x265e5a51 //Transformation Constant 19
#define MD5_T20 0xe9b6c7aa //Transformation Constant 20
#define MD5_T21 0xd62f105d //Transformation Constant 21
#define MD5_T22 0x02441453 //Transformation Constant 22
#define MD5_T23 0xd8a1e681 //Transformation Constant 23
#define MD5_T24 0xe7d3fbc8 //Transformation Constant 24
#define MD5_T25 0x21e1cde6 //Transformation Constant 25
#define MD5_T26 0xc33707d6 //Transformation Constant 26
#define MD5_T27 0xf4d50d87 //Transformation Constant 27
#define MD5_T28 0x455a14ed //Transformation Constant 28
#define MD5_T29 0xa9e3e905 //Transformation Constant 29
#define MD5_T30 0xfcefa3f8 //Transformation Constant 30
#define MD5_T31 0x676f02d9 //Transformation Constant 31
#define MD5_T32 0x8d2a4c8a //Transformation Constant 32
//Transformation Constants - Round 3
#define MD5_T33 0xfffa3942 //Transformation Constant 33
#define MD5_T34 0x8771f681 //Transformation Constant 34
#define MD5_T35 0x6d9d6122 //Transformation Constant 35
#define MD5_T36 0xfde5380c //Transformation Constant 36
#define MD5_T37 0xa4beea44 //Transformation Constant 37
#define MD5_T38 0x4bdecfa9 //Transformation Constant 38
#define MD5_T39 0xf6bb4b60 //Transformation Constant 39
#define MD5_T40 0xbebfbc70 //Transformation Constant 40
#define MD5_T41 0x289b7ec6 //Transformation Constant 41
#define MD5_T42 0xeaa127fa //Transformation Constant 42
#define MD5_T43 0xd4ef3085 //Transformation Constant 43
#define MD5_T44 0x04881d05 //Transformation Constant 44
#define MD5_T45 0xd9d4d039 //Transformation Constant 45
#define MD5_T46 0xe6db99e5 //Transformation Constant 46
#define MD5_T47 0x1fa27cf8 //Transformation Constant 47
#define MD5_T48 0xc4ac5665 //Transformation Constant 48
//Transformation Constants - Round 4
#define MD5_T49 0xf4292244 //Transformation Constant 49
#define MD5_T50 0x432aff97 //Transformation Constant 50
#define MD5_T51 0xab9423a7 //Transformation Constant 51
#define MD5_T52 0xfc93a039 //Transformation Constant 52
#define MD5_T53 0x655b59c3 //Transformation Constant 53
#define MD5_T54 0x8f0ccc92 //Transformation Constant 54
#define MD5_T55 0xffeff47d //Transformation Constant 55
#define MD5_T56 0x85845dd1 //Transformation Constant 56
#define MD5_T57 0x6fa87e4f //Transformation Constant 57
#define MD5_T58 0xfe2ce6e0 //Transformation Constant 58
#define MD5_T59 0xa3014314 //Transformation Constant 59
#define MD5_T60 0x4e0811a1 //Transformation Constant 60
#define MD5_T61 0xf7537e82 //Transformation Constant 61
#define MD5_T62 0xbd3af235 //Transformation Constant 62
#define MD5_T63 0x2ad7d2bb //Transformation Constant 63
#define MD5_T64 0xeb86d391 //Transformation Constant 64
//Null data (except for first BYTE) used to finalise the checksum calculation
static unsigned char PADDING[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
\ No newline at end of file
#include "stdafx.h"
#include "MainApp.h"
#include "RegegitKey.h"
#include "utils.h"
CMainApp::CMainApp(void)
{
}
CMainApp::~CMainApp(void)
{
}
void CMainApp::init()
{
}
BOOL CMainApp::start()
{
LPBYTE value = new BYTE[512];
DWORD dataLength = 256;
if (!CRegegitKey::read_app_key(APP_PATH, value, &dataLength)) {
MessageBox(NULL, _T("ȡעʧ"),_T("ʾ"),MB_OK);
return TRUE;
}
CString imagePath;
LpbyteToCString(value, imagePath, dataLength);
//imagePath.Append(IMAGE_PATH_SUBSTREET);
DEBUG_OUTW(imagePath.GetString());
BOOL ret = mFiles.list_files(imagePath.GetString());
safe_delete(value);
return ret;
}
CString& CMainApp::getPath()
{
return mFiles.getPath();
}
void CMainApp::stop()
{
}
\ No newline at end of file
#pragma once
#include "FileList.h"
class CMainApp
{
public:
CMainApp(void);
~CMainApp(void);
BOOL start();
void stop();
void init();
CString& getPath();
private:
CFileList mFiles;
};
================================================================================
MICROSOFT 基础类库 : HealthHutUi 项目概述
===============================================================================
应用程序向导已为您创建了此 HealthHutUi 应用程序。此应用程序不仅演示 Microsoft 基础类的基本使用方法,还可作为您编写应用程序的起点。
本文件概要介绍组成 HealthHutUi 应用程序的每个文件的内容。
HealthHutUi.vcxproj
这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
HealthHutUi.vcxproj.filters
这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
HealthHutUi.h
这是应用程序的主头文件。
其中包括其他项目特定的标头(包括 Resource.h),并声明 CHealthHutUiApp 应用程序类。
HealthHutUi.cpp
这是包含应用程序类 CHealthHutUiApp 的主应用程序源文件。
HealthHutUi.rc
这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。项目资源包含在 2052 中。
res\HealthHutUi.ico
这是用作应用程序图标的图标文件。此图标包括在主资源文件 HealthHutUi.rc 中。
res\HealthHutUi.rc2
此文件包含不在 Microsoft Visual C++ 中进行编辑的资源。您应该将不可由资源编辑器编辑的所有资源放在此文件中。
/////////////////////////////////////////////////////////////////////////////
应用程序向导创建一个对话框类:
HealthHutUiDlg.h、HealthHutUiDlg.cpp - 对话框
这些文件包含 CHealthHutUiDlg 类。此类定义应用程序的主对话框的行为。对话框模板包含在 HealthHutUi.rc 中,该文件可以在 Microsoft Visual C++ 中编辑。
/////////////////////////////////////////////////////////////////////////////
其他功能:
ActiveX 控件
该应用程序包含对使用 ActiveX 控件的支持。
/////////////////////////////////////////////////////////////////////////////
其他标准文件:
StdAfx.h, StdAfx.cpp
这些文件用于生成名为 HealthHutUi.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
Resource.h
这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。
HealthHutUi.manifest
Windows XP 使用应用程序清单文件来描述特定版本的并行程序集的应用程序依赖项。加载程序使用这些信息来从程序集缓存中加载相应的程序集,并保护其不被应用程序访问。应用程序清单可能会包含在内,以作为与应用程序可执行文件安装在同一文件夹中的外部 .manifest 文件进行重新分发,它还可能以资源的形式包含在可执行文件中。
/////////////////////////////////////////////////////////////////////////////
其他注释:
应用程序向导使用“TODO:”来指示应添加或自定义的源代码部分。
如果应用程序使用共享 DLL 中的 MFC,您将需要重新分发 MFC DLL。如果应用程序所使用的语言与操作系统的区域设置不同,则还需要重新分发相应的本地化资源 mfc110XXX.DLL。
有关上述话题的更多信息,请参见 MSDN 文档中有关重新分发 Visual C++ 应用程序的部分。
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "utils.h"
#include "RegegitKey.h"
#include <windows.h>
CRegegitKey::CRegegitKey(void)
{
}
CRegegitKey::~CRegegitKey(void)
{
}
void CRegegitKey::insert_exe(HKEY hKEY)
{
WCHAR pFileName[MAX_PATH];
int nPos = GetCurrentDirectory(MAX_PATH, pFileName);
CString exeName = CString(pFileName) + EXE_NAME;
LPCTSTR strUserValue = exeName.GetString();
long ret = ::RegSetValueEx(hKEY, REGEDIT_EXE_PATH, 0, REG_SZ, (const BYTE *) strUserValue, wcslen(strUserValue) * 2+1);
}
void CRegegitKey::insert_flag(HKEY hKEY)
{
LPCTSTR strUserValue = _T("true");
long ret = ::RegSetValueEx(hKEY, LOAD_APP_FLAG, 0, REG_SZ, (const BYTE *) strUserValue, wcslen (strUserValue) * 2+1);
}
void CRegegitKey::insert_out(HKEY hKEY)
{
WCHAR pFileName[MAX_PATH];
GetAppPath(pFileName);
CString exeName = CString(pFileName) + _T("\\image");
CString strUser = _T("path");
LPCTSTR strUserValue = exeName.GetString();
long ret = ::RegSetValueEx(hKEY, strUser, 0, REG_SZ, (const BYTE *) strUserValue, wcslen(strUserValue) * 2+1);
}
BOOL CRegegitKey::check_reg()
{
HKEY hKEY;
long ret0=(RegOpenKeyEx(KEY_ROOT, SUB_KEY_PARENT, 0, KEY64 | KEY_READ |KEY_WRITE, &hKEY));
if (ret0 != ERROR_SUCCESS) {
return FALSE;
}
LPBYTE getValue = new BYTE[80];//得到的键值
DWORD keyType = REG_SZ;//定义数据类型
DWORD DataLen = 80;//定义数据长度
CString strUser = LOAD_APP_FLAG;//要查询的键名称
long ret1 = RegQueryValueEx(hKEY, strUser, NULL, &keyType, getValue, &DataLen);
if (ret1 != ERROR_SUCCESS)
{
delete getValue;
return FALSE;
}
if (*getValue == 't') {
RegCloseKey(hKEY);
delete getValue;
return FALSE;
}
insert_exe(hKEY);
insert_flag(hKEY);
insert_out(hKEY);
insert_local_path();
RegCloseKey(hKEY);
delete getValue;
return TRUE;
}
BOOL CRegegitKey::read_key(LPCWSTR key, LPBYTE value, LPDWORD dataLength)
{
HKEY hKEY;
long ret0=(RegOpenKeyEx(KEY_ROOT, SUB_KEY_PARENT, 0, KEY64 | KEY_READ |KEY_WRITE, &hKEY));
if (ret0 != ERROR_SUCCESS) {
return FALSE;
}
LPBYTE getValue = new BYTE[256];
DWORD keyType = REG_SZ;
long ret1 = RegQueryValueEx(hKEY, key, NULL, &keyType, value, dataLength);
if (ret1 != ERROR_SUCCESS)
{
delete getValue;
return FALSE;
}
RegCloseKey(hKEY);
delete getValue;
return TRUE;
}
BOOL CRegegitKey::read_app_key(LPCWSTR key, LPBYTE value, LPDWORD dataLength)
{
HKEY hKEY;
long ret0=(RegOpenKeyEx(HKEY_CURRENT_USER, APP_KEY_ROOT, 0, KEY64 | KEY_READ |KEY_WRITE, &hKEY));
if (ret0 != ERROR_SUCCESS) {
return FALSE;
}
LPBYTE getValue = new BYTE[256];
DWORD keyType = REG_SZ;
long ret1 = RegQueryValueEx(hKEY, key, NULL, &keyType, value, dataLength);
if (ret1 != ERROR_SUCCESS)
{
delete getValue;
return FALSE;
}
RegCloseKey(hKEY);
delete getValue;
return TRUE;
}
void CRegegitKey::insert_local_path()
{
HKEY hKey;
DWORD dw;
LONG reg = RegCreateKeyEx(HKEY_CURRENT_USER, APP_KEY_ROOT, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY64|KEY_READ|KEY_WRITE, NULL, &hKey, &dw);
WCHAR path[MAX_PATH];
GetAppPath(path);
CString strUser(APP_PATH);
LPCTSTR strUserValue(path);
long ret = ::RegSetValueEx(hKey, strUser, 0, REG_SZ, (const BYTE *) strUserValue, wcslen(strUserValue) * 2+1);
RegCloseKey(hKey);
}
#pragma once
class CRegegitKey
{
public:
CRegegitKey(void);
~CRegegitKey(void);
public:
static BOOL check_reg();
static BOOL read_key(LPCWSTR key, LPBYTE value, LPDWORD dataLength);
static BOOL read_app_key(LPCWSTR key, LPBYTE value, LPDWORD dataLength);
private:
static void insert_flag(HKEY hKEY);
static void insert_exe(HKEY hKEY);
static void insert_out(HKEY hKEY);
static void insert_local_path();
};
#include "stdafx.h"
#include "SqliteUtil.h"
#include "sqlite3.h"
#ifdef _DEBUG
#include <iostream>
#endif
CSqliteUtil *CSqliteUtil::mInstance;
CSqliteUtil::CSqliteUtil(void)
{
mInstance = NULL;
mDatebaase = NULL;
}
CSqliteUtil::~CSqliteUtil(void)
{
}
void CSqliteUtil::init()
{
open();
}
CSqliteUtil* CSqliteUtil::instance()
{
if (NULL == mInstance) {
mInstance = new CSqliteUtil();
}
return mInstance;
}
void CSqliteUtil::open()
{
char *errMsg;
sqlite3_open("datebase.db", &mDatebaase);
char *sql = "CREATE TABLE upload_data(\
ID INTEGER PRIMARY KEY,\
md5 VARCHAR(32),\
id_card VARCHAR(40),\
file_path VARCHAR(255),\
name VARCHAR(36),\
upload INTEGER\
);";
sqlite3_exec(mDatebaase, sql , 0 , 0 , &errMsg);
}
void CSqliteUtil::close()
{
sqlite3_close(mDatebaase);
}
BOOL CSqliteUtil::exist(const CString& path)
{
char sql[1024];
USES_CONVERSION;
_snprintf(sql, 1024, "select * from upload_data where file_path = '%s'", T2A(path));
#ifdef _DEBUG
std::cout<<sql<<std::endl;
#endif
return false;
}
void CSqliteUtil::clear(char **result)
{
sqlite3_free_table(result);
}
char **CSqliteUtil::read_all(int *row, int *column)
{
char *zErrMsg = 0;
char **result = 0;
char *sql = "select * from upload_data where upload != '0'";
sqlite3_get_table(mDatebaase, sql, &result, row, column, &zErrMsg);
for(int i=0;i<((*row)+1)* (*column);i++)
printf("result[%d]=%s\n",i,result[i]);
return result;
}
\ No newline at end of file
#pragma once
#include "sqlite3.h"
class CSqliteUtil
{
public:
~CSqliteUtil(void);
static CSqliteUtil* instance();
void init();
void close();
char **read_all(int *row, int *column);
BOOL exist(const CString& path);
void clear(char **result);
private:
void open();
CSqliteUtil(void);
private:
sqlite3 *mDatebaase;
static CSqliteUtil* mInstance;
};
#include "stdafx.h"
#include "Upload.h"
#include "utils.h"
#include <wininet.h>
#include <afxinet.h>
CString CUpload::mErrMsg;
static BOOL UploadFile(LPCTSTR strURL, LPCTSTR strLocalFileName);
CUpload::CUpload(void)
{
}
CUpload::~CUpload(void)
{
}
BOOL CUpload::upload(CString& path, CString& name, CString& idCard)
{
return util_upload(name, idCard, path);
}
CString& CUpload::getErrMsg()
{
return mErrMsg;
}
BOOL UploadFile(LPCTSTR strURL, LPCTSTR strLocalFileName)
{
ASSERT(strURL != NULL && strLocalFileName != NULL);
BOOL bResult = FALSE;
DWORD dwType = 0;
CString strServer;
CString strObject;
INTERNET_PORT wPort = 0;
DWORD dwFileLength = 0;
char * pFileBuff = NULL;
CHttpConnection * pHC = NULL;
CHttpFile * pHF = NULL;
CInternetSession cis;
bResult = AfxParseURL(strURL, dwType, strServer, strObject, wPort);
if(!bResult)
return FALSE;
CFile file;
try
{
if(!file.Open(strLocalFileName, CFile::shareDenyNone | CFile::modeRead))
return FALSE;
dwFileLength = file.GetLength();
if(dwFileLength <= 0)
return FALSE;
pFileBuff = new char[dwFileLength];
memset(pFileBuff, 0, sizeof(char) * dwFileLength);
file.Read(pFileBuff, dwFileLength);
const int nTimeOut = 5000;
cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, nTimeOut); //联接超时设置
cis.SetOption(INTERNET_OPTION_CONNECT_RETRIES, 1); //重试1次
pHC = cis.GetHttpConnection(strServer, wPort); //取得一个Http联接
pHF = pHC->OpenRequest(CHttpConnection::HTTP_VERB_POST, strObject);
if(!pHF->SendRequest(NULL, 0, pFileBuff, dwFileLength))
{
delete[]pFileBuff;
pFileBuff = NULL;
pHF->Close();
pHC->Close();
cis.Close();
return FALSE;
}
DWORD dwStateCode = 0;
pHF->QueryInfoStatusCode(dwStateCode);
if(dwStateCode == HTTP_STATUS_OK)
bResult = TRUE;
}
catch(CInternetException * pEx)
{
TCHAR sz[256] = _T("");
pEx->GetErrorMessage(sz, 25);
AfxMessageBox(CString(sz));
}
catch(CFileException& fe)
{
CString str;
str.Format(L"FileException occur!\r\n%d", fe.m_lOsError);
AfxMessageBox(str);
}
catch(...)
{
ShowErrBox(GetLastError());
}
delete[]pFileBuff;
pFileBuff = NULL;
file.Close();
pHF->Close();
pHC->Close();
cis.Close();
return bResult;
}
#pragma once
#include "stdafx.h"
class CUpload
{
public:
CUpload(void);
~CUpload(void);
static BOOL upload(CString& path, CString& name, CString& idCard);
static CString& getErrMsg();
private:
static CString mErrMsg;
};
#ifndef JSON_AUTOLINK_H_INCLUDED
# define JSON_AUTOLINK_H_INCLUDED
# include "config.h"
# ifdef JSON_IN_CPPTL
# include <cpptl/cpptl_autolink.h>
# endif
# if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && !defined(JSON_IN_CPPTL)
# define CPPTL_AUTOLINK_NAME "json"
# undef CPPTL_AUTOLINK_DLL
# ifdef JSON_DLL
# define CPPTL_AUTOLINK_DLL
# endif
# include "autolink.h"
# endif
#endif // JSON_AUTOLINK_H_INCLUDED
#ifndef JSON_CONFIG_H_INCLUDED
# define JSON_CONFIG_H_INCLUDED
/// If defined, indicates that json library is embedded in CppTL library.
//# define JSON_IN_CPPTL 1
/// If defined, indicates that json may leverage CppTL library
//# define JSON_USE_CPPTL 1
/// If defined, indicates that cpptl vector based map should be used instead of std::map
/// as Value container.
//# define JSON_USE_CPPTL_SMALLMAP 1
/// If defined, indicates that Json specific container should be used
/// (hash table & simple deque container with customizable allocator).
/// THIS FEATURE IS STILL EXPERIMENTAL!
//# define JSON_VALUE_USE_INTERNAL_MAP 1
/// Force usage of standard new/malloc based allocator instead of memory pool based allocator.
/// The memory pools allocator used optimization (initializing Value and ValueInternalLink
/// as if it was a POD) that may cause some validation tool to report errors.
/// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined.
//# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1
/// If defined, indicates that Json use exception to report invalid type manipulation
/// instead of C assert macro.
# define JSON_USE_EXCEPTION 1
# ifdef JSON_IN_CPPTL
# include <cpptl/config.h>
# ifndef JSON_USE_CPPTL
# define JSON_USE_CPPTL 1
# endif
# endif
# ifdef JSON_IN_CPPTL
# define JSON_API CPPTL_API
# elif defined(JSON_DLL_BUILD)
# define JSON_API __declspec(dllexport)
# elif defined(JSON_DLL)
# define JSON_API __declspec(dllimport)
# else
# define JSON_API
# endif
#endif // JSON_CONFIG_H_INCLUDED
#ifndef CPPTL_JSON_FEATURES_H_INCLUDED
# define CPPTL_JSON_FEATURES_H_INCLUDED
# include "forwards.h"
namespace Json {
/** \brief Configuration passed to reader and writer.
* This configuration object can be used to force the Reader or Writer
* to behave in a standard conforming way.
*/
class JSON_API Features
{
public:
/** \brief A configuration that allows all features and assumes all strings are UTF-8.
* - C & C++ comments are allowed
* - Root object can be any JSON value
* - Assumes Value strings are encoded in UTF-8
*/
static Features all();
/** \brief A configuration that is strictly compatible with the JSON specification.
* - Comments are forbidden.
* - Root object must be either an array or an object value.
* - Assumes Value strings are encoded in UTF-8
*/
static Features strictMode();
/** \brief Initialize the configuration like JsonConfig::allFeatures;
*/
Features();
/// \c true if comments are allowed. Default: \c true.
bool allowComments_;
/// \c true if root must be either an array or an object value. Default: \c false.
bool strictRoot_;
};
} // namespace Json
#endif // CPPTL_JSON_FEATURES_H_INCLUDED
#ifndef JSON_FORWARDS_H_INCLUDED
# define JSON_FORWARDS_H_INCLUDED
# include "config.h"
namespace Json {
// writer.h
class FastWriter;
class StyledWriter;
// reader.h
class Reader;
// features.h
class Features;
// value.h
typedef int Int;
typedef unsigned int UInt;
class StaticString;
class Path;
class PathArgument;
class Value;
class ValueIteratorBase;
class ValueIterator;
class ValueConstIterator;
#ifdef JSON_VALUE_USE_INTERNAL_MAP
class ValueAllocator;
class ValueMapAllocator;
class ValueInternalLink;
class ValueInternalArray;
class ValueInternalMap;
#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP
} // namespace Json
#endif // JSON_FORWARDS_H_INCLUDED
#ifndef JSON_JSON_H_INCLUDED
# define JSON_JSON_H_INCLUDED
# include "autolink.h"
# include "value.h"
# include "reader.h"
# include "writer.h"
# include "features.h"
#endif // JSON_JSON_H_INCLUDED
#ifndef CPPTL_JSON_READER_H_INCLUDED
# define CPPTL_JSON_READER_H_INCLUDED
# include "features.h"
# include "value.h"
# include <deque>
# include <stack>
# include <string>
# include <iostream>
namespace Json {
/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a Value.
*
*/
class JSON_API Reader
{
public:
typedef char Char;
typedef const Char *Location;
/** \brief Constructs a Reader allowing all features
* for parsing.
*/
Reader();
/** \brief Constructs a Reader allowing the specified feature set
* for parsing.
*/
Reader( const Features &features );
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> document.
* \param document UTF-8 encoded string containing the document to read.
* \param root [out] Contains the root value of the document if it was
* successfully parsed.
* \param collectComments \c true to collect comment and allow writing them back during
* serialization, \c false to discard comments.
* This parameter is ignored if Features::allowComments_
* is \c false.
* \return \c true if the document was successfully parsed, \c false if an error occurred.
*/
bool parse( const std::string &document,
Value &root,
bool collectComments = true );
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> document.
* \param document UTF-8 encoded string containing the document to read.
* \param root [out] Contains the root value of the document if it was
* successfully parsed.
* \param collectComments \c true to collect comment and allow writing them back during
* serialization, \c false to discard comments.
* This parameter is ignored if Features::allowComments_
* is \c false.
* \return \c true if the document was successfully parsed, \c false if an error occurred.
*/
bool parse( const char *beginDoc, const char *endDoc,
Value &root,
bool collectComments = true );
/// \brief Parse from input stream.
/// \see Json::operator>>(std::istream&, Json::Value&).
bool parse( std::istream &is,
Value &root,
bool collectComments = true );
/** \brief Returns a user friendly string that list errors in the parsed document.
* \return Formatted error message with the list of errors with their location in
* the parsed document. An empty string is returned if no error occurred
* during parsing.
*/
std::string getFormatedErrorMessages() const;
private:
enum TokenType
{
tokenEndOfStream = 0,
tokenObjectBegin,
tokenObjectEnd,
tokenArrayBegin,
tokenArrayEnd,
tokenString,
tokenNumber,
tokenTrue,
tokenFalse,
tokenNull,
tokenArraySeparator,
tokenMemberSeparator,
tokenComment,
tokenError
};
class Token
{
public:
TokenType type_;
Location start_;
Location end_;
};
class ErrorInfo
{
public:
Token token_;
std::string message_;
Location extra_;
};
typedef std::deque<ErrorInfo> Errors;
bool expectToken( TokenType type, Token &token, const char *message );
bool readToken( Token &token );
void skipSpaces();
bool match( Location pattern,
int patternLength );
bool readComment();
bool readCStyleComment();
bool readCppStyleComment();
bool readString();
void readNumber();
bool readValue();
bool readObject( Token &token );
bool readArray( Token &token );
bool decodeNumber( Token &token );
bool decodeString( Token &token );
bool decodeString( Token &token, std::string &decoded );
bool decodeDouble( Token &token );
bool decodeUnicodeCodePoint( Token &token,
Location &current,
Location end,
unsigned int &unicode );
bool decodeUnicodeEscapeSequence( Token &token,
Location &current,
Location end,
unsigned int &unicode );
bool addError( const std::string &message,
Token &token,
Location extra = 0 );
bool recoverFromError( TokenType skipUntilToken );
bool addErrorAndRecover( const std::string &message,
Token &token,
TokenType skipUntilToken );
void skipUntilSpace();
Value &currentValue();
Char getNextChar();
void getLocationLineAndColumn( Location location,
int &line,
int &column ) const;
std::string getLocationLineAndColumn( Location location ) const;
void addComment( Location begin,
Location end,
CommentPlacement placement );
void skipCommentTokens( Token &token );
typedef std::stack<Value *> Nodes;
Nodes nodes_;
Errors errors_;
std::string document_;
Location begin_;
Location end_;
Location current_;
Location lastValueEnd_;
Value *lastValue_;
std::string commentsBefore_;
Features features_;
bool collectComments_;
};
/** \brief Read from 'sin' into 'root'.
Always keep comments from the input JSON.
This can be used to read a file into a particular sub-object.
For example:
\code
Json::Value root;
cin >> root["dir"]["file"];
cout << root;
\endcode
Result:
\verbatim
{
"dir": {
"file": {
// The input stream JSON would be nested here.
}
}
}
\endverbatim
\throw std::exception on parse error.
\see Json::operator<<()
*/
std::istream& operator>>( std::istream&, Value& );
} // namespace Json
#endif // CPPTL_JSON_READER_H_INCLUDED
This diff is collapsed.
#ifndef JSON_WRITER_H_INCLUDED
# define JSON_WRITER_H_INCLUDED
# include "value.h"
# include <vector>
# include <string>
# include <iostream>
namespace Json {
class Value;
/** \brief Abstract class for writers.
*/
class JSON_API Writer
{
public:
virtual ~Writer();
virtual std::string write( const Value &root ) = 0;
};
/** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format without formatting (not human friendly).
*
* The JSON document is written in a single line. It is not intended for 'human' consumption,
* but may be usefull to support feature such as RPC where bandwith is limited.
* \sa Reader, Value
*/
class JSON_API FastWriter : public Writer
{
public:
FastWriter();
virtual ~FastWriter(){}
void enableYAMLCompatibility();
public: // overridden from Writer
virtual std::string write( const Value &root );
private:
void writeValue( const Value &value );
std::string document_;
bool yamlCompatiblityEnabled_;
};
/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a human friendly way.
*
* The rules for line break and indent are as follow:
* - Object value:
* - if empty then print {} without indent and line break
* - if not empty the print '{', line break & indent, print one value per line
* and then unindent and line break and print '}'.
* - Array value:
* - if empty then print [] without indent and line break
* - if the array contains no object value, empty array or some other value types,
* and all the values fit on one lines, then print the array on a single line.
* - otherwise, it the values do not fit on one line, or the array contains
* object or non empty array, then print one value per line.
*
* If the Value have comments then they are outputed according to their #CommentPlacement.
*
* \sa Reader, Value, Value::setComment()
*/
class JSON_API StyledWriter: public Writer
{
public:
StyledWriter();
virtual ~StyledWriter(){}
public: // overridden from Writer
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
* \param root Value to serialize.
* \return String containing the JSON document that represents the root value.
*/
virtual std::string write( const Value &root );
private:
void writeValue( const Value &value );
void writeArrayValue( const Value &value );
bool isMultineArray( const Value &value );
void pushValue( const std::string &value );
void writeIndent();
void writeWithIndent( const std::string &value );
void indent();
void unindent();
void writeCommentBeforeValue( const Value &root );
void writeCommentAfterValueOnSameLine( const Value &root );
bool hasCommentForValue( const Value &value );
static std::string normalizeEOL( const std::string &text );
typedef std::vector<std::string> ChildValues;
ChildValues childValues_;
std::string document_;
std::string indentString_;
int rightMargin_;
int indentSize_;
bool addChildValues_;
};
/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a human friendly way,
to a stream rather than to a string.
*
* The rules for line break and indent are as follow:
* - Object value:
* - if empty then print {} without indent and line break
* - if not empty the print '{', line break & indent, print one value per line
* and then unindent and line break and print '}'.
* - Array value:
* - if empty then print [] without indent and line break
* - if the array contains no object value, empty array or some other value types,
* and all the values fit on one lines, then print the array on a single line.
* - otherwise, it the values do not fit on one line, or the array contains
* object or non empty array, then print one value per line.
*
* If the Value have comments then they are outputed according to their #CommentPlacement.
*
* \param indentation Each level will be indented by this amount extra.
* \sa Reader, Value, Value::setComment()
*/
class JSON_API StyledStreamWriter
{
public:
StyledStreamWriter( std::string indentation="\t" );
~StyledStreamWriter(){}
public:
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
* \param out Stream to write to. (Can be ostringstream, e.g.)
* \param root Value to serialize.
* \note There is no point in deriving from Writer, since write() should not return a value.
*/
void write( std::ostream &out, const Value &root );
private:
void writeValue( const Value &value );
void writeArrayValue( const Value &value );
bool isMultineArray( const Value &value );
void pushValue( const std::string &value );
void writeIndent();
void writeWithIndent( const std::string &value );
void indent();
void unindent();
void writeCommentBeforeValue( const Value &root );
void writeCommentAfterValueOnSameLine( const Value &root );
bool hasCommentForValue( const Value &value );
static std::string normalizeEOL( const std::string &text );
typedef std::vector<std::string> ChildValues;
ChildValues childValues_;
std::ostream* document_;
std::string indentString_;
int rightMargin_;
std::string indentation_;
bool addChildValues_;
};
std::string JSON_API valueToString( Int value );
std::string JSON_API valueToString( UInt value );
std::string JSON_API valueToString( double value );
std::string JSON_API valueToString( bool value );
std::string JSON_API valueToQuotedString( const char *value );
/// \brief Output using the StyledStreamWriter.
/// \see Json::operator>>()
std::ostream& operator<<( std::ostream&, const Value &root );
} // namespace Json
#endif // JSON_WRITER_H_INCLUDED
#ifndef JSONCPP_BATCHALLOCATOR_H_INCLUDED
# define JSONCPP_BATCHALLOCATOR_H_INCLUDED
# include <stdlib.h>
# include <assert.h>
# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
namespace Json {
/* Fast memory allocator.
*
* This memory allocator allocates memory for a batch of object (specified by
* the page size, the number of object in each page).
*
* It does not allow the destruction of a single object. All the allocated objects
* can be destroyed at once. The memory can be either released or reused for future
* allocation.
*
* The in-place new operator must be used to construct the object using the pointer
* returned by allocate.
*/
template<typename AllocatedType
,const unsigned int objectPerAllocation>
class BatchAllocator
{
public:
typedef AllocatedType Type;
BatchAllocator( unsigned int objectsPerPage = 255 )
: freeHead_( 0 )
, objectsPerPage_( objectsPerPage )
{
// printf( "Size: %d => %s\n", sizeof(AllocatedType), typeid(AllocatedType).name() );
assert( sizeof(AllocatedType) * objectPerAllocation >= sizeof(AllocatedType *) ); // We must be able to store a slist in the object free space.
assert( objectsPerPage >= 16 );
batches_ = allocateBatch( 0 ); // allocated a dummy page
currentBatch_ = batches_;
}
~BatchAllocator()
{
for ( BatchInfo *batch = batches_; batch; )
{
BatchInfo *nextBatch = batch->next_;
free( batch );
batch = nextBatch;
}
}
/// allocate space for an array of objectPerAllocation object.
/// @warning it is the responsability of the caller to call objects constructors.
AllocatedType *allocate()
{
if ( freeHead_ ) // returns node from free list.
{
AllocatedType *object = freeHead_;
freeHead_ = *(AllocatedType **)object;
return object;
}
if ( currentBatch_->used_ == currentBatch_->end_ )
{
currentBatch_ = currentBatch_->next_;
while ( currentBatch_ && currentBatch_->used_ == currentBatch_->end_ )
currentBatch_ = currentBatch_->next_;
if ( !currentBatch_ ) // no free batch found, allocate a new one
{
currentBatch_ = allocateBatch( objectsPerPage_ );
currentBatch_->next_ = batches_; // insert at the head of the list
batches_ = currentBatch_;
}
}
AllocatedType *allocated = currentBatch_->used_;
currentBatch_->used_ += objectPerAllocation;
return allocated;
}
/// Release the object.
/// @warning it is the responsability of the caller to actually destruct the object.
void release( AllocatedType *object )
{
assert( object != 0 );
*(AllocatedType **)object = freeHead_;
freeHead_ = object;
}
private:
struct BatchInfo
{
BatchInfo *next_;
AllocatedType *used_;
AllocatedType *end_;
AllocatedType buffer_[objectPerAllocation];
};
// disabled copy constructor and assignement operator.
BatchAllocator( const BatchAllocator & );
void operator =( const BatchAllocator &);
static BatchInfo *allocateBatch( unsigned int objectsPerPage )
{
const unsigned int mallocSize = sizeof(BatchInfo) - sizeof(AllocatedType)* objectPerAllocation
+ sizeof(AllocatedType) * objectPerAllocation * objectsPerPage;
BatchInfo *batch = static_cast<BatchInfo*>( malloc( mallocSize ) );
batch->next_ = 0;
batch->used_ = batch->buffer_;
batch->end_ = batch->buffer_ + objectsPerPage;
return batch;
}
BatchInfo *batches_;
BatchInfo *currentBatch_;
/// Head of a single linked list within the allocated space of freeed object
AllocatedType *freeHead_;
unsigned int objectsPerPage_;
};
} // namespace Json
# endif // ifndef JSONCPP_DOC_INCLUDE_IMPLEMENTATION
#endif // JSONCPP_BATCHALLOCATOR_H_INCLUDED
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
B//{{NO_DEPENDENCIES}}
This diff is collapsed.
This diff is collapsed.
// stdafx.cpp : 只包括标准包含文件的源文件
// HealthHutUi.pch 将作为预编译头
// stdafx.obj 将包含预编译类型信息
#include "stdafx.h"
// stdafx.h : 标准系统包含文件的包含文件,
// 或是经常使用但不常更改的
// 特定于项目的包含文件
#pragma once
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
#endif
#include "targetver.h"
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
// 关闭 MFC 对某些常见但经常可放心忽略的警告消息的隐藏
#define _AFX_ALL_WARNINGS
#include <afxwin.h> // MFC 核心组件和标准组件
#include <afxext.h> // MFC 扩展
#include <afxdisp.h> // MFC 自动化类
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC 对 Windows 公共控件的支持
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxcontrolbars.h> // 功能区和控件条的 MFC 支持
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif
#pragma once
// 包括 SDKDDKVer.h 将定义最高版本的可用 Windows 平台。
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
// WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
#include <SDKDDKVer.h>
This diff is collapsed.
#pragma once
#include "stdafx.h"
#ifdef _DEBUG
#include <iostream>
#endif
#include <vector>
/***************** 全局实参定义 ********************/
#define MAX_PATH_LENGTH 256
//#define DDD
//regidit key define
#ifdef DDD
#define KEY_ROOT HKEY_LOCAL_MACHINE
#define SUB_KEY_PARENT TEXT("Software\\VirtualPrinter")
#define REGEDIT_EXE_PATH _T("extapp")
#define LOAD_APP_FLAG _T("load_extapp")
#define EXE_NAME _T("\\HealthHutUi.exe")
#define IMAGE_PATH_SUBSTREET
//app regedit key
#define APP_KEY_ROOT TEXT("Software\\HealthHut")
#define APP_PATH _T("exepath")
#define KEY64 KEY_WOW64_64KEY
#else
#define KEY_ROOT HKEY_USERS
#define SUB_KEY_PARENT TEXT("S-1-5-21-1446433350-3466257332-1372034800-1000\\Software\\ImagePrinter")
#define REGEDIT_EXE_PATH _T("ext_app_name")
#define LOAD_APP_FLAG _T("ext_app")
#define EXE_NAME _T("\\HealthHutUi.exe")
#define IMAGE_PATH_SUBSTREET
#define KEY64 0
//app regedit key
#define APP_KEY_ROOT TEXT("Software\\HealthHut")
#define APP_PATH _T("exepath")
#endif
/***************** end ********************/
/*************** functions define *********/
extern void GetAppPath(WCHAR *path);
extern void LpbyteToCString(LPBYTE value, CString& result, int length);
extern void ShowErrBox(DWORD err);
extern int Login();
extern int search(CString& name, CString& id_card);
extern std::vector<CString>& getNames();
extern std::vector<CString>& getIds();
extern bool util_upload(CString& name, CString id, CString path);
/*************** end *********/
/*************** 全局通用宏定义 ***************/
#ifdef _DEBUG
#define DEBUG_OUT(msg) \
do{\
std::cout<<msg<<std::endl;\
} while(0)
#define DEBUG_OUTW(msg)\
do{\
std::wcout<<msg<<std::endl;\
} while(0)
#else
#define DEBUG_OUTW(msg)
#define DEBUG_OUT(msg)
#endif
#define safe_delete(point) \
do {\
if (NULL != point) {\
delete point;\
}\
} while(0);
/*************** end ***************/
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment