Commit 84839cf8 by yunpeng.song

初始化

parents
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
========================================================================
DYNAMIC LINK LIBRARY : fmposdll
========================================================================
AppWizard has created this fmposdll DLL for you.
This file contains a summary of what you will find in each of the files that
make up your fmposdll application.
fmposdll.dsp
This file (the project file) contains information at the project level and
is used to build a single project or subproject. Other users can share the
project (.dsp) file, but they should export the makefiles locally.
fmposdll.cpp
This is the main DLL source file.
When created, this DLL does not export any symbols. As a result, it
will not produce a .lib file when it is built. If you wish this project
to be a project dependency of some other project, you will either need to
add code to export some symbols from the DLL so that an export library
will be produced, or you can check the "doesn't produce lib" checkbox in
the Linker settings page for this project.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named fmposdll.pch and a precompiled types file named StdAfx.obj.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////
// stdafx.cpp : source file that includes just the standard includes
// fmposdll.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__1C8323B1_82DA_4EAC_BB3A_B4FE1970CB85__INCLUDED_)
#define AFX_STDAFX_H__1C8323B1_82DA_4EAC_BB3A_B4FE1970CB85__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Insert your headers here
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>
#include "time.h"
#include "direct.h"
#include <iostream>
#include <vector>
using namespace std;
// TODO: reference additional headers your program requires here
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__1C8323B1_82DA_4EAC_BB3A_B4FE1970CB85__INCLUDED_)
// fmposdll.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "LoadDll.h"
//bool posCOMM(LPCTSTR portname,int iBaudrate,int iDataBits,int iStopBits,int iParity,int iFlowControl);
extern HMODULE g_hPosdll;//动态库句柄
extern HANDLE g_hComm;
extern HMODULE g_hLog;
extern POS_Open VC_POS_Open;//打开端口
extern POS_Close VC_POS_Close;//关闭端口
extern POS_RTQueryStatus VC_POS_RTQueryStatus;//实时状态查询
extern POS_RTQueryStatusLPT VC_POS_RTQueryStatusLPT;//实时状态查询
extern POS_QueryStatusLPT VC_POS_QueryStatusLPT;
extern POS_NETQueryStatus VC_POS_NETQueryStatus;//网络接口的状态查询
extern POS_StartDoc VC_POS_StartDoc;//启动一个文档
extern POS_EndDoc VC_POS_EndDoc;//结束一个文档
extern POS_BeginSaveFile VC_POS_BeginSaveFile;//启动保存数据到文件
extern POS_EndSaveFile VC_POS_EndSaveFile;//结束保存数据到文件
extern POS_GetVersionInfo VC_POS_GetVersionInfo;//获取当前动态库版本
extern POS_QueryStatus VC_POS_QueryStatus;
extern POS_SetMotionUnit VC_POS_SetMotionUnit;
extern POS_SetRightSpacing VC_POS_SetRightSpacing;
extern POS_SetLineSpacing VC_POS_SetLineSpacing;
extern POS_SetMode VC_POS_SetMode;
extern POS_S_TextOut VC_POS_S_TextOut;
extern POS_FeedLine VC_POS_FeedLine;
extern POS_S_BarcodeQR VC_POS_S_BarcodeQR;
extern POS_S_BarcodePDF417 VC_POS_S_BarcodePDF417;
extern POS_PL_BarcodeQR VC_POS_PL_BarcodeQR;
extern POS_PL_BarcodePDF417 VC_POS_PL_BarcodePDF417;
extern POS_CutPaper VC_POS_CutPaper;
extern POS_PL_SetArea VC_POS_PL_SetArea;
extern POS_PL_Clear VC_POS_PL_Clear;
extern POS_PL_TextOut VC_POS_PL_TextOut;
extern POS_PL_Print VC_POS_PL_Print;
extern WriteLog VC_Log_WriteLog;
//外部引用
extern openport TSC_openport ;
extern closeport TSC_closeport ;
extern about TSC_about ;
extern barcode TSC_barcode ;
extern clearbuffer TSC_clearbuffer ;
extern downloadpcx TSC_downloadpcx ;
extern formfeed TSC_formfeed ;
extern nobackfeed TSC_nobackfeed ;
extern printerfont TSC_printerfont ;
extern printlabel TSC_printlabel ;
extern sendcommand TSC_sendcommand ;
extern setup TSC_setup ;
extern windowsfont TSC_windowsfont ;
//==================================================================//
int whole=0;
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
extern "C" __declspec(dllexport) bool __stdcall InItConfig()
{
VC_Log_WriteLog(1,"%s","进入初始化");
if (1 == _ChoosePort())
{
_StartDoc();
return true;
}
else
{
return false;
}
}
extern "C" int __declspec(dllexport)Add(int x, int y)
{
if (false == _LoadPosdll())
{
return x-y;
}
else
{
_ChoosePort();
return x+y;
}
}
extern "C" void __declspec(dllexport)PrintData(char data[])
{
_InPrintData(data);
}
extern "C" void __declspec(dllexport)Print2dData(char data[])
{
//_InPrint2dcode(data);
}
extern "C" void __declspec(dllexport)Unloaddll()
{
_CloseDoc();
VC_Log_WriteLog(1,"%s","卸载pos函数开始");
if(INVALID_HANDLE_VALUE != g_hComm)
{
VC_POS_Close();
VC_Log_WriteLog(1,"%s","端口关闭成功");
}
if(g_hPosdll)
{
_UnloadPosdll();
VC_Log_WriteLog(1,"%s","卸载posdll成功");
}
if (g_hLog)
{
_UnloadLogdll();
}
}
extern "C" bool __declspec(dllexport)LoadAddress()
{
//VC_Log_WriteLog(1,"%s","加载pos函数开始");
if ( false == _LoadPosdll() )
{
// 如果动态库加载失败, 则退出
return false;
}
else
{
return true;
}
}
extern "C" void __declspec(dllexport)FreeLine()
{
_FreeLine();
}
extern "C" void __declspec(dllexport)Initconfigini(char data[])
{
VC_Log_WriteLog(1,"读取ini的配置文件");
_GetPrintIni(data);
}
extern "C" bool __declspec(dllexport)PrintDataLine(char data[],int fontType,int fontStyle,int width,int height)
{
return _PrintLine(data,fontType,fontStyle,width,height);
}
extern "C" bool __declspec(dllexport)PrintBarCode(char data[],int type, int leftMargin,int fontType ,int width,int height,int position)
{
return _PrintBarCode(data, type, leftMargin, fontType , width, height, position);//打印条码
}
extern "C" bool __declspec(dllexport)PrintQRCode(char data[], int type, int leftMargin,int width)
{
return _PrintQRCode( data, type, leftMargin,width);//打印行
}

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmposdll", "fmposdll.vcxproj", "{A46CE5D4-D01B-CA08-372B-B0085099921E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A46CE5D4-D01B-CA08-372B-B0085099921E}.Debug|Win32.ActiveCfg = Debug|Win32
{A46CE5D4-D01B-CA08-372B-B0085099921E}.Debug|Win32.Build.0 = Debug|Win32
{A46CE5D4-D01B-CA08-372B-B0085099921E}.Release|Win32.ActiveCfg = Release|Win32
{A46CE5D4-D01B-CA08-372B-B0085099921E}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<SccProjectName />
<SccLocalPath />
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>..\Debug\</OutDir>
<IntDir>..\Debug\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>.\Release\</OutDir>
<IntDir>.\Release\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<FunctionLevelLinking>false</FunctionLevelLinking>
<Optimization>Disabled</Optimization>
<SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<MinimalRebuild>true</MinimalRebuild>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FMPOSDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>.\Debug\</AssemblerListingLocation>
<BrowseInformation>true</BrowseInformation>
<PrecompiledHeaderOutputFile>.\Debug\fmposdll.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<ObjectFileName>.\Debug\</ObjectFileName>
<ProgramDataBaseFileName>.\Debug\</ProgramDataBaseFileName>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
<Midl>
<SuppressStartupBanner>true</SuppressStartupBanner>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TypeLibraryName>.\Debug\fmposdll.tlb</TypeLibraryName>
<MkTypLibCompatible>true</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Debug\fmposdll.bsc</OutputFile>
</Bscmake>
<Link>
<SuppressStartupBanner>true</SuppressStartupBanner>
<LinkDLL>true</LinkDLL>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OutputFile>.\Debug\fmposdll.dll</OutputFile>
<ImportLibrary>.\Debug\fmposdll.lib</ImportLibrary>
<AdditionalDependencies>odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>.\fmsdll.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<Optimization>MaxSpeed</Optimization>
<SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FMPOSDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>.\Release\</AssemblerListingLocation>
<BrowseInformation>true</BrowseInformation>
<PrecompiledHeaderOutputFile>.\Release\fmposdll.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<ObjectFileName>.\Release\</ObjectFileName>
<ProgramDataBaseFileName>.\Release\</ProgramDataBaseFileName>
</ClCompile>
<Midl>
<SuppressStartupBanner>true</SuppressStartupBanner>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TypeLibraryName>.\Release\fmposdll.tlb</TypeLibraryName>
<MkTypLibCompatible>true</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Release\fmposdll.bsc</OutputFile>
</Bscmake>
<Link>
<SuppressStartupBanner>true</SuppressStartupBanner>
<LinkDLL>true</LinkDLL>
<SubSystem>Console</SubSystem>
<OutputFile>.\Release\fmposdll.dll</OutputFile>
<ImportLibrary>.\Release\fmposdll.lib</ImportLibrary>
<AdditionalDependencies>odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>.\fmsdll.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="fmposdll.cpp" />
<ClCompile Include="LoadDll.cpp" />
<ClCompile Include="StdAfx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">stdafx.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">stdafx.h</PrecompiledHeaderFile>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="fmsdll.def" />
<CustomBuild Include="log.def">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
<CustomBuild Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="LoadDll.h" />
<ClInclude Include="StdAfx.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{8d12bb96-e474-4769-b9e0-91ac258e4a2f}</UniqueIdentifier>
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{dbe58765-75fb-4faf-b269-5ee554e894a3}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{19ee318c-ae81-4221-a63b-5d4f91a3c58f}</UniqueIdentifier>
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="fmposdll.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="LoadDll.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="StdAfx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="LoadDll.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="StdAfx.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="fmsdll.def">
<Filter>Source Files</Filter>
</CustomBuild>
<CustomBuild Include="log.def">
<Filter>Source Files</Filter>
</CustomBuild>
<CustomBuild Include="ReadMe.txt" />
</ItemGroup>
</Project>
\ No newline at end of file
// fmsFile.cpp: implementation of the fmsFile class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "fmsFile.h"
#include "LoadDll.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
fmsFile::fmsFile()
{
}
fmsFile::~fmsFile()
{
}
bool fmsFile::Loaddll()
{
if (false == LoadPosdll())
{
return false;
}
}
void fmsFile::OnOpenPort(int type)
{
switch(type)
{
case 0:
break;
}
}
\ No newline at end of file
LIBRARY fmposdll
EXPORTS
LoadAddress @1
InItConfig @2
PrintData @3
Print2dData @4
Unloaddll @5
Initconfigini @6
Add @7
PrintDataLine @8
PrintBarCode @9
PrintQRCode @10
FreeLine @11
LIBRARY Logdll
EXPORTS
WriteLog @1
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment