完善目录结构

完善了目录结构,添加了以前的web段com组件调用的代码(在/测试目录下)(部署没有使用到)
This commit is contained in:
yanshui177
2017-05-17 20:43:16 +08:00
parent ad754709a5
commit 6dcd378738
1246 changed files with 671388 additions and 517 deletions

View File

@@ -0,0 +1,29 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HWCV_COM", "HWCV_COM\HWCV_COM.vcxproj", "{15622D72-0927-49F5-819C-7C33183AEADF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HWCV_COMPS", "HWCV_COM\HWCV_COMPS.vcxproj", "{22BFA07B-8CDC-4666-826D-281861647086}"
ProjectSection(ProjectDependencies) = postProject
{15622D72-0927-49F5-819C-7C33183AEADF} = {15622D72-0927-49F5-819C-7C33183AEADF}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{15622D72-0927-49F5-819C-7C33183AEADF}.Debug|Win32.ActiveCfg = Debug|Win32
{15622D72-0927-49F5-819C-7C33183AEADF}.Debug|Win32.Build.0 = Debug|Win32
{15622D72-0927-49F5-819C-7C33183AEADF}.Release|Win32.ActiveCfg = Release|Win32
{15622D72-0927-49F5-819C-7C33183AEADF}.Release|Win32.Build.0 = Release|Win32
{22BFA07B-8CDC-4666-826D-281861647086}.Debug|Win32.ActiveCfg = Debug|Win32
{22BFA07B-8CDC-4666-826D-281861647086}.Release|Win32.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,164 @@
/*
实现文件DBop.cpp 数据库操作实现文件
*/
#include "stdafx.h"
#include "DBop.h"
#include "path.h"
/*本地的全局变量*/
_ConnectionPtr p_conn; /*全局变量 连接对象*/
_RecordsetPtr p_recordset; /*全局变量 记录集对象*/
_CommandPtr p_cmd; /*全局变量 操作集对象*/
string str_conn; /*全局变量 连接字符串设置*/
/**
程序功能: 根据string类的stu【存储学号】搜索出所有此人的考试信息,并分别存储在不同的变量中
@变量 stuNum 学号
@变量 date<vector> 考试时间
@变量 subject<vector> 考试科目
@变量 stuNum<vector> 考号
@返回值 成功1 失败0
*/
int DbImg(string stuNum, vector<string>& dateVec, vector<string>& subjectVec, vector<string>& stuNum2)//搜寻图片
{
/*字符转换,方便使用*/
string userName(g_db_userName.c_str());
string password(g_db_password.c_str());
string hostName(g_db_hostName.c_str());
string dBName(g_db_dBName.c_str());
/*创建链接描述符*/
str_conn = "Provider=OraOLEDB.Oracle.1;Persist Security Info = true;User ID = ";
str_conn += userName; //===仅初始化一次===//
str_conn += ";Password="; //==================//
str_conn += password;
str_conn += ";Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST=";
str_conn += hostName;
str_conn += ")(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=";
str_conn += dBName;
str_conn += ")))";
//构造查询语句 下句注释是sql语句需要构造成这种类型
/*select KS_ZKZ, KSSJ, TJ_KC_DM from ZK.T_BYSQ_KS_KC WHERE KSSJ between '200907' and '201510' and KS_ZKZ = 010207203867*/
/*string sql = "select KS_ZKZ2, KSSJ, TJ_KC_DM from ZK.T_BYSQ_KS_KC WHERE KSSJ between '200907' and '201504' AND KS_ZKZ = ";*/
string sql = "select KS_ZKZ2, KSSJ, TJ_KC_DM from ";
sql += g_db_hoster_zk;
sql += ".T_BYSQ_KS_KC WHERE KSSJ between ";
sql += g_db_qurry_start;
sql += " and ";
sql += g_db_qurry_end;
sql += "AND KS_ZKZ =";
sql += stuNum.c_str();
_bstr_t _vstr_sql(sql.c_str());/* 转换string为_variant_t */
::CoInitialize(NULL);//初始化com组件
/*创建、打开连接*/
try{
p_conn.CreateInstance("ADODB.Connection");//创建连接
p_recordset.CreateInstance("ADODB.Recordset");//创建结果集,也就是实例化
p_conn->CursorLocation = adUseClient; //存储过程同时返回记录集和返回值
p_conn->Open(_bstr_t(str_conn.c_str()), _bstr_t(userName.c_str()), _bstr_t(password.c_str()), adConnectUnspecified);
HRESULT hr = p_recordset->Open(_bstr_t(_vstr_sql),//执行sq语句查询一个学生的所有考试信息
p_conn.GetInterfacePtr(),
adOpenStatic,
adLockOptimistic,
adCmdText);
//将结果集输出到三个vector变量中
if (p_recordset->RecordCount < 1)//结果集为空
{
return 0;//没有信息,直接跳过这个人
}
do{ //将结果集输出到三个vector变量中
dateVec.push_back((string)(_bstr_t)(p_recordset->Fields->GetItem(_variant_t("KSSJ"))->GetValue()));
subjectVec.push_back((string)(_bstr_t)(p_recordset->Fields->GetItem(_variant_t("TJ_KC_DM"))->GetValue()));
stuNum2.push_back((string)(_bstr_t)(p_recordset->Fields->GetItem(_variant_t("KS_ZKZ2"))->GetValue()));
p_recordset->MoveNext();
} while (!p_recordset->EndOfFile);
}
catch (_com_error e){/**/}
/*关闭查询*/
::CoUninitialize();
return 0;
}
/**
程序功能: 更新学生数据库信息,根据学生的鉴定结果,将结果输出到数据库中
@变量 stuNum学号
@变量 subject考试科目
@变量 flagCheat作弊标记
@返回值 成功1失败0
*/
int DbUpdate(string stuNum, vector<string> dateVec, vector<string> subjectVec, vector<string> stuNum2, vector<string> flagVec)
{
/*字符转换,方便使用*/
string userName(g_db_userName.c_str());
string password(g_db_password.c_str());
string hostName(g_db_hostName.c_str());
string dBName(g_db_dBName.c_str());
/*更新字串设置*/
int count = subjectVec.size();
vector<string> sqlKC; //课程表:作弊第一字段
int ci = 0; //循环
/*构造更新语句*/
for (ci = 0; ci < count; ++ci)
{
/*作弊的*/
string sqlKC1 = "UPDATE ";
sqlKC1 += g_db_hoster_zk;
sqlKC1 += ".T_BYSQ_KS_KC SET BJSH_JG_JQ =";//天津_课程_代码
sqlKC1 += flagVec[ci].c_str();
sqlKC1 += " WHERE KS_ZKZ2=";
sqlKC1 += stuNum2[ci].c_str();
sqlKC1 += " AND TJ_KC_DM=";
sqlKC1 += subjectVec[ci].c_str();
sqlKC1 += " AND KSSJ=";
sqlKC1 += dateVec[ci].c_str();
sqlKC1 += " AND KS_ZKZ=";
sqlKC1 += stuNum.c_str();
sqlKC.push_back(sqlKC1);
}
::CoInitialize(NULL);//初始化com组件
/*更新数据库表*/
try{
p_conn.CreateInstance("ADODB.Connection");//创建连接
p_recordset.CreateInstance("ADODB.Recordset");//创建结果集,也就是实例化
p_cmd.CreateInstance("ADODB.Command");
p_conn->CursorLocation = adUseClient; //存储过程同时返回记录集和返回值
p_conn->Open(_bstr_t(str_conn.c_str()), _bstr_t(userName.c_str()), _bstr_t(password.c_str()), adConnectUnspecified);
p_cmd->ActiveConnection = p_conn;
for (ci = 0; ci < count; ++ci)
{
p_recordset->Open(_bstr_t(sqlKC[ci].c_str()),//更新第二条
p_conn.GetInterfacePtr(),
adOpenStatic,
adLockOptimistic,
adCmdText);
}
}
catch (_com_error e){}
/*关闭查询*/
::CoUninitialize();
return 1;
}

View File

@@ -0,0 +1,56 @@
/*
头文件DBop.h 数据库操作头文件
*/
#pragma once
#import "msado15.dll" no_namespace rename("EOF","EndOfFile")
#include "stdafx.h"
#include <vector>
#include <string>
#include <iostream>
#include <windows.h>
#include <iomanip>
#include <stdio.h>
using namespace std;
/*全局变量*/
extern char *g_log_adr; /*全局变量 程序日志存储地址*/
extern char g_log_rec[500]; /*全局变量 程序日志专用变量*/
extern FILE *g_log_fpzz; /*全局变量 程序日志专用文件句柄*/
extern string g_db_hostName; /*全局变量 服务器ip或名称*/
extern string g_db_dBName; /*全局变量 服务器ODBC数据源*/
extern string g_db_userName; /*全局变量 服务器用户名*/
extern string g_db_password; /*全局变量 服务器密码*/
extern string g_db_qurry_start; /*全局变量 数据库查询_开始日期*/
extern string g_db_qurry_end; /*全局变量 数据库查询_结束日期*/
extern string g_db_qurry_zone; /*全局变量 数据库查询_特定区域*/
extern string g_db_qurry_stu_num; /*全局变量 数据库查询_特定考号*/
extern bool g_db_qurry_all; /*全局变量 数据库查询_查询全部标记*/
extern string g_db_hoster_zk; /*全局变量 数据库用户zk考试院的zk本地的yannsy*/
/*****************************************函数原型*************************************/
/**
程序功能: 根据string类的stu【存储学号】搜索出所有此人的考试信息,并分别存储在不同的变量中
@变量 stuNum 学号
@变量 date<vector> 考试时间
@变量 subject<vector> 考试科目
@变量 stuNum<vector> 考号
@返回值 成功1 失败0
*/
int DbImg(string stuNum, vector<string>& dateVec, vector<string>& subjectVec, vector<string>& stuNum2);
/**
程序功能: 更新学生数据库信息,根据学生的鉴定结果,将结果输出到数据库中
@变量 stuNum学号
@变量 subject考试科目
@变量 flagCheat作弊标记
@返回值 成功1失败0
*/
int DbUpdate(string stuNum, vector<string> dateVec, vector<string> subjectVec, vector<string> stuNum2, vector<string> flagVec);

View File

@@ -0,0 +1,66 @@
// FirstClass.cpp : CFirstClass 的实现
#pragma once
#include "stdafx.h"
#include "FirstClass.h"
#include <windows.h>
#include <iostream>
#include <dos.h>
#include <stdio.h>
#include <comdef.h>
// CFirstClass
int _Check(char *fpname1, char *dest);
STDMETHODIMP CFirstClass::Check(BSTR stuNum, BSTR* result)
{
// TODO: 在此添加实现代码
/*转换num格式*/
_bstr_t num = stuNum;
char* num_c = num;
// TODO: 在此添加实现代码
//调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试
char *fo = "D:\\HWCV_COM_log.txt";
char rec[200] = "可以调用com端口!\n";
strcat(rec, num_c);
strcat(rec, "\n");
FILE *fpzz3 = NULL;//需要注意
fpzz3 = fopen(fo, "a"); //创建文件
if (NULL == fpzz3) return NULL;//要返回错误代码
fprintf(fpzz3, rec);
fclose(fpzz3);
fpzz3 = NULL;//需要指向空,否则会指向原打开文件地址
//调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试信息
/* 开始调用HWCV.dll */
char* stu_p = num;
char* out = new char[100];
///*需要把HWCV.dll放到同同一个目录下面*/
//HINSTANCE hDllInst = LoadLibrary(L"HWCV.dll");
//if (hDllInst)
//{
// /*定义实例化的接口*/
// typedef char*(WINAPI *HWCV)(char*, char*);
// HWCV hwcv = NULL; //hwcv 函数别名
// /*获取线程*/
// hwcv = (HWCV)GetProcAddress(hDllInst, "HWCV");
// if (hwcv)
// {
// char* resu = hwcv(stu_p, out);
// *result = (_bstr_t)resu;
// }
// FreeLibrary(hDllInst);
//}
//
_Check(stu_p, out);
return S_OK;
}

View File

@@ -0,0 +1,59 @@
// FirstClass.h : CFirstClass 的声明
#pragma once
#include "resource.h" // 主符号
#include "HWCV_COM_i.h"
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Windows CE 平台(如不提供完全 DCOM 支持的 Windows Mobile 平台)上无法正确支持单线程 COM 对象。定义 _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA 可强制 ATL 支持创建单线程 COM 对象实现并允许使用其单线程 COM 对象实现。rgs 文件中的线程模型已被设置为“Free”原因是该模型是非 DCOM Windows CE 平台支持的唯一线程模型。"
#endif
using namespace ATL;
// CFirstClass
class ATL_NO_VTABLE CFirstClass :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CFirstClass, &CLSID_FirstClass>,
public IDispatchImpl<IFirstClass, &IID_IFirstClass, &LIBID_HWCV_COMLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
{
public:
CFirstClass()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_FIRSTCLASS)
BEGIN_COM_MAP(CFirstClass)
COM_INTERFACE_ENTRY(IFirstClass)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
STDMETHOD(Check)(BSTR stuNum, BSTR* result);
};
OBJECT_ENTRY_AUTO(__uuidof(FirstClass), CFirstClass)

View File

@@ -0,0 +1,26 @@
HKCR
{
HWCV_COM.aspHWCV.1 = s 'FirstClass Class'
{
CLSID = s '{32CC3D5B-B2E0-4EE6-ACB5-E1D9BA02A7D2}'
}
HWCV_COM.aspHWCV = s 'FirstClass Class'
{
CurVer = s 'HWCV_COM.aspHWCV.1'
}
NoRemove CLSID
{
ForceRemove {32CC3D5B-B2E0-4EE6-ACB5-E1D9BA02A7D2} = s 'FirstClass Class'
{
ProgID = s 'HWCV_COM.aspHWCV.1'
VersionIndependentProgID = s 'HWCV_COM.aspHWCV'
ForceRemove Programmable
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
TypeLib = s '{7513ABA9-4042-4541-833D-38310E463C8F}'
Version = s '1.0'
}
}
}

View File

@@ -0,0 +1,74 @@
// HWCV_COM.cpp : DLL 导出的实现。
//
// 注意: COM+ 1.0 信息:
// 请记住运行 Microsoft Transaction Explorer 以安装组件。
// 默认情况下不进行注册。
#include "stdafx.h"
#include "resource.h"
#include "HWCV_COM_i.h"
#include "dllmain.h"
#include "compreg.h"
using namespace ATL;
// 用于确定 DLL 是否可由 OLE 卸载。
STDAPI DllCanUnloadNow(void)
{
return _AtlModule.DllCanUnloadNow();
}
// 返回一个类工厂以创建所请求类型的对象。
STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID* ppv)
{
return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
}
// DllRegisterServer - 在系统注册表中添加项。
STDAPI DllRegisterServer(void)
{
// 注册对象、类型库和类型库中的所有接口
HRESULT hr = _AtlModule.DllRegisterServer();
return hr;
}
// DllUnregisterServer - 在系统注册表中移除项。
STDAPI DllUnregisterServer(void)
{
HRESULT hr = _AtlModule.DllUnregisterServer();
return hr;
}
// DllInstall - 按用户和计算机在系统注册表中逐一添加/移除项。
STDAPI DllInstall(BOOL bInstall, _In_opt_ LPCWSTR pszCmdLine)
{
HRESULT hr = E_FAIL;
static const wchar_t szUserSwitch[] = L"user";
if (pszCmdLine != NULL)
{
if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0)
{
ATL::AtlSetPerUserRegistration(true);
}
}
if (bInstall)
{
hr = DllRegisterServer();
if (FAILED(hr))
{
DllUnregisterServer();
}
}
else
{
hr = DllUnregisterServer();
}
return hr;
}

View File

@@ -0,0 +1,10 @@
; HWCV_COM.def :
LIBRARY
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
DllInstall PRIVATE

View File

@@ -0,0 +1,59 @@
// HWCV_COM.idl : HWCV_COM 的 IDL 源
//
// 此文件将由 MIDL 工具处理以
// 产生类型库(HWCV_COM.tlb)和封送处理代码。
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(a817e7a2-43fa-11d0-9e44-00aa00b6770a),
dual,
pointer_default(unique)
]
interface IComponentRegistrar : IDispatch
{
[id(1)] HRESULT Attach([in] BSTR bstrPath);
[id(2)] HRESULT RegisterAll();
[id(3)] HRESULT UnregisterAll();
[id(4)] HRESULT GetComponents([out] SAFEARRAY(BSTR)* pbstrCLSIDs, [out] SAFEARRAY(BSTR)* pbstrDescriptions);
[id(5)] HRESULT RegisterComponent([in] BSTR bstrCLSID);
[id(6)] HRESULT UnregisterComponent([in] BSTR bstrCLSID);
};
[
object,
uuid(7918500F-A60F-4587-B528-846A186B775B),
dual,
nonextensible,
pointer_default(unique)
]
interface IFirstClass : IDispatch{
[id(1)] HRESULT Check([in] BSTR stuNum, [out, retval] BSTR* result);
};
[
uuid(7513ABA9-4042-4541-833D-38310E463C8F),
version(1.0),
custom(a817e7a1-43fa-11d0-9e44-00aa00b6770a,"{42D03418-BE85-46CA-B3D9-D26C45CAC1D5}")
]
library HWCV_COMLib
{
importlib("stdole2.tlb");
[
uuid(42D03418-BE85-46CA-B3D9-D26C45CAC1D5)
]
coclass CompReg
{
[default] interface IComponentRegistrar;
};
[
uuid(32CC3D5B-B2E0-4EE6-ACB5-E1D9BA02A7D2)
]
coclass FirstClass
{
[default] interface IFirstClass;
};
};

View File

@@ -0,0 +1,15 @@
HKCR
{
NoRemove CLSID
{
ForceRemove {42D03418-BE85-46CA-B3D9-D26C45CAC1D5} = s 'CompReg Class'
{
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
TypeLib = s '{7513ABA9-4042-4541-833D-38310E463C8F}'
Version = s '1.0'
}
}
}

View File

@@ -0,0 +1,176 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.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>{15622D72-0927-49F5-819C-7C33183AEADF}</ProjectGuid>
<Keyword>AtlProj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</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'">
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<HeaderFileName>HWCV_COM_i.h</HeaderFileName>
<InterfaceIdentifierFileName>HWCV_COM_i.c</InterfaceIdentifierFileName>
<ProxyFileName>HWCV_COM_p.c</ProxyFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)HWCV_COM.tlb</TypeLibraryName>
<DllDataFileName />
<ValidateAllParameters>true</ValidateAllParameters>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
<ModuleDefinitionFile>.\HWCV_COM.def</ModuleDefinitionFile>
<AdditionalDependencies>comsvcs.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<RegisterOutput>true</RegisterOutput>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<HeaderFileName>HWCV_COM_i.h</HeaderFileName>
<InterfaceIdentifierFileName>HWCV_COM_i.c</InterfaceIdentifierFileName>
<ProxyFileName>HWCV_COM_p.c</ProxyFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)HWCV_COM.tlb</TypeLibraryName>
<DllDataFileName />
<ValidateAllParameters>true</ValidateAllParameters>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
<ModuleDefinitionFile>.\HWCV_COM.def</ModuleDefinitionFile>
<AdditionalDependencies>comsvcs.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<RegisterOutput>true</RegisterOutput>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="compreg.cpp" />
<ClCompile Include="DBop.cpp" />
<ClCompile Include="dllmain.cpp">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="FirstClass.cpp" />
<ClCompile Include="HWCV_COM.cpp" />
<ClCompile Include="HWCV_COM_i.c">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="path.cpp" />
<ClCompile Include="process.cpp" />
<ClCompile Include="segmentation.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="compreg.h" />
<ClInclude Include="DBop.h" />
<ClInclude Include="dllmain.h" />
<ClInclude Include="FirstClass.h" />
<ClInclude Include="HWCV_COM_i.h" />
<ClInclude Include="path.h" />
<ClInclude Include="Point.h" />
<ClInclude Include="process.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="segmentation.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="HWCV_COM.rc" />
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<None Include="FirstClass.rgs" />
<None Include="HWCV_COM.def" />
<None Include="HWCV_COM.rgs" />
</ItemGroup>
<ItemGroup>
<Midl Include="HWCV_COM.idl" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,115 @@
<?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;hh;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>
<Filter Include="生成的文件">
<UniqueIdentifier>{36a53c49-071e-47fd-9844-d266a16794d4}</UniqueIdentifier>
<SourceControlFiles>False</SourceControlFiles>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="HWCV_COM.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="compreg.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="HWCV_COM_i.c">
<Filter>生成的文件</Filter>
</ClCompile>
<ClCompile Include="FirstClass.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="DBop.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="path.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="process.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="segmentation.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="dllmain.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="compreg.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="HWCV_COM_i.h">
<Filter>生成的文件</Filter>
</ClInclude>
<ClInclude Include="FirstClass.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="DBop.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="path.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Point.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="process.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="segmentation.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="HWCV_COM.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<None Include="HWCV_COM.rgs">
<Filter>资源文件</Filter>
</None>
<None Include="HWCV_COM.def">
<Filter>源文件</Filter>
</None>
<None Include="FirstClass.rgs">
<Filter>资源文件</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Midl Include="HWCV_COM.idl">
<Filter>源文件</Filter>
</Midl>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.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>{22BFA07B-8CDC-4666-826D-281861647086}</ProjectGuid>
<Keyword>AtlPSProj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</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'">
<IntDir>$(Configuration)PS\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IntDir>$(Configuration)PS\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;REGISTER_PROXY_DLL;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;ole32.lib;advapi32.lib;comsvcs.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>HWCV_COMPS.def</ModuleDefinitionFile>
<RegisterOutput>true</RegisterOutput>
</Link>
<PreBuildEvent>
<Command>if exist dlldata.c goto :END
Echo 错误: MIDL 将不会生成 DLLDATA.C除非在主项目中至少有 1 个接口。
Exit 1
:END
</Command>
<Message>检查是否有所需的文件</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>WIN32;REGISTER_PROXY_DLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;ole32.lib;advapi32.lib;comsvcs.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>HWCV_COMPS.def</ModuleDefinitionFile>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<RegisterOutput>true</RegisterOutput>
</Link>
<PreBuildEvent>
<Command>if exist dlldata.c goto :END
Echo 错误: MIDL 将不会生成 DLLDATA.C除非在主项目中至少有 1 个接口。
Exit 1
:END
</Command>
<Message>检查是否有所需的文件</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="HWCV_COMps.def" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dlldata.c" />
<ClCompile Include="HWCV_COM_i.c" />
<ClCompile Include="HWCV_COM_p.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{fbceaf9b-bb56-4674-aca1-ce4a8604ccf9}</UniqueIdentifier>
</Filter>
<Filter Include="生成的文件">
<UniqueIdentifier>{a0223884-c0c0-48bf-9a23-5d660428f10c}</UniqueIdentifier>
<SourceControlFiles>False</SourceControlFiles>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="HWCV_COMps.def" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="HWCV_COM_i.c">
<Filter>生成的文件</Filter>
</ClCompile>
<ClCompile Include="HWCV_COM_p.c">
<Filter>生成的文件</Filter>
</ClCompile>
<ClCompile Include="dlldata.c">
<Filter>生成的文件</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,452 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0603 */
/* at Thu Feb 23 13:46:19 2017
*/
/* Compiler settings for HWCV_COM.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0603
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
/* @@MIDL_FILE_HEADING( ) */
#pragma warning( disable: 4049 ) /* more than 64k source lines */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __HWCV_COM_i_h__
#define __HWCV_COM_i_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef __IComponentRegistrar_FWD_DEFINED__
#define __IComponentRegistrar_FWD_DEFINED__
typedef interface IComponentRegistrar IComponentRegistrar;
#endif /* __IComponentRegistrar_FWD_DEFINED__ */
#ifndef __IFirstClass_FWD_DEFINED__
#define __IFirstClass_FWD_DEFINED__
typedef interface IFirstClass IFirstClass;
#endif /* __IFirstClass_FWD_DEFINED__ */
#ifndef __CompReg_FWD_DEFINED__
#define __CompReg_FWD_DEFINED__
#ifdef __cplusplus
typedef class CompReg CompReg;
#else
typedef struct CompReg CompReg;
#endif /* __cplusplus */
#endif /* __CompReg_FWD_DEFINED__ */
#ifndef __FirstClass_FWD_DEFINED__
#define __FirstClass_FWD_DEFINED__
#ifdef __cplusplus
typedef class FirstClass FirstClass;
#else
typedef struct FirstClass FirstClass;
#endif /* __cplusplus */
#endif /* __FirstClass_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"
#ifdef __cplusplus
extern "C"{
#endif
#ifndef __IComponentRegistrar_INTERFACE_DEFINED__
#define __IComponentRegistrar_INTERFACE_DEFINED__
/* interface IComponentRegistrar */
/* [unique][dual][uuid][object] */
EXTERN_C const IID IID_IComponentRegistrar;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("a817e7a2-43fa-11d0-9e44-00aa00b6770a")
IComponentRegistrar : public IDispatch
{
public:
virtual /* [id] */ HRESULT STDMETHODCALLTYPE Attach(
/* [in] */ BSTR bstrPath) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE RegisterAll( void) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE UnregisterAll( void) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetComponents(
/* [out] */ SAFEARRAY * *pbstrCLSIDs,
/* [out] */ SAFEARRAY * *pbstrDescriptions) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE RegisterComponent(
/* [in] */ BSTR bstrCLSID) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE UnregisterComponent(
/* [in] */ BSTR bstrCLSID) = 0;
};
#else /* C style interface */
typedef struct IComponentRegistrarVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IComponentRegistrar * This,
/* [in] */ REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IComponentRegistrar * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IComponentRegistrar * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
IComponentRegistrar * This,
/* [out] */ UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
IComponentRegistrar * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
IComponentRegistrar * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR *rgszNames,
/* [range][in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
IComponentRegistrar * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *Attach )(
IComponentRegistrar * This,
/* [in] */ BSTR bstrPath);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *RegisterAll )(
IComponentRegistrar * This);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *UnregisterAll )(
IComponentRegistrar * This);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *GetComponents )(
IComponentRegistrar * This,
/* [out] */ SAFEARRAY * *pbstrCLSIDs,
/* [out] */ SAFEARRAY * *pbstrDescriptions);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *RegisterComponent )(
IComponentRegistrar * This,
/* [in] */ BSTR bstrCLSID);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *UnregisterComponent )(
IComponentRegistrar * This,
/* [in] */ BSTR bstrCLSID);
END_INTERFACE
} IComponentRegistrarVtbl;
interface IComponentRegistrar
{
CONST_VTBL struct IComponentRegistrarVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IComponentRegistrar_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IComponentRegistrar_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IComponentRegistrar_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IComponentRegistrar_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define IComponentRegistrar_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define IComponentRegistrar_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define IComponentRegistrar_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define IComponentRegistrar_Attach(This,bstrPath) \
( (This)->lpVtbl -> Attach(This,bstrPath) )
#define IComponentRegistrar_RegisterAll(This) \
( (This)->lpVtbl -> RegisterAll(This) )
#define IComponentRegistrar_UnregisterAll(This) \
( (This)->lpVtbl -> UnregisterAll(This) )
#define IComponentRegistrar_GetComponents(This,pbstrCLSIDs,pbstrDescriptions) \
( (This)->lpVtbl -> GetComponents(This,pbstrCLSIDs,pbstrDescriptions) )
#define IComponentRegistrar_RegisterComponent(This,bstrCLSID) \
( (This)->lpVtbl -> RegisterComponent(This,bstrCLSID) )
#define IComponentRegistrar_UnregisterComponent(This,bstrCLSID) \
( (This)->lpVtbl -> UnregisterComponent(This,bstrCLSID) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IComponentRegistrar_INTERFACE_DEFINED__ */
#ifndef __IFirstClass_INTERFACE_DEFINED__
#define __IFirstClass_INTERFACE_DEFINED__
/* interface IFirstClass */
/* [unique][nonextensible][dual][uuid][object] */
EXTERN_C const IID IID_IFirstClass;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("7918500F-A60F-4587-B528-846A186B775B")
IFirstClass : public IDispatch
{
public:
virtual /* [id] */ HRESULT STDMETHODCALLTYPE Check(
/* [in] */ BSTR stuNum,
/* [retval][out] */ BSTR *result) = 0;
};
#else /* C style interface */
typedef struct IFirstClassVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IFirstClass * This,
/* [in] */ REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IFirstClass * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IFirstClass * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
IFirstClass * This,
/* [out] */ UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
IFirstClass * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
IFirstClass * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR *rgszNames,
/* [range][in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
IFirstClass * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *Check )(
IFirstClass * This,
/* [in] */ BSTR stuNum,
/* [retval][out] */ BSTR *result);
END_INTERFACE
} IFirstClassVtbl;
interface IFirstClass
{
CONST_VTBL struct IFirstClassVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IFirstClass_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IFirstClass_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IFirstClass_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IFirstClass_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define IFirstClass_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define IFirstClass_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define IFirstClass_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define IFirstClass_Check(This,stuNum,result) \
( (This)->lpVtbl -> Check(This,stuNum,result) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IFirstClass_INTERFACE_DEFINED__ */
#ifndef __HWCV_COMLib_LIBRARY_DEFINED__
#define __HWCV_COMLib_LIBRARY_DEFINED__
/* library HWCV_COMLib */
/* [custom][version][uuid] */
EXTERN_C const IID LIBID_HWCV_COMLib;
EXTERN_C const CLSID CLSID_CompReg;
#ifdef __cplusplus
class DECLSPEC_UUID("42D03418-BE85-46CA-B3D9-D26C45CAC1D5")
CompReg;
#endif
EXTERN_C const CLSID CLSID_FirstClass;
#ifdef __cplusplus
class DECLSPEC_UUID("32CC3D5B-B2E0-4EE6-ACB5-E1D9BA02A7D2")
FirstClass;
#endif
#endif /* __HWCV_COMLib_LIBRARY_DEFINED__ */
/* Additional Prototypes for ALL interfaces */
unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * );
unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * );
unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * );
void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * );
unsigned long __RPC_USER LPSAFEARRAY_UserSize( unsigned long *, unsigned long , LPSAFEARRAY * );
unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal( unsigned long *, unsigned char *, LPSAFEARRAY * );
unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(unsigned long *, unsigned char *, LPSAFEARRAY * );
void __RPC_USER LPSAFEARRAY_UserFree( unsigned long *, LPSAFEARRAY * );
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,8 @@
LIBRARY
EXPORTS
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE

View File

@@ -0,0 +1,13 @@
/*
头文件Point.h 图像中的像素点定义
*/
#pragma once
class Point{
private:
public:
int x;
int y;
void setpoint(int a,int b){x=a;y=b;}
};

View File

@@ -0,0 +1,68 @@
========================================================================
活动模板库HWCV_COM 项目概述
========================================================================
应用程序向导已为您创建了此 HWCV_COM 项目,作为编写动态链接库 (DLL) 的起点。
本文件概要介绍组成项目的每个文件的内容。
HWCV_COM.vcxproj
这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
HWCV_COM.vcxproj.filters
这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
HWCV_COM.idl
此文件包含项目中定义的类型库、接口和组件类的 IDL 定义。
此文件将由 MIDL 编译器处理,用于生成:
C++ 接口定义和 GUID 声明 (HWCV_COM.h)
GUID 定义 (HWCV_COM_i.c)
类型库 (HWCV_COM.tlb)
封送处理代码 HWCV_COM_p.c 和 dlldata.c
HWCV_COM.h
此文件包含 HWCV_COM.idl 中定义的项目的 C++ 接口定义和 GUID 声明。它将在编译过程中由 MIDL 重新生成。
HWCV_COM.cpp
此文件包含对象映射和 DLL 导出的实现。
HWCV_COM.rc
这是程序使用的所有 Microsoft Windows 资源的列表。
HWCV_COM.def
此模块定义文件为链接器提供有关 DLL 所要求的导出的信息,它包含用于以下内容的导出:
DllGetClassObject
DllCanUnloadNow
DllRegisterServer
DllUnregisterServer
DllInstall
/////////////////////////////////////////////////////////////////////////////
其他标准文件:
StdAfx.h, StdAfx.cpp
这些文件用于生成名为 HWCV_COM.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
Resource.h
这是用于定义资源 ID 的标准头文件。
/////////////////////////////////////////////////////////////////////////////
代理/存根 (stub) DLL 项目和模块定义文件:
HWCV_COMps.vcxproj
此文件是用于生成代理/存根 (stub) DLL 的项目文件(若有必要)。
主项目中的 IDL 文件必须至少包含一个接口,并且在生成代理/存根 (stub) DLL 之前必须先编译 IDL 文件。
此过程生成 dlldata.c、HWCV_COM_i.c 和 HWCV_COM_p.c这些是生成代理/存根 (stub) DLL 所必需的。
HWCV_COMps.vcxproj.filters
此文件是代理/存根项目的筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
HWCV_COMps.def
此模块定义文件为链接器提供有关代理/存根 (stub) 所要求的导出的信息。
/////////////////////////////////////////////////////////////////////////////
其他注释:
“COM+ 1.0 支持”选项可用于将 COM+ 1.0 库构建到您的主干应用程序中,从而让您能够使用 COM+ 1.0 类、对象和函数。
/////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,7 @@
// compreg.cpp : CCompReg 的实现
#include "stdafx.h"
#include "compreg.h"
// CCompReg

View File

@@ -0,0 +1,7 @@
// compreg.h : CCompReg 的声明
#pragma once
#include "resource.h" // 主符号
#include "HWCV_COM_i.h"

View File

@@ -0,0 +1,38 @@
/*********************************************************
DllData file -- generated by MIDL compiler
DO NOT ALTER THIS FILE
This file is regenerated by MIDL on every IDL file compile.
To completely reconstruct this file, delete it and rerun MIDL
on all the IDL files in this DLL, specifying this file for the
/dlldata command line option
*********************************************************/
#define PROXY_DELEGATION
#include <rpcproxy.h>
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_PROXY_FILE( HWCV_COM )
PROXYFILE_LIST_START
/* Start of list */
REFERENCE_PROXY_FILE( HWCV_COM ),
/* End of list */
PROXYFILE_LIST_END
DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )
#ifdef __cplusplus
} /*extern "C" */
#endif
/* end of generated dlldata file */

View File

@@ -0,0 +1,16 @@
// dllmain.cpp : DllMain 的实现。
#include "stdafx.h"
#include "resource.h"
#include "HWCV_COM_i.h"
#include "dllmain.h"
#include "compreg.h"
CHWCV_COMModule _AtlModule;
// DLL 入口点
extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
hInstance;
return _AtlModule.DllMain(dwReason, lpReserved);
}

View File

@@ -0,0 +1,10 @@
// dllmain.h : 模块类的声明。
class CHWCV_COMModule : public ATL::CAtlDllModuleT< CHWCV_COMModule >
{
public :
DECLARE_LIBID(LIBID_HWCV_COMLib)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_HWCV_COM, "{779F27F9-BF68-4742-840B-DD9A273C8CDA}")
};
extern class CHWCV_COMModule _AtlModule;

View File

