Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
'init'
Browse files Browse the repository at this point in the history
  • Loading branch information
super1207 committed Aug 2, 2019
0 parents commit 6df9aae
Show file tree
Hide file tree
Showing 41 changed files with 2,260 additions and 0 deletions.
Binary file added pyapp_src/Release/pyapp.dll
Binary file not shown.
31 changes: 31 additions & 0 deletions pyapp_src/pyapp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.572
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyapp", "pyapp\pyapp.vcxproj", "{4113C7CA-8329-439D-B353-0866A4505C85}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4113C7CA-8329-439D-B353-0866A4505C85}.Debug|x64.ActiveCfg = Debug|x64
{4113C7CA-8329-439D-B353-0866A4505C85}.Debug|x64.Build.0 = Debug|x64
{4113C7CA-8329-439D-B353-0866A4505C85}.Debug|x86.ActiveCfg = Debug|Win32
{4113C7CA-8329-439D-B353-0866A4505C85}.Debug|x86.Build.0 = Debug|Win32
{4113C7CA-8329-439D-B353-0866A4505C85}.Release|x64.ActiveCfg = Release|x64
{4113C7CA-8329-439D-B353-0866A4505C85}.Release|x64.Build.0 = Release|x64
{4113C7CA-8329-439D-B353-0866A4505C85}.Release|x86.ActiveCfg = Release|Win32
{4113C7CA-8329-439D-B353-0866A4505C85}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3C2B463A-4794-47C0-A417-9F387A75899F}
EndGlobalSection
EndGlobal
19 changes: 19 additions & 0 deletions pyapp_src/pyapp/dllmain.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "stdafx.h"

BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

Binary file added pyapp_src/pyapp/lib/pymain.lib
Binary file not shown.
76 changes: 76 additions & 0 deletions pyapp_src/pyapp/pyapp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// pyapp.cpp : 定义 DLL 应用程序的导出函数。
//This SDK use VS2017 and write by super1207
//2019/6/2

//软件只识别当前目录下的py*.dll文件,所以,dll文件必须这样命名,如本工程就是pyapp.dll ,符合插件命名规则
//dll需要使用Release-x86或者Debug-x86来编译,并且最好使用静态编译,本工程已经设置了静态编译,开发者可以直接使用

#include "stdafx.h"

//C++ stand head
#include<string>

//C++ stand using
using namespace std;

//gobal define
#define PYEVENT(ReturnType, Name, Size) __pragma(comment(linker, "/EXPORT:" #Name "=_" #Name "@" #Size))\
extern "C" ReturnType __stdcall Name

#define PYAPI(ReturnType) extern "C" __declspec(dllexport) ReturnType __stdcall


//PYAPI的声明在pymain.lib中,PYAPI的定义在pymain.dll(软件隐藏,不对插件开发者开放)中
PYAPI(INT32)getdata(char * out);
PYAPI(INT32)disableArg();
PYAPI(INT32)enableArg();
PYAPI(INT32)clearArg();
PYAPI(INT32)addArg(const char * in);
PYAPI(INT32)getArg(char * out);
PYAPI(INT32)seleteArg(INT32 n);
PYAPI(INT32)setTraBtnText(const char * in);
//以上所有API均出现在了下面的例子中,并且有简单说明,插件开发者可以自行体会领悟

PYAPI(const char *)runapi(const char * in,char * out); //这是一个危险的api,用于SDK开发者(非插件开发者),插件开发者可以忽略它

//必须
PYEVENT(INT32, name, 4)(char * ret) //取插件名字事件,需要返回插件的名字,插件的名字是唯一的识别,所以不要试图返回不同的名字,另外,这个函数会在线程不安全的地方调用,所以,不要试图在这个函数中调用PYAPI,否者,可能产生死锁
{
strncpy_s(ret, 8192, u8"我是一个插件的名字",8000); //返回插件的名字,注意,必须保证返回的内容长度在8000以下(否则可能会被截断,最长不会超过8192,包括终止符在内),并且使用utf-8编码集,SDK中所有文本均需要使用utf-8编码,以后不再单独说明
return 0; //这个返回0是没有实际意义的,起占位作用,下面也是,不再单独说明
}

//必须
PYEVENT(INT32, choose, 0)() //插件被选中事件,推荐在这个函数中设置参数复选框
{
setTraBtnText(u8"执行"); //设置翻译按钮上的文本
clearArg(); //清除参数复选框上的数据
disableArg(); //使参数复选框不可被选中
addArg(u8"你好"); //参数复选框增加一个"你好"
addArg(u8"世界"); //参数复选框增加一个"世界"
seleteArg(1); //选择第2个参数(下标从0开始,所以是"世界")
enableArg(); //使得参数复选框可以被选中
return 0;
}

//必须
PYEVENT(INT32, mainfun,4)(char * ret) //翻译事件,需要执行翻译过程并返回翻译结果
{
char dat[8192];
char arg[8192];
getdata(dat); //取输入框数据
getArg(arg); //取参数复选框数据
string out = u8"数据和参数:" + string(dat) + string(arg);
if (out.length() < 8000) //返回数据的长度不能超过8000(包括字符串终止符在内)
{
strncpy_s(ret, 8192, out.c_str(), 8000); //返回执行结果
}
else
{
strncpy_s(ret, 8192, u8"长度过长,无法处理", 8000);
}

return 0;
}


174 changes: 174 additions & 0 deletions pyapp_src/pyapp/pyapp.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.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>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{4113C7CA-8329-439D-B353-0866A4505C85}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>pyapp</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</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>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<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|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;PYAPP_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(ProjectDir)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>pymain.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;PYAPP_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;PYAPP_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(ProjectDir)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>pymain.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;PYAPP_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="pyapp.cpp">
<RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
36 changes: 36 additions & 0 deletions pyapp_src/pyapp/pyapp.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?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;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="pyapp.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions pyapp_src/pyapp/pyapp.vcxproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
1 change: 1 addition & 0 deletions pyapp_src/pyapp/stdafx.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "stdafx.h"
15 changes: 15 additions & 0 deletions pyapp_src/pyapp/stdafx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// stdafx.h: 标准系统包含文件的包含文件,
// 或是经常使用但不常更改的
// 项目特定的包含文件
//

#pragma once

#include "targetver.h"

#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容
// Windows 头文件
#include <windows.h>


// 在此处引用程序需要的其他标头
8 changes: 8 additions & 0 deletions pyapp_src/pyapp/targetver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once

// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。

// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并
// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。

#include <SDKDDKVer.h>
4 changes: 4 additions & 0 deletions pyapp_src/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
��ͼ���빤��֧��dll�����չ
����pyapp.dll�Ĵ��룬��Ϊ���빤�߲����չ������
��ReleaseĿ¼�µ�pyapp.dll�������ͼ���빤����ͬĿ¼��������ɲ����չ
����ϸ�Ľ��ܿ���ͨ���Ķ�Դ���е�ע�ͻ��
Binary file added pymain_src/Release/pymain.dll
Binary file not shown.
Loading

0 comments on commit 6df9aae

Please sign in to comment.