@@ -0,0 +1,248 @@
#include "stdafx.h"
/*
实现文件path.cpp 路径操作实现文件
*/
#include "path.h"
/**
根据学生信息创建文件路径,用于文件读取
@变量 date 考试日期
@变量 subject 考试科目
@变量 stuNum 考号
@返回值 返回生成的文件路径
*/
string CrPath(string date, string subject, string stuNum)
{
string temp = g_dir; temp += date; temp += "/";
temp += subject.substr(0, 4); temp += "/";
temp += stuNum; temp += ".jpg";
return temp;
}
/*
功能:读取标准差文件
@变量 filesname 文件名
@变量 col 行数
@变量 _vector 读取到的标准差存到vector中
@返回值 成功1失败0
*/
int ReadScanf(const string &filename, const int &cols, vector<double *> &_vector)
{
// 功能将filename 中的数据共cols列读取到_vector中_vector可视为二维数组
FILE *fp = fopen(filename.c_str(), "r");//打开并读取文件
bool flag = true;
int i = 0;
// printf("--read_scanf--");
if (!fp){ return 0; }
while (flag){
double *point = new double[cols];
for (i = 0; i<cols; i++){ //读取数据存在_vector[cols]中
if (EOF == fscanf(fp, "%lf", &point[i])) {
flag = false; break;
}
if (EOF == fgetc(fp)) {
flag = false; i++; break;
}
}
if (cols == i)
_vector.push_back(point);
}
fclose(fp);
return 1;
}
/**
读取配置文件,并配置各项参数
@变量 filename 配置文件的路径
@返回值 成功1 失败0
*/
int ReadConfig(char *filename)
{
ifstream file(filename);
if (!file)/*"配置文件不存在!"*/
{
/*写入时间*/
memset(g_log_rec, 0, sizeof(g_log_rec));
strcat(g_log_rec, "--ERR:读取配置文件失败!");
SaveLog(g_log_rec, g_err_adr, "a");
return 0;
}
/*步骤:开始读取信息*/
string temp;/*仅用作过滤字符*/
file >> temp >> temp;
/*---此行6个参考配置信息图片对比参数*/
file >> temp >> temp >> g_bi_threshold >> temp >> g_doubt_threshold >> temp >> g_dir >> temp >> g_conti >> temp >> g_log_adr >> temp;
//if (g_bi_threshold < 0 || g_bi_threshold >255)/*输出到日志错误信息*/{
// memset(g_log_rec, 0, sizeof(g_log_rec));
// strcat(g_log_rec, "--MSG:配置参数有误-笔迹图像对比参数!");
// strcat(g_log_rec, g_dir.c_str());
// SaveLog(g_log_rec, g_err_adr, "a");
// return 0;
//}
/*---此行6个参考配置信息网络配置参数*/
file >> temp >> temp >> g_db_hostName >> temp >> g_db_dBName >> temp >> g_db_userName >> temp >> g_db_password >> temp >> g_db_hoster_zk >> temp;
///*检验参数*/
////if (strcmp(g_db_hostName.c_str(), "") || g_bi_threshold >255 || g_bi_threshold < 1)/*输出到日志错误信息*/{
// memset(g_log_rec, 0, sizeof(g_log_rec));
// /*time_t timer;
// struct tm *tblock;
// timer = time(NULL);
// tblock = localtime(&timer);
// strcat(g_log_rec, asctime(tblock));*/
// strcat(g_log_rec, "--MSG:-网络配置参数!");
// strcat(g_log_rec, g_db_password.c_str());
// strcat(g_log_rec, "\n");
// SaveLog(g_log_rec, g_err_adr, "a");
// return 0;
// }
/*---此行5个参考配置信息控制参数*/
file >> temp >> temp >> temp >> temp >> temp >> temp >> temp >> temp >> temp >> temp >> temp >> temp;
///*检验参数*/
//if (0)/*输出到日志错误信息*/{
// memset(g_log_rec, 0, sizeof(g_log_rec));
///* time_t timer;
// struct tm *tblock;
// timer = time(NULL);
// tblock = localtime(&timer);
// strcat(g_log_rec, asctime(tblock));*/
// strcat(g_log_rec, "--ERR:配置参数有误-控制参数!");
// SaveLog(g_log_rec, g_err_adr, "a");
// return 0;
//}
/*---此行5个参考配置信息数据库查询参数*/
file >> temp >> temp >> g_db_qurry_start >> temp >> g_db_qurry_end >> temp >> g_db_qurry_zone >> temp >> g_db_qurry_stu_num >> temp >> g_db_qurry_all >> temp;
///*检验参数*/
//if (0)/*输出到日志错误信息*/{
// memset(g_log_rec, 0, sizeof(g_log_rec));
// /*time_t timer;
// struct tm *tblock;
// timer = time(NULL);
// tblock = localtime(&timer);
// strcat(g_log_rec, asctime(tblock));*/
// strcat(g_log_rec, "--ERR:配置参数有误-数据库查询参数!");
// SaveLog(g_log_rec, g_err_adr, "a");
// return 0;
//}
//if (g_doubt_threshold < 0.01)
//{
// memset(g_log_rec, 0, sizeof(g_log_rec));
// /*time_t timer;
// struct tm *tblock;
// timer = time(NULL);
// tblock = localtime(&timer);
// strcat(g_log_rec, asctime(tblock));*/
// strcat(g_log_rec, "--ERR:配置参数有误-笔迹图像对比参数!");
// SaveLog(g_log_rec, g_err_adr, "a");
//
// return 0;
//}
//if (g_conti < 0 || g_conti > 10 || g_conti == NULL)
//{
// memset(g_log_rec, 0, sizeof(g_log_rec));
///* time_t timer;
// struct tm *tblock;
// timer = time(NULL);
// tblock = localtime(&timer);
// strcat(g_log_rec, asctime(tblock));*/
// strcat(g_log_rec, "--ERR:配置参数有误-笔迹图像对比参数!\n\n");
// SaveLog(g_log_rec, g_err_adr, "a");
// return 0;
//}
file.close();/*关闭文件句柄*/
return 1;
}
/**
函数功能存储过程数据到txt文件
@变量: record 存储的语句
@变量 g_txt_file_path 存储的位置
@返回值 1成功 0失败
*/
int SaveLog(char *txt, string txt_file_path, char *type)
{
FILE* fpzz = fopen(txt_file_path.c_str(), type); //创建文件
if (NULL == fpzz)
{
return 0;
}//要返回错误代码
fprintf(fpzz, txt); //从控制台中读入并在文本输出
fclose(fpzz);
fpzz = NULL;//需要指向空,否则会指向原打开文件地址
return 1;
}
/*
功能:保存中间鉴定图像(不实现,没有必要)
@变量
@变量
@返回值
*/
int SaveImg(IplImage *img, char *g_process_img_adr){
/*char processPic[100] = "E:/imggj/";
char *namePic = new char[20];
bool flag = false;
string xuehao = path, kaoshihao = path;
int num_iter = sizeof(path);
for (int iter = 0; iter < num_iter; iter++)
{
if (path[iter] == 'x')
{
flag = true;
break;
}
}
if (flag)
{
xuehao = xuehao.substr(27, 13);
kaoshihao = kaoshihao.substr(40, 5);
}
else
{
xuehao = xuehao.substr(27, 12);
kaoshihao = kaoshihao.substr(39, 5);
}
strcat(processPic, xuehao.c_str());
_mkdir(processPic);
strcat(processPic, kaoshihao.c_str());
strcat(processPic, ".jpg");
cvSaveImage(processPic, imggj);*/
return 1;
}

View File

@@ -0,0 +1,84 @@
/*
头文件path.h 与路径相关操作的函数头文件以及函数原型
*/
#pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <ctime>
#include <cv.h>
using namespace std;
extern int g_bi_threshold; /*全局变量 二值化阈值*/
extern double g_std_kesa[50][50]; /*全局变量 标准差数组*/
extern float g_doubt_threshold; /*全局变量 作弊嫌疑阈值*/
extern string g_dir; /*全局变量 总路径的目录*/
extern int g_conti; /*全局变量 比较标准*/
extern string g_db_hostName; /*全局变量 服务器ip或名称*/
extern string g_db_dBName; /*全局变量 服务器ODBC数据源*/
extern string g_db_userName; /*全局变量 服务器用户名*/
extern string g_db_password; /*全局变量 服务器密码*/
extern char *g_log_adr; /*全局变量 程序日志存储地址*/
extern char g_err_adr[30]; /*全局变量 错误日志存储地址*/
extern char g_log_rec[500]; /*全局变量 程序日志专用变量*/
/*全局变量 待定*/
/*全局变量 待定*/
extern string g_db_qurry_start; /*全局变量 数据库查询_开始日期*/
extern string g_db_qurry_end; /*全局变量 数据库查询_结束日期*/
extern string g_db_qurry_zone; /*全局变量 数据库查询_特定区域*/
extern string g_db_qurry_stu_num; /*全局变量 数据库查询_特定考号*/
extern bool g_db_qurry_all; /*全局变量 数据库查询_查询全部标记*/
extern string g_db_hoster_zk;
/**
根据学生信息创建文件路径,用于文件读取
@变量 date 考试日期
@变量 subject 考试科目
@变量 stuNum 考号
@返回值 返回生成的文件路径
*/
string CrPath(string date, string subject, string stuNum);
/*
功能:读取标准差文件
@变量 filesname 文件名
@变量 col 行数
@变量 _vector 读取到的标准差存到vector中
@返回值 成功1失败0
*/
int ReadScanf(const string &filename, const int &cols, vector<double *> &_vector);
/**
读取配置文件,并配置各项参数
@变量 filename 配置文件的路径
@返回值 成功1 失败0
*/
int ReadConfig(char *filename);
/**
函数功能存储过程数据到txt文件
@变量: record 存储的语句
@变量 g_txt_file_path 存储的位置
@返回值 1成功 0失败
*/
int SaveLog(char *record, string txt_file_path, char *type);
/*
功能:保存中间鉴定图像
@变量
@变量
@返回值
*/
int SaveImg(IplImage *img, char *g_process_img_adr);

View File

@@ -0,0 +1,664 @@
/*
实现文件process.cpp 图像处理过程的实现文件
*/
#include "stdafx.h"
#include "process.h"
/*
功能:读入图像文件,进行二值化
@变量 img iplimage图像文件
@变量 bithro 二值化阈值
@返回值 黑像素的数目(待用)
*/
int* binary(IplImage* img, int g_bi_threshold)
{
int height, width, step, channels;
uchar *data;
int i, j;
static int black[1000]; //C语言不提倡返回一个局部变量的地址以外的功能所以你必须定义的局部变量如静态变量。
/* 获取图像信息*/
height = img->height;
width = img->width;
step = img->widthStep;
channels = img->nChannels;
data = (uchar *)img->imageData;
/*二值化,并统计黑像素的个数*/
for (i = 0; i<height; i++)
{
for (j = 0; j<width; j++)//对图像每个点进行二值化,原值为128
data[i*step + j*channels] = (data[i*step + j*channels]>g_bi_threshold) ? 255 : 0;
}
/*计算每一行的黑像素个数*/
int tempBlackPixel = 0;
memset(black, 0, 1000); //##初始化内存这里用做清零black数组
for (i = height - 1; i>0; i--)
{
for (int j = 0; j<width; j++)
{
if (data[i*step + j*channels] == 0) //计算黑色的像素数
tempBlackPixel += 1;
}
black[height - i] = tempBlackPixel; //black记录黑色像素数
tempBlackPixel = 0;
}
//二值化,并统计黑像素的个数**********
return black;
}
/*
功能:读入图像文件,对图像进行裁剪
@变量 img iplimage图像文件
@变量 img 裁剪后的iplimage图像文件
@jbwhite
@jbblack
@返回值 返回裁剪后的图像
*/
IplImage* Cjbsb(IplImage* img, IplImage* imgjbsb, int jbwhite, int jbblack)
{
/*定义变量*/
int i, j, jbi = 0, jbj = 0;
int height, width, step, channels;
uchar *data;
int brklab = 0;
/* 获取图像信息*/
height = img->height;
width = img->width;
step = img->widthStep;
channels = img->nChannels;
data = (uchar *)img->imageData;
// IplImage* imgjbsb = cvCreateImage(cvGetSize(img),img->depth,img->nChannels);
cvCopy(img, imgjbsb, NULL);
uchar *imgjbsbdata = (uchar *)imgjbsb->imageData;
//以角标为起点进行裁剪与画框
CvSize jbcjsize = cvSize(835, 165); //角标裁剪框的大小宽为835象素高为165象素
IplImage* imgjbcj = cvCreateImage(jbcjsize, img->depth, img->nChannels);
uchar *imgjbcjdata = (uchar *)imgjbcj->imageData;
int jbcjstep = imgjbcj->widthStep;
int jbcjchannels = imgjbcj->nChannels;
for (i = 0; i<165; i++)
for (j = 0; j<835; j++)
imgjbcjdata[i*jbcjstep + j*jbcjchannels] = data[(i + jbi)*step + (j + jbj)*channels];
for (i = 0; i<165; i = i + 2)
{
imgjbsbdata[(i + jbi)*step + jbj*channels] = 0;
imgjbsbdata[(i + jbi)*step + (jbj + 835)*channels] = 0;
}
for (j = 0; j<835; j = j + 2)
{
imgjbsbdata[jbi*step + (j + jbj)*channels] = 0;
imgjbsbdata[(jbi + 165)*step + (j + jbj)*channels] = 0;
}
return imgjbcj;
}
/*
功能:计算图像的特征
@变量 imgbj 笔迹部分的图像
@返回值 计算得到的特征图像
*/
IplImage* outline(IplImage* imgbj)
{
/*定义变量*/
int i, j;
int height, width, step, channels;
uchar *data;
/*定义新的图像*/
IplImage* imglk = cvCreateImage(cvGetSize(imgbj), imgbj->depth, imgbj->nChannels);
/* 获取图像信息*/
height = imgbj->height;
width = imgbj->width;
step = imgbj->widthStep;
channels = imgbj->nChannels;
data = (uchar *)imgbj->imageData;
// printf("--outline--");
for (j = 0; j<height; j++){
for (i = 0; i<width; i++){
imglk->imageData[j*step + i*channels] = 255;
}
for (i = 0; i<width - 1; i++){
if (data[j*step + (i + 1)*channels] - data[j*step + i*channels] == 255) //竖线右侧框
imglk->imageData[j*step + i*channels] = 0;
else if (data[j*step + i*channels] - data[j*step + (i + 1)*channels] == 255) //竖线左侧框
imglk->imageData[j*step + (i + 1)*channels] = 0;
}
}
for (i = 0; i<width; i++){
for (j = 0; j<height - 1; j++){
if (data[j*step + i*channels] - data[(j + 1)*step + i*channels] == 255) //横线下侧框
imglk->imageData[(j + 1)*step + i*channels] = 0;
else if (data[(j + 1)*step + i*channels] - data[j*step + i*channels] == 255) //横线上侧框
imglk->imageData[j*step + i*channels] = 0;
}
}
return imglk;
}
/*
功能:输入图像的特征轮廓图,返回图像的特征值
@变量 imglk 输入的图像轮廓图
@变量 feature 得到的图像特征
@返回值 成功1失败0
*/
int outlinefeature(IplImage* imglk, int feature[][50])
{
//定义变量
int i, j;
int height, width, step, channels;
uchar *data;
int feat[50][50] = { 0 }; //特征值初始化
Point featblk[32]; //标记相同H的黑点坐标
int featk; //标记相同H的黑点数目
int m; //for 里面的变量
// printf("--outlinefeature--");
// 获取图像信息
height = imglk->height;
width = imglk->width;
step = imglk->widthStep;
channels = imglk->nChannels;
data = (uchar *)imglk->imageData;
//初始化特征矩阵 最大值为47 非空的特征字有1081个
int outllab[9][9] = { \
{3, 37, 10, 36, 2, 35, 9, 34, 1}, { 38, 3, 21, 20, 2, 19, 18, 1, 33 }, \
{11, 22, 3, 10, 2, 9, 1, 17, 8}, { 39, 23, 11, 3, 2, 1, 8, 16, 32 }, \
{4, 4, 4, 4, 0, 0, 0, 0, 0}, { 40, 24, 12, 5, 6, 7, 15, 31, 47 }, \
{12, 25, 5, 13, 6, 14, 7, 30, 15}, { 41, 5, 26, 27, 6, 28, 29, 7, 46 }, \
{5, 42, 13, 43, 6, 44, 14, 45, 7} };
for (i = 4; i <= width - 5; i++){
for (j = 4; j <= height - 5; j++){
if (data[j*step + i*channels] == 0){
//**************H=1
memset(featblk, 0, sizeof(Point) * 32); //归零
featk = 0;
if (data[j*step + (i + 1)*channels] == 0){ //右侧点
featblk[featk].x = i + 1;
featblk[featk].y = j;
featk++;
}
for (m = i + 1; m >= i - 1; m--){ //上排点
if (data[(j - 1)*step + m*channels] == 0) {
featblk[featk].x = m;
featblk[featk].y = j - 1;
featk++;
}
}
if (data[j*step + (i - 1)*channels] == 0){ //左侧点
featblk[featk].x = i - 1;
featblk[featk].y = j;
featk++;
}
for (m = i - 1; m <= i + 1; m++) { //下排点
if (data[(j + 1)*step + m*channels] == 0){
featblk[featk].x = m;
featblk[featk].y = j + 1;
featk++;
}
}
//统计特征点
if (featk >= 2){
for (m = 1; m <= featk - 1; m++){
feat[outllab[featblk[m - 1].x - i + 4][featblk[m - 1].y - j + 4]][outllab[featblk[m].x - i + 4][featblk[m].y - j + 4]]++;
}
}
//H=1*******************
//*********************H=2
memset(featblk, 0, sizeof(Point) * 32); //归零
featk = 0;
for (m = j + 1; m >= j - 2; m--){
if (data[m*step + (i + 2)*channels] == 0){ //右排点
featblk[featk].x = i + 2;
featblk[featk].y = m;
featk++;
}
}
for (m = i + 1; m >= i - 2; m--){ //上排点
if (data[(j - 2)*step + m*channels] == 0){
featblk[featk].x = m;
featblk[featk].y = j - 2;
featk++;
}
}
for (m = j - 1; m <= j + 2; m++){ //左侧点
if (data[m*step + (i - 2)*channels] == 0){
featblk[featk].x = i - 2;
featblk[featk].y = m;
featk++;
}
}
for (m = i - 1; m <= i + 2; m++){ //下排点
if (data[(j + 2)*step + m*channels] == 0){
featblk[featk].x = m;
featblk[featk].y = j + 2;
featk++;
}
}
//统计特征点
if (featk >= 2){
for (m = 1; m <= featk - 1; m++){
feat[outllab[featblk[m - 1].x - i + 4][featblk[m - 1].y - j + 4]][outllab[featblk[m].x - i + 4][featblk[m].y - j + 4]]++;
}
}
//H=2********************
//*********************H=3
memset(featblk, 0, sizeof(Point) * 32); //归零
featk = 0;
for (m = j + 2; m >= j - 3; m--){
if (data[m*step + (i + 3)*channels] == 0){ //右排点
featblk[featk].x = i + 3;
featblk[featk].y = m;
featk++;
}
}
for (m = i + 2; m >= i - 3; m--){ //上排点
if (data[(j - 3)*step + m*channels] == 0){
featblk[featk].x = m;
featblk[featk].y = j - 3;
featk++;
}
}
for (m = j - 2; m <= j + 3; m++){ //左侧点
if (data[m*step + (i - 3)*channels] == 0){
featblk[featk].x = i - 3;
featblk[featk].y = m;
featk++;
}
}
for (m = i - 2; m <= i + 3; m++){ //下排点
if (data[(j + 3)*step + m*channels] == 0){
featblk[featk].x = m;
featblk[featk].y = j + 3;
featk++;
}
}
//统计特征点
if (featk >= 2){
for (m = 1; m <= featk - 1; m++){
feat[outllab[featblk[m - 1].x - i + 4][featblk[m - 1].y - j + 4]][outllab[featblk[m].x - i + 4][featblk[m].y - j + 4]]++;
}
}
//H=3********************
//*********************H=4
memset(featblk, 0, sizeof(Point) * 32); //归零
featk = 0;
for (m = j + 3; m >= j - 4; m--){
if (data[m*step + (i + 4)*channels] == 0){ //右排点
featblk[featk].x = i + 4;
featblk[featk].y = m;
featk++;
}
}
for (m = i + 3; m >= i - 4; m--) { //上排点
if (data[(j - 4)*step + m*channels] == 0){
featblk[featk].x = m;
featblk[featk].y = j - 4;
featk++;
}
}
for (m = j - 3; m <= j + 4; m++){ //左侧点
if (data[m*step + (i - 4)*channels] == 0){
featblk[featk].x = i - 4;
featblk[featk].y = m;
featk++;
}
}
for (m = i - 3; m <= i + 4; m++){ //下排点
if (data[(j + 4)*step + m*channels] == 0){
featblk[featk].x = m;
featblk[featk].y = j + 4;
featk++;
}
}
//统计特征点
if (featk >= 2){
for (m = 1; m <= featk - 1; m++){
feat[outllab[featblk[m - 1].x - i + 4][featblk[m - 1].y - j + 4]][outllab[featblk[m].x - i + 4][featblk[m].y - j + 4]]++;
}
}
//H=4***********************
}// if
} //for j
} //for i
//****注最终特征值为feat(x,y)+feat(y,x)放入feat(x,y)中x<y
for (i = 1; i<50; i++)
for (j = 0; j<i; j++){
feat[j][i] = feat[i][j] + feat[j][i];
feat[i][j] = 0;
}
memcpy(feature, feat, 2500 * 4); //int有四个字节
// printf("轮廓特征值计算完成\n");
return 0;
}
/*
功能:对单张图像的处理,最终得到一个特征值,用来计算各个图像之间的卡方距离
@变量 path 图像的物理地址
@变量 feature 图像的特征值
@返回值 处理后的图像
*/
IplImage* singlefeature(char* path, int feature[][50])
{
//定义变量
IplImage* img = 0; //原图
IplImage* imglk = 0; //轮廓图
IplImage* imggj = 0; //骨架图
IplImage* imgjbsb = 0; //角标识别图
IplImage* imgbj = 0; //只提取笔记部分的图像
IplImage* imgbjhf = 0; //为文字区域画上方格
IplImage* imgwzbj = 0; //为文字区域标出是否为文字(文字标记)
int height, width, step, channels;
uchar *data;
int i, j; //用于返回图像每行黑像素的个数
//int feature[50][50]={0}; //特征值初始化
img = cvLoadImage(path, 0);
/* 获取图像信息*/
height = img->height;
width = img->width;
step = img->widthStep;
channels = img->nChannels;
data = (uchar *)img->imageData;
/*开始处理*/
/*图像放大*/
IplImage* imgbig = 0; //原图的放大图
CvSize dst_cvsize; //目标图像的大小
float scale = 1;
if (width<840){
scale = (float)840 / width;
dst_cvsize.width = 840;
dst_cvsize.height = (int)(height*scale);
}
else
{
dst_cvsize.width = width;
dst_cvsize.height = height;
}
imgbig = cvCreateImage(dst_cvsize, img->depth, img->nChannels);
cvResize(img, imgbig, CV_INTER_LINEAR); // CV_INTER_NN - 最近邻插值,
//CV_INTER_LINEAR - 双线性插值 (缺省使用),
//CV_INTER_AREA - 使用象素关系重采样。当图像缩小时候,该方法可以避免波纹出现。
//CV_INTER_CUBIC - 立方插值.
/*二值化*/
binary(imgbig, g_bi_threshold);
/*裁剪识别*/
int jbwhite = 5, jbblack = 4;
imgjbsb = cvCreateImage(cvGetSize(imgbig), imgbig->depth, imgbig->nChannels);
imgbj = Cjbsb(imgbig, imgjbsb, jbwhite, jbblack); //返回文字的笔迹部分
/*计算骨架图*/
imggj = cvCreateImage(cvGetSize(imgbj), imgbj->depth, imgbj->nChannels); //复制
cvCopy(imgbj, imggj, NULL);
uchar *gjdata = (uchar *)imggj->imageData;
beforethin(gjdata, gjdata, imggj->width, imggj->height);
/*笔迹图像颜色范围转换,以进行细化*/
for (j = 0; j<imggj->height; j++)//取值范围转到0--1
{
for (i = 0; i<imggj->width; i++)
{
if (gjdata[j*imggj->widthStep + i] == 255)
gjdata[j*imggj->widthStep + i] = 1;
}
}
/*细化*/
ThinnerRosenfeld(imggj->imageData, imggj->height, imggj->width);
/*笔记图像颜色范围转化回正常水平*/
for (j = 0; j<imggj->height; j++)//取值范围转到0--255,反转过来
{
for (i = 0; i<imggj->width; i++)
{
if (gjdata[j*imggj->widthStep + i] == 1)
gjdata[j*imggj->widthStep + i] = 0;
else
gjdata[j*imggj->widthStep + i] = 255;
}
}
/*计算骨架特征徝*/
outlinefeature(imggj, feature); //特征值占48*48的右上三角形feature调用返回
/*释放内存*/
cvReleaseImage(&imgbig);
cvReleaseImage(&img);
cvReleaseImage(&imgbj);
cvReleaseImage(&imglk);
cvReleaseImage(&imgjbsb);
cvReleaseImage(&imgbjhf);
cvReleaseImage(&imgwzbj);
cvDestroyAllWindows();
return imggj;
}
/*
功能细化之前的图像颜色处理将颜色范围转换到0-1
@变量 ip 图像的句柄
@变量 jp
@变量 lx 图象宽度
@变量 ly 图象高度
@返回值 空
*/
void beforethin(unsigned char *ip, unsigned char *jp, unsigned long lx, unsigned long ly)
{
unsigned long i, j;
for (i = 0; i<ly; i++){
for (j = 0; j<lx; j++){
//这里要视前景是白点还是黑点而定,可以改动
//如果前景是白点,就是这样;反之反过来
//jp[i*lx+j]=ip[i*lx+j];
/* jp[i*lx+j]=255;*/
if (ip[i*lx + j]>0)
jp[i*lx + j] = 0;
else
jp[i*lx + j] = 255;
}
}
}
/*功能:细化算法 Rosenfeld细化算法用于完成对笔迹图像的股价提取
@变量 image 代表图象的一维数组
@变量 lx 图象宽度
@变量 ly 图象高度
@返回值 无返回值
*/
void ThinnerRosenfeld(void *image, unsigned long lx, unsigned long ly)
{
char *f, *g;
char n[10];
char a[5] = { 0, -1, 1, 0, 0 };
char b[5] = { 0, 0, 0, 1, -1 };
char nrnd, cond, n48, n26, n24, n46, n68, n82, n123, n345, n567, n781;
short k, shori;
unsigned long i, j;
long ii, jj, kk, kk1, kk2, kk3, size;
// printf("--Thinner_Rosenfeld--");
size = (long)lx * (long)ly;
g = (char *)malloc(size);
if (g == NULL){
printf("error in alocating mmeory!\n");
return;
}
f = (char *)image;
for (kk = 0l; kk<size; kk++){
g[kk] = f[kk];
}
do{
shori = 0;
for (k = 1; k <= 4; k++){
for (i = 1; i<lx - 1; i++){
ii = i + a[k];
for (j = 1; j<ly - 1; j++){
kk = i*ly + j;
if (!f[kk])
continue;
jj = j + b[k];
kk1 = ii*ly + jj;
if (f[kk1])
continue;
kk1 = kk - ly - 1;
kk2 = kk1 + 1;
kk3 = kk2 + 1;
n[3] = f[kk1];
n[2] = f[kk2];
n[1] = f[kk3];
kk1 = kk - 1;
kk3 = kk + 1;
n[4] = f[kk1];
n[8] = f[kk3];
kk1 = kk + ly - 1;
kk2 = kk1 + 1;
kk3 = kk2 + 1;
n[5] = f[kk1];
n[6] = f[kk2];
n[7] = f[kk3];
nrnd = n[1] + n[2] + n[3] + n[4]
+ n[5] + n[6] + n[7] + n[8];
if (nrnd <= 1)
continue;
cond = 0;
n48 = n[4] + n[8];
n26 = n[2] + n[6];
n24 = n[2] + n[4];
n46 = n[4] + n[6];
n68 = n[6] + n[8];
n82 = n[8] + n[2];
n123 = n[1] + n[2] + n[3];
n345 = n[3] + n[4] + n[5];
n567 = n[5] + n[6] + n[7];
n781 = n[7] + n[8] + n[1];
if (n[2] == 1 && n48 == 0 && n567>0){
if (!cond)
continue;
g[kk] = 0;
shori = 1;
continue;
}
if (n[6] == 1 && n48 == 0 && n123>0) {
if (!cond)
continue;
g[kk] = 0;
shori = 1;
continue;
}
if (n[8] == 1 && n26 == 0 && n345>0){
if (!cond)
continue;
g[kk] = 0;
shori = 1;
continue;
}
if (n[4] == 1 && n26 == 0 && n781>0) {
if (!cond)
continue;
g[kk] = 0;
shori = 1;
continue;
}
if (n[5] == 1 && n46 == 0){
if (!cond)
continue;
g[kk] = 0;
shori = 1;
continue;
}
if (n[7] == 1 && n68 == 0){
if (!cond)
continue;
g[kk] = 0;
shori = 1;
continue;
}
if (n[1] == 1 && n82 == 0){
if (!cond)
continue;
g[kk] = 0;
shori = 1;
continue;
}
if (n[3] == 1 && n24 == 0){
if (!cond)
continue;
g[kk] = 0;
shori = 1;
continue;
}
cond = 1;
if (!cond)
continue;
g[kk] = 0;
shori = 1;
}
}
for (i = 0; i<lx; i++){
for (j = 0; j<ly; j++){
kk = i*ly + j;
f[kk] = g[kk];
}
}
}
} while (shori);
free(g);
}

View File

@@ -0,0 +1,97 @@
/*
头文件process.h 图像处理函数头文件
*/
#pragma once
#include "Point.h"
#include "path.h"
#include "process.h"
#include <cv.h>
#include <direct.h>
#include <io.h>
#include <iostream>
#include <math.h>
#include <malloc.h>
#include <highgui.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
using namespace std;
/*全局变量*/
extern IplImage* src;
/***************************************函数原型****************************************/
/*
功能:读入图像文件,进行二值化
@变量 img iplimage图像文件
@变量 bithro 二值化阈值
@返回值 黑像素的数目(待用)
*/
int* binary(IplImage* img, int bithro);
/*
功能:读入图像文件,对图像进行裁剪
@变量 img iplimage图像文件
@变量 img 裁剪后的iplimage图像文件
@jbwhite
@jbblack
@返回值 返回裁剪后的图像
*/
IplImage* Cjbsb(IplImage* img, IplImage* imgjbsb, int jbwhite, int jbblack);
/*
功能:计算图像的特征
@变量 imgbj 笔迹部分的图像
@返回值 计算得到的特征图像
*/
IplImage* outline(IplImage* imgbj);
/*
功能:输入图像的特征轮廓图,返回图像的特征值
@变量 imglk 输入的图像轮廓图
@变量 feature 得到的图像特征
@返回值 成功1失败0
*/
int outlinefeature(IplImage* imglk, int feature[][50]);
/*
功能:对单张图像的处理,最终得到一个特征值,用来计算各个图像之间的卡方距离
@变量 path 图像的物理地址
@变量 feature 图像的特征值
@返回值 处理后的图像
*/
IplImage* singlefeature(char* path, int feature[][50]);
/*
功能细化之前的图像颜色处理将颜色范围转换到0-1
@变量 ip 图像的句柄
@变量 jp
@变量 lx 图象宽度
@变量 ly 图象高度
@返回值 空
*/
void beforethin(unsigned char *ip, unsigned char *jp, unsigned long lx, unsigned long ly);
/*功能:细化算法 Rosenfeld细化算法用于完成对笔迹图像的股价提取
@变量 image 代表图象的一维数组
@变量 lx 图象宽度
@变量 ly 图象高度
@返回值 无返回值
*/
void ThinnerRosenfeld(void *image, unsigned long lx, unsigned long ly);

View File

@@ -0,0 +1,177 @@
/*
主函数文件segmentation.cpp 主函数的实现文件
*/
#include "stdafx.h"
#include "segmentation.h"
/*主函数*/
int _Check(char *fpname1, char *dest){
/*读取配置文件,并配置各项参数*/
ReadConfig("D:\\HWCV\\config\\configure.cfg");
/*初始化log文件*/
memset(g_log_rec, 0, sizeof(g_log_rec));
time_t timer;
struct tm *tblock;
timer = time(NULL);
tblock = localtime(&timer);
strcat(g_log_rec, "\n----------------------------------------------------\n");
strcat(g_log_rec, asctime(tblock));
SaveLog(g_log_rec, g_log_adr, "a");
/*变量定义*/
vector<string> suspict; //记录嫌疑图片地址
vector<float> suspict_wcd; //嫌疑图片的wcd值
vector<string> files; //存储该生所有考试文件路径
vector<string> dateVec, subjectVec, stuNum2;
vector<string> flagVec;//记录查到的学生的所有考试信息
int i, ii, jj, feature[50][50][30] = { 0 }, featureall = 0;
double featurep[50][50][30] = { 0 };
double bzcu[50][50] = { 0 };
double bzckesa[50][50] = { 0 };
double wcd[30] = { 0 };
int featx[50][50] = { 0 };
int featdif[30] = { 0 };
float maxx = 0; //最大特征值的标号与值
int xyimgnum = 0; //嫌疑图片的数目
char str[80]; //存储地址
/*查询数据库*/
string stuNum = fpname1;
DbImg(stuNum, dateVec, subjectVec, stuNum2);
/*生成路径*/
for (int cp_i = 0; cp_i < dateVec.size(); cp_i++)
{
files.push_back(CrPath(dateVec[cp_i], subjectVec[cp_i], stuNum2[cp_i]));
}
int size = files.size();/*找到的路径的数量*/
/*对每一张图片进行处理*/
for (i = 0; i < size; i++)
{
memset(str, 0, sizeof(str));
memset(featx, 0, sizeof(featx));
memset(bzcu, 0, sizeof(bzcu));
strcpy(str, files[i].c_str());
singlefeature(str, featx);//featx[][50]
featureall = 0; //图像特征值和的初始化
for (ii = 0; ii < 48; ii++) //将featx存起来,回头看能不能用函数换掉
for (jj = ii + 1; jj < 47; jj++)
{
feature[ii][jj][i] = featx[ii][jj];
featureall = featureall + featx[ii][jj];
}
/*求轮廓方向特征featurep式(5) 与标准差中的u的和*/
for (ii = 0; ii < 48; ii++)
for (jj = ii + 1; jj < 47; jj++)
{
featurep[ii][jj][i] = (double)featx[ii][jj] / featureall;
bzcu[ii][jj] += (double)featx[ii][jj] / featureall * 1000; //标准差的值过小,进行放大1
}
}/*处理完全部图片*/
/*求标准差中u*/
for (ii = 0; ii < 48; ii++)
for (jj = ii + 1; jj < 47; jj++)
bzcu[ii][jj] = bzcu[ii][jj] / size;
/*步骤:读取标准差文件*/
int bzccolumns = 47;//txt文件中有47列
vector<double *> output_bzc;
if (!ReadScanf("D:\\HWCV\\config\\stdfile.db", bzccolumns, output_bzc)) return 0;
for (ii = 0; ii < 48; ii++)//output_vector可视为二维数组;输出数组元素:
for (jj = ii + 1; jj < 47; jj++)
bzckesa[ii][jj] = output_bzc[ii][jj];
/*求相似性即带权卡方wcd*/
for (i = 0; i < size; i++)
for (ii = 0; ii < 48; ii++)
for (jj = ii + 1; jj < 47; jj++)
if (featurep[ii][jj][i] * featurep[ii][jj][g_conti] != 0 && bzckesa[ii][jj] != -1)
wcd[i] += pow((featurep[ii][jj][i] - featurep[ii][jj][g_conti]), 2) / ((featurep[ii][jj][i] + featurep[ii][jj][g_conti])*bzckesa[ii][jj]);
/*求卡方距离的最大值*/
for (i = 0; i < size; i++)
{
if (wcd[i] > 0.12)
{
xyimgnum++;
suspict.push_back(files[i].c_str());
suspict_wcd.push_back(wcd[i]);
flagVec.push_back("1");//嫌疑标记1
}
else
{
flagVec.push_back("0");
}
}
/*结果更新数据库*/
DbUpdate(stuNum, dateVec, subjectVec, stuNum2, flagVec);
/*将结果存入log文件*/
memset(g_log_rec, 0, sizeof(g_log_rec));
strcpy(g_log_rec, "图片总数为:");
char pic_num[20];
_itoa(size, pic_num, 10);
strcat(g_log_rec, pic_num);
if (xyimgnum > 0)
{
strcat(g_log_rec, "\n");
for (i = 0; i < xyimgnum; i++)
{
strcat(g_log_rec, "\t");
strcat(g_log_rec, suspict[i].c_str());
strcat(g_log_rec, "\t");
char a[20];
sprintf(a, "%g", suspict_wcd[i]);
strcat(g_log_rec, a);
strcat(g_log_rec, "\n");
}
}
else strcat(g_log_rec, "\t没有嫌疑图像!\n");
SaveLog(g_log_rec, g_log_adr, "a");
/*善后*/
suspict.clear();
suspict_wcd.clear();
output_bzc.clear();
memset(g_log_rec, 0, sizeof(g_log_rec));
memset(feature, 0, sizeof(feature));
memset(featurep, 0, sizeof(featurep));
memset(bzckesa, 0, sizeof(bzckesa));
memset(wcd, 0, sizeof(wcd));
memset(featdif, 0, sizeof(featdif));
files.clear();
dateVec.clear();
subjectVec.clear();
stuNum2.clear();
flagVec.clear();
/*返回到网页结果*/
char out[200] = "当前时间为:";
strcat(out, asctime(tblock));
strcat(out, "<br>鉴定学号为:");
strcat(out, fpname1);
strcat(out, "<br>");
if(xyimgnum>0)
strcat(out,"作弊!<br>");
sprintf(dest, out);
/*返回值*/
return 1;
}

View File

@@ -0,0 +1,57 @@
/*
头文件segmentation.h 主函数头文件
*/
#pragma once
#ifdef WIN32 //屏蔽VC6对STL的一些不完全支持造成
#pragma warning (disable: 4514 4786)
#endif
#include "StdAfx.h"
#include "DBop.h"
#include "path.h"
#include "Point.h"
#include "process.h"
using namespace std;
/*定义全局变量*/
int g_bi_threshold; /* 全局变量 二值化阈值*/
double g_std_kesa[50][50]; /* 全局变量 标准差数组*/
float g_doubt_threshold = 0.12; /* 全局变量 作弊嫌疑阈值*/
string g_dir; /* 全局变量 总路径的目录*/
int g_cheat_num_threshold = 0; /* 全局变量 默认作弊阈值*/
int g_conti; /* 全局变量 默认作弊比较的图片*/
int g_all_img_num = 0; /* 全局变量 已鉴定的全部图片数量*/
int g_doubt_img_num = 0; /* 全局变量 已鉴定怀疑的图片数量*/
int g_all_stu_num = 0; /* 全局变量 已鉴定的全部学生数量*/
int g_doubt_stu_num = 0; /* 全局变量 已鉴定怀疑的学生数量*/
//string g_db_hostName = "192.168.200.97"; /*全局变量 服务器ip或名称*/
//string g_db_dBName = "purple"; /*全局变量 服务器ODBC数据源*/
//string g_db_userName = "BJSH"; /*全局变量 服务器用户名*/
//string g_db_password = "bjshadmin"; /*全局变量 服务器密码*/
string g_db_hostName = "localhost"; /*全局变量 服务器ip或名称*/
string g_db_dBName = "orcl123"; /*全局变量 服务器ODBC数据源*/
string g_db_userName = "yannsy"; /*全局变量 服务器用户名*/
string g_db_password = "123456"; /*全局变量 服务器密码*/
string g_db_qurry_start = "200906"; /*全局变量 数据库查询_开始日期*/
string g_db_qurry_end = "201610"; /*全局变量 数据库查询_结束日期*/
string g_db_qurry_zone = "0"; /*全局变量 数据库查询_特定区域*/
string g_db_qurry_stu_num = "0"; /*全局变量 数据库查询_特定考号*/
bool g_db_qurry_all = true; /*全局变量 数据库查询_查询全部标记*/
string g_db_hoster_zk; /*全局变量 数据库用户zk考试院的zk本地的yannsy*/
bool g_output_cmd_config = false; /*全局变量 输出参数控制*/
bool g_output_txt_config = false; /*全局变量 输出中间文件选项*/
char *g_log_adr = "D:/HWCV/log_ori.txt"; /*全局变量 程序日志存储地址*/
char g_log_rec[500] = { 0 }; /*全局变量 程序日志专用变量*/
char g_err_adr[30] = "D:/HWCV/err_ori.txt"; /*错误日志路径*/
/*全局变量 输出txt结果文件*/
/*全局变量 输出txt结果文件地址*/
int _Check(char *fpname1, char *dest);

View File

@@ -0,0 +1,5 @@
// stdafx.cpp : 只包括标准包含文件的源文件
// HWCV_COM.pch 将作为预编译头
// stdafx.obj 将包含预编译类型信息
#include "stdafx.h"

View File

@@ -0,0 +1,27 @@
// stdafx.h : 标准系统包含文件的包含文件,
// 或是经常使用但不常更改的
// 特定于项目的包含文件
#pragma once
#ifndef STRICT
#define STRICT
#endif
#include "targetver.h"
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
#include <comsvcs.h>
#define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW
#include "resource.h"
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>

View File

@@ -0,0 +1,8 @@
#pragma once
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h并将
// WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
#include <SDKDDKVer.h>

View File

@@ -0,0 +1,29 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HWCVDLL2", "HWCVDLL2\HWCVDLL2.vcxproj", "{358E1500-F6FA-41B9-B9DE-FF079F97A261}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HWCVDLL2PS", "HWCVDLL2\HWCVDLL2PS.vcxproj", "{F10C4A05-1935-4FB8-9400-187176FCA7A6}"
ProjectSection(ProjectDependencies) = postProject
{358E1500-F6FA-41B9-B9DE-FF079F97A261} = {358E1500-F6FA-41B9-B9DE-FF079F97A261}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{358E1500-F6FA-41B9-B9DE-FF079F97A261}.Debug|Win32.ActiveCfg = Debug|Win32
{358E1500-F6FA-41B9-B9DE-FF079F97A261}.Debug|Win32.Build.0 = Debug|Win32
{358E1500-F6FA-41B9-B9DE-FF079F97A261}.Release|Win32.ActiveCfg = Release|Win32
{358E1500-F6FA-41B9-B9DE-FF079F97A261}.Release|Win32.Build.0 = Release|Win32
{F10C4A05-1935-4FB8-9400-187176FCA7A6}.Debug|Win32.ActiveCfg = Debug|Win32
{F10C4A05-1935-4FB8-9400-187176FCA7A6}.Release|Win32.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,74 @@
// HWCVDLL2.cpp : DLL 导出的实现。
//
// 注意: COM+ 1.0 信息:
// 请记住运行 Microsoft Transaction Explorer 以安装组件。
// 默认情况下不进行注册。
#include "stdafx.h"
#include "resource.h"
#include "HWCVDLL2_i.h"
#include "dllmain.h"
#include "compreg.h"
using namespace ATL;
// 用于确定 DLL 是否可由 OLE 卸载。
STDAPI DllCanUnloadNow(void)
{
return _AtlModule.DllCanUnloadNow();
}
// 返回一个类工厂以创建所请求类型的对象。
STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID* ppv)
{
return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
}
// DllRegisterServer - 在系统注册表中添加项。
STDAPI DllRegisterServer(void)
{
// 注册对象、类型库和类型库中的所有接口
HRESULT hr = _AtlModule.DllRegisterServer();
return hr;
}
// DllUnregisterServer - 在系统注册表中移除项。
STDAPI DllUnregisterServer(void)
{
HRESULT hr = _AtlModule.DllUnregisterServer();
return hr;
}
// DllInstall - 按用户和计算机在系统注册表中逐一添加/移除项。
STDAPI DllInstall(BOOL bInstall, _In_opt_ LPCWSTR pszCmdLine)
{
HRESULT hr = E_FAIL;
static const wchar_t szUserSwitch[] = L"user";
if (pszCmdLine != NULL)
{
if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0)
{
ATL::AtlSetPerUserRegistration(true);
}
}
if (bInstall)
{
hr = DllRegisterServer();
if (FAILED(hr))
{
DllUnregisterServer();
}
}
else
{
hr = DllUnregisterServer();
}
return hr;
}

View File

@@ -0,0 +1,10 @@
; HWCVDLL2.def :
LIBRARY
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
DllInstall PRIVATE

View File

@@ -0,0 +1,59 @@
// HWCVDLL2.idl : HWCVDLL2 的 IDL 源
//
// 此文件将由 MIDL 工具处理以
// 产生类型库(HWCVDLL2.tlb)和封送处理代码。
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(a817e7a2-43fa-11d0-9e44-00aa00b6770a),
dual,
pointer_default(unique)
]
interface _cHWCV : IDispatch
{
[id(1)] HRESULT Attach([in] BSTR bstrPath);
[id(2)] HRESULT RegisterAll();
[id(3)] HRESULT UnregisterAll();
[id(4)] HRESULT GetComponents([out] SAFEARRAY(BSTR)* pbstrCLSIDs, [out] SAFEARRAY(BSTR)* pbstrDescriptions);
[id(5)] HRESULT RegisterComponent([in] BSTR bstrCLSID);
[id(6)] HRESULT UnregisterComponent([in] BSTR bstrCLSID);
};
[
object,
uuid(E49365D0-22E5-4606-84FB-21337B4B13E6),
dual,
nonextensible,
pointer_default(unique)
]
interface IcHWCV : IDispatch{
[id(1)] HRESULT aspHWCV([in] BSTR filepath, [out, retval] BSTR* _arg2);
};
[
uuid(FC552832-4C05-43B6-9204-23C7BC570893),
version(1.0),
custom(a817e7a1-43fa-11d0-9e44-00aa00b6770a,"{CA35E0FE-B922-44CF-9AE1-49EDE515632F}")
]
library HWCVDLL2Lib
{
importlib("stdole2.tlb");
[
uuid(CA35E0FE-B922-44CF-9AE1-49EDE515632F)
]
coclass CompReg
{
[default] interface _cHWCV;
};
[
uuid(B4CF6355-DBD1-47CF-A296-2358D551C690)
]
coclass cHWCV
{
[default] interface IcHWCV;
};
};

View File

@@ -0,0 +1,15 @@
HKCR
{
NoRemove CLSID
{
ForceRemove {CA35E0FE-B922-44CF-9AE1-49EDE515632F} = s 'CompReg Class'
{
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
TypeLib = s '{FC552832-4C05-43B6-9204-23C7BC570893}'
Version = s '1.0'
}
}
}

View File

@@ -0,0 +1,167 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.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>{358E1500-F6FA-41B9-B9DE-FF079F97A261}</ProjectGuid>
<Keyword>AtlProj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</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'">
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<HeaderFileName>HWCVDLL2_i.h</HeaderFileName>
<InterfaceIdentifierFileName>HWCVDLL2_i.c</InterfaceIdentifierFileName>
<ProxyFileName>HWCVDLL2_p.c</ProxyFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)HWCVDLL2.tlb</TypeLibraryName>
<DllDataFileName />
<ValidateAllParameters>true</ValidateAllParameters>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
<ModuleDefinitionFile>.\HWCVDLL2.def</ModuleDefinitionFile>
<AdditionalDependencies>comsvcs.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<RegisterOutput>true</RegisterOutput>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<HeaderFileName>HWCVDLL2_i.h</HeaderFileName>
<InterfaceIdentifierFileName>HWCVDLL2_i.c</InterfaceIdentifierFileName>
<ProxyFileName>HWCVDLL2_p.c</ProxyFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)HWCVDLL2.tlb</TypeLibraryName>
<DllDataFileName />
<ValidateAllParameters>true</ValidateAllParameters>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
<ModuleDefinitionFile>.\HWCVDLL2.def</ModuleDefinitionFile>
<AdditionalDependencies>comsvcs.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<RegisterOutput>true</RegisterOutput>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="cHWCV.cpp" />
<ClCompile Include="compreg.cpp" />
<ClCompile Include="dllmain.cpp">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="HWCVDLL2.cpp" />
<ClCompile Include="HWCVDLL2_i.c">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="cHWCV.h" />
<ClInclude Include="compreg.h" />
<ClInclude Include="dllmain.h" />
<ClInclude Include="HWCVDLL2_i.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="HWCVDLL2.rc" />
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<None Include="cHWCV.rgs" />
<None Include="HWCVDLL2.def" />
<None Include="HWCVDLL2.rgs" />
</ItemGroup>
<ItemGroup>
<Midl Include="HWCVDLL2.idl" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,88 @@
<?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;hh;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>
<Filter Include="生成的文件">
<UniqueIdentifier>{dfd5d488-af86-48ac-9755-2a693c7e67f7}</UniqueIdentifier>
<SourceControlFiles>False</SourceControlFiles>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="HWCVDLL2.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="compreg.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="HWCVDLL2_i.c">
<Filter>生成的文件</Filter>
</ClCompile>
<ClCompile Include="cHWCV.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="dllmain.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="compreg.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="HWCVDLL2_i.h">
<Filter>生成的文件</Filter>
</ClInclude>
<ClInclude Include="cHWCV.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="HWCVDLL2.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<None Include="HWCVDLL2.rgs">
<Filter>资源文件</Filter>
</None>
<None Include="HWCVDLL2.def">
<Filter>源文件</Filter>
</None>
<None Include="cHWCV.rgs">
<Filter>资源文件</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Midl Include="HWCVDLL2.idl">
<Filter>源文件</Filter>
</Midl>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.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>{F10C4A05-1935-4FB8-9400-187176FCA7A6}</ProjectGuid>
<Keyword>AtlPSProj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</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'">
<IntDir>$(Configuration)PS\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IntDir>$(Configuration)PS\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;REGISTER_PROXY_DLL;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;ole32.lib;advapi32.lib;comsvcs.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>HWCVDLL2PS.def</ModuleDefinitionFile>
<RegisterOutput>true</RegisterOutput>
</Link>
<PreBuildEvent>
<Command>if exist dlldata.c goto :END
Echo 错误: MIDL 将不会生成 DLLDATA.C除非在主项目中至少有 1 个接口。
Exit 1
:END
</Command>
<Message>检查是否有所需的文件</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>WIN32;REGISTER_PROXY_DLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;ole32.lib;advapi32.lib;comsvcs.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>HWCVDLL2PS.def</ModuleDefinitionFile>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<RegisterOutput>true</RegisterOutput>
</Link>
<PreBuildEvent>
<Command>if exist dlldata.c goto :END
Echo 错误: MIDL 将不会生成 DLLDATA.C除非在主项目中至少有 1 个接口。
Exit 1
:END
</Command>
<Message>检查是否有所需的文件</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="HWCVDLL2ps.def" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dlldata.c" />
<ClCompile Include="HWCVDLL2_i.c" />
<ClCompile Include="HWCVDLL2_p.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{63d4a2eb-8f6b-4201-aa10-4c4f61883cb8}</UniqueIdentifier>
</Filter>
<Filter Include="生成的文件">
<UniqueIdentifier>{56b6970f-a8df-4e7d-ab83-074695ef9f2a}</UniqueIdentifier>
<SourceControlFiles>False</SourceControlFiles>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="HWCVDLL2ps.def" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="HWCVDLL2_i.c">
<Filter>生成的文件</Filter>
</ClCompile>
<ClCompile Include="HWCVDLL2_p.c">
<Filter>生成的文件</Filter>
</ClCompile>
<ClCompile Include="dlldata.c">
<Filter>生成的文件</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,452 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0603 */
/* at Thu Feb 23 10:08:59 2017
*/
/* Compiler settings for HWCVDLL2.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0603
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
/* @@MIDL_FILE_HEADING( ) */
#pragma warning( disable: 4049 ) /* more than 64k source lines */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __HWCVDLL2_i_h__
#define __HWCVDLL2_i_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef ___cHWCV_FWD_DEFINED__
#define ___cHWCV_FWD_DEFINED__
typedef interface _cHWCV _cHWCV;
#endif /* ___cHWCV_FWD_DEFINED__ */
#ifndef __IcHWCV_FWD_DEFINED__
#define __IcHWCV_FWD_DEFINED__
typedef interface IcHWCV IcHWCV;
#endif /* __IcHWCV_FWD_DEFINED__ */
#ifndef __CompReg_FWD_DEFINED__
#define __CompReg_FWD_DEFINED__
#ifdef __cplusplus
typedef class CompReg CompReg;
#else
typedef struct CompReg CompReg;
#endif /* __cplusplus */
#endif /* __CompReg_FWD_DEFINED__ */
#ifndef __cHWCV_FWD_DEFINED__
#define __cHWCV_FWD_DEFINED__
#ifdef __cplusplus
typedef class cHWCV cHWCV;
#else
typedef struct cHWCV cHWCV;
#endif /* __cplusplus */
#endif /* __cHWCV_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"
#ifdef __cplusplus
extern "C"{
#endif
#ifndef ___cHWCV_INTERFACE_DEFINED__
#define ___cHWCV_INTERFACE_DEFINED__
/* interface _cHWCV */
/* [unique][dual][uuid][object] */
EXTERN_C const IID IID__cHWCV;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("a817e7a2-43fa-11d0-9e44-00aa00b6770a")
_cHWCV : public IDispatch
{
public:
virtual /* [id] */ HRESULT STDMETHODCALLTYPE Attach(
/* [in] */ BSTR bstrPath) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE RegisterAll( void) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE UnregisterAll( void) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetComponents(
/* [out] */ SAFEARRAY * *pbstrCLSIDs,
/* [out] */ SAFEARRAY * *pbstrDescriptions) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE RegisterComponent(
/* [in] */ BSTR bstrCLSID) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE UnregisterComponent(
/* [in] */ BSTR bstrCLSID) = 0;
};
#else /* C style interface */
typedef struct _cHWCVVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
_cHWCV * This,
/* [in] */ REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
_cHWCV * This);
ULONG ( STDMETHODCALLTYPE *Release )(
_cHWCV * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
_cHWCV * This,
/* [out] */ UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
_cHWCV * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
_cHWCV * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR *rgszNames,
/* [range][in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
_cHWCV * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *Attach )(
_cHWCV * This,
/* [in] */ BSTR bstrPath);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *RegisterAll )(
_cHWCV * This);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *UnregisterAll )(
_cHWCV * This);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *GetComponents )(
_cHWCV * This,
/* [out] */ SAFEARRAY * *pbstrCLSIDs,
/* [out] */ SAFEARRAY * *pbstrDescriptions);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *RegisterComponent )(
_cHWCV * This,
/* [in] */ BSTR bstrCLSID);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *UnregisterComponent )(
_cHWCV * This,
/* [in] */ BSTR bstrCLSID);
END_INTERFACE
} _cHWCVVtbl;
interface _cHWCV
{
CONST_VTBL struct _cHWCVVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define _cHWCV_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define _cHWCV_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define _cHWCV_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define _cHWCV_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define _cHWCV_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define _cHWCV_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define _cHWCV_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define _cHWCV_Attach(This,bstrPath) \
( (This)->lpVtbl -> Attach(This,bstrPath) )
#define _cHWCV_RegisterAll(This) \
( (This)->lpVtbl -> RegisterAll(This) )
#define _cHWCV_UnregisterAll(This) \
( (This)->lpVtbl -> UnregisterAll(This) )
#define _cHWCV_GetComponents(This,pbstrCLSIDs,pbstrDescriptions) \
( (This)->lpVtbl -> GetComponents(This,pbstrCLSIDs,pbstrDescriptions) )
#define _cHWCV_RegisterComponent(This,bstrCLSID) \
( (This)->lpVtbl -> RegisterComponent(This,bstrCLSID) )
#define _cHWCV_UnregisterComponent(This,bstrCLSID) \
( (This)->lpVtbl -> UnregisterComponent(This,bstrCLSID) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ___cHWCV_INTERFACE_DEFINED__ */
#ifndef __IcHWCV_INTERFACE_DEFINED__
#define __IcHWCV_INTERFACE_DEFINED__
/* interface IcHWCV */
/* [unique][nonextensible][dual][uuid][object] */
EXTERN_C const IID IID_IcHWCV;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("E49365D0-22E5-4606-84FB-21337B4B13E6")
IcHWCV : public IDispatch
{
public:
virtual /* [id] */ HRESULT STDMETHODCALLTYPE aspHWCV(
/* [in] */ BSTR filepath,
/* [retval][out] */ BSTR *_arg2) = 0;
};
#else /* C style interface */
typedef struct IcHWCVVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IcHWCV * This,
/* [in] */ REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IcHWCV * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IcHWCV * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
IcHWCV * This,
/* [out] */ UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
IcHWCV * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
IcHWCV * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR *rgszNames,
/* [range][in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
IcHWCV * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *aspHWCV )(
IcHWCV * This,
/* [in] */ BSTR filepath,
/* [retval][out] */ BSTR *_arg2);
END_INTERFACE
} IcHWCVVtbl;
interface IcHWCV
{
CONST_VTBL struct IcHWCVVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IcHWCV_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IcHWCV_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IcHWCV_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IcHWCV_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define IcHWCV_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define IcHWCV_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define IcHWCV_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define IcHWCV_aspHWCV(This,filepath,_arg2) \
( (This)->lpVtbl -> aspHWCV(This,filepath,_arg2) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IcHWCV_INTERFACE_DEFINED__ */
#ifndef __HWCVDLL2Lib_LIBRARY_DEFINED__
#define __HWCVDLL2Lib_LIBRARY_DEFINED__
/* library HWCVDLL2Lib */
/* [custom][version][uuid] */
EXTERN_C const IID LIBID_HWCVDLL2Lib;
EXTERN_C const CLSID CLSID_CompReg;
#ifdef __cplusplus
class DECLSPEC_UUID("CA35E0FE-B922-44CF-9AE1-49EDE515632F")
CompReg;
#endif
EXTERN_C const CLSID CLSID_cHWCV;
#ifdef __cplusplus
class DECLSPEC_UUID("B4CF6355-DBD1-47CF-A296-2358D551C690")
cHWCV;
#endif
#endif /* __HWCVDLL2Lib_LIBRARY_DEFINED__ */
/* Additional Prototypes for ALL interfaces */
unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * );
unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * );
unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * );
void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * );
unsigned long __RPC_USER LPSAFEARRAY_UserSize( unsigned long *, unsigned long , LPSAFEARRAY * );
unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal( unsigned long *, unsigned char *, LPSAFEARRAY * );
unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(unsigned long *, unsigned char *, LPSAFEARRAY * );
void __RPC_USER LPSAFEARRAY_UserFree( unsigned long *, LPSAFEARRAY * );
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,8 @@
LIBRARY
EXPORTS
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE

View File

@@ -0,0 +1,68 @@
========================================================================
活动模板库HWCVDLL2 项目概述
========================================================================
应用程序向导已为您创建了此 HWCVDLL2 项目,作为编写动态链接库 (DLL) 的起点。
本文件概要介绍组成项目的每个文件的内容。
HWCVDLL2.vcxproj
这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
HWCVDLL2.vcxproj.filters
这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
HWCVDLL2.idl
此文件包含项目中定义的类型库、接口和组件类的 IDL 定义。
此文件将由 MIDL 编译器处理,用于生成:
C++ 接口定义和 GUID 声明 (HWCVDLL2.h)
GUID 定义 (HWCVDLL2_i.c)
类型库 (HWCVDLL2.tlb)
封送处理代码 HWCVDLL2_p.c 和 dlldata.c
HWCVDLL2.h
此文件包含 HWCVDLL2.idl 中定义的项目的 C++ 接口定义和 GUID 声明。它将在编译过程中由 MIDL 重新生成。
HWCVDLL2.cpp
此文件包含对象映射和 DLL 导出的实现。
HWCVDLL2.rc
这是程序使用的所有 Microsoft Windows 资源的列表。
HWCVDLL2.def
此模块定义文件为链接器提供有关 DLL 所要求的导出的信息,它包含用于以下内容的导出:
DllGetClassObject
DllCanUnloadNow
DllRegisterServer
DllUnregisterServer
DllInstall
/////////////////////////////////////////////////////////////////////////////
其他标准文件:
StdAfx.h, StdAfx.cpp
这些文件用于生成名为 HWCVDLL2.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
Resource.h
这是用于定义资源 ID 的标准头文件。
/////////////////////////////////////////////////////////////////////////////
代理/存根 (stub) DLL 项目和模块定义文件:
HWCVDLL2ps.vcxproj
此文件是用于生成代理/存根 (stub) DLL 的项目文件(若有必要)。
主项目中的 IDL 文件必须至少包含一个接口,并且在生成代理/存根 (stub) DLL 之前必须先编译 IDL 文件。
此过程生成 dlldata.c、HWCVDLL2_i.c 和 HWCVDLL2_p.c这些是生成代理/存根 (stub) DLL 所必需的。
HWCVDLL2ps.vcxproj.filters
此文件是代理/存根项目的筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
HWCVDLL2ps.def
此模块定义文件为链接器提供有关代理/存根 (stub) 所要求的导出的信息。
/////////////////////////////////////////////////////////////////////////////
其他注释:
“COM+ 1.0 支持”选项可用于将 COM+ 1.0 库构建到您的主干应用程序中,从而让您能够使用 COM+ 1.0 类、对象和函数。
/////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,29 @@
// cHWCV.cpp : CcHWCV 的实现
#include "stdafx.h"
#include "cHWCV.h"
// CcHWCV
STDMETHODIMP CcHWCV::aspHWCV(BSTR filepath, BSTR* _arg2)
{
// TODO: 在此添加实现代码
//调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试
char *fo = "H:\\HWCVDLL2.txt";
char rec[200] = "可以调用com端口!\n";
//char* filepath_c = (_bstr_t)filepath;
strcat(rec, (char*)filepath);
strcat(rec, "\n");
FILE *fpzz3 = NULL;//需要注意
fpzz3 = fopen(fo, "w"); //创建文件
if (NULL == fpzz3) return NULL;//要返回错误代码
fprintf(fpzz3, rec);
fclose(fpzz3);
fpzz3 = NULL;//需要指向空,否则会指向原打开文件地址
//调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试信息调试信息
*_arg2 = L"success";
return S_OK;
}

View File

@@ -0,0 +1,59 @@
// cHWCV.h : CcHWCV 的声明
#pragma once
#include "resource.h" // 主符号
#include "HWCVDLL2_i.h"
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Windows CE 平台(如不提供完全 DCOM 支持的 Windows Mobile 平台)上无法正确支持单线程 COM 对象。定义 _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA 可强制 ATL 支持创建单线程 COM 对象实现并允许使用其单线程 COM 对象实现。rgs 文件中的线程模型已被设置为“Free”原因是该模型是非 DCOM Windows CE 平台支持的唯一线程模型。"
#endif
using namespace ATL;
// CcHWCV
class ATL_NO_VTABLE CcHWCV :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CcHWCV, &CLSID_cHWCV>,
public IDispatchImpl<IcHWCV, &IID_IcHWCV, &LIBID_HWCVDLL2Lib, /*wMajor =*/ 1, /*wMinor =*/ 0>
{
public:
CcHWCV()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_CHWCV)
BEGIN_COM_MAP(CcHWCV)
COM_INTERFACE_ENTRY(IcHWCV)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
STDMETHOD(aspHWCV)(BSTR filepath, BSTR* _arg2);
};
OBJECT_ENTRY_AUTO(__uuidof(cHWCV), CcHWCV)

View File

@@ -0,0 +1,26 @@
HKCR
{
HWCVDLL2.aspHWCV.1 = s 'cHWCV Class'
{
CLSID = s '{B4CF6355-DBD1-47CF-A296-2358D551C690}'
}
HWCVDLL2.aspHWCV = s 'cHWCV Class'
{
CurVer = s 'HWCVDLL2.aspHWCV.1'
}
NoRemove CLSID
{
ForceRemove {B4CF6355-DBD1-47CF-A296-2358D551C690} = s 'cHWCV Class'
{
ProgID = s 'HWCVDLL2.aspHWCV.1'
VersionIndependentProgID = s 'HWCVDLL2.aspHWCV'
ForceRemove Programmable
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
TypeLib = s '{FC552832-4C05-43B6-9204-23C7BC570893}'
Version = s '1.0'
}
}
}

View File

@@ -0,0 +1,7 @@
// compreg.cpp : CCompReg 的实现
#include "stdafx.h"
#include "compreg.h"
// CCompReg

View File

@@ -0,0 +1,7 @@
// compreg.h : CCompReg 的声明
#pragma once
#include "resource.h" // 主符号
#include "HWCVDLL2_i.h"

View File

@@ -0,0 +1,38 @@
/*********************************************************
DllData file -- generated by MIDL compiler
DO NOT ALTER THIS FILE
This file is regenerated by MIDL on every IDL file compile.
To completely reconstruct this file, delete it and rerun MIDL
on all the IDL files in this DLL, specifying this file for the
/dlldata command line option
*********************************************************/
#define PROXY_DELEGATION
#include <rpcproxy.h>
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_PROXY_FILE( HWCVDLL2 )
PROXYFILE_LIST_START
/* Start of list */
REFERENCE_PROXY_FILE( HWCVDLL2 ),
/* End of list */
PROXYFILE_LIST_END
DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )
#ifdef __cplusplus
} /*extern "C" */
#endif
/* end of generated dlldata file */

View File

@@ -0,0 +1,16 @@
// dllmain.cpp : DllMain 的实现。
#include "stdafx.h"
#include "resource.h"
#include "HWCVDLL2_i.h"
#include "dllmain.h"
#include "compreg.h"
CHWCVDLL2Module _AtlModule;
// DLL 入口点
extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
hInstance;
return _AtlModule.DllMain(dwReason, lpReserved);
}

View File

@@ -0,0 +1,10 @@
// dllmain.h : 模块类的声明。
class CHWCVDLL2Module : public ATL::CAtlDllModuleT< CHWCVDLL2Module >
{
public :
DECLARE_LIBID(LIBID_HWCVDLL2Lib)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_HWCVDLL2, "{4D061C50-9AC8-40B3-97CA-D1EF3B306D8B}")
};
extern class CHWCVDLL2Module _AtlModule;

View File

@@ -0,0 +1,5 @@
// stdafx.cpp : 只包括标准包含文件的源文件
// HWCVDLL2.pch 将作为预编译头
// stdafx.obj 将包含预编译类型信息
#include "stdafx.h"

View File

@@ -0,0 +1,27 @@
// stdafx.h : 标准系统包含文件的包含文件,
// 或是经常使用但不常更改的
// 特定于项目的包含文件
#pragma once
#ifndef STRICT
#define STRICT
#endif
#include "targetver.h"
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
#include <comsvcs.h>
#define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW
#include "resource.h"
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>

View File

@@ -0,0 +1,8 @@
#pragma once
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h并将
// WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
#include <SDKDDKVer.h>