提交 6466073d 编写于 作者: W wangzuohuai

单机版SDK包

上级 7393a5f6
// PluginComDll.cpp : DLL 导出的实现。
#include "stdafx.h"
#include "resource.h"
#include "PluginComDll_i.h"
#include "dllmain.h"
#include "xdlldata.h"
// 用于确定 DLL 是否可由 OLE 卸载。
STDAPI DllCanUnloadNow(void)
{
#ifdef _MERGE_PROXYSTUB
HRESULT hr = PrxDllCanUnloadNow();
if (hr != S_OK)
return hr;
#endif
return _AtlModule.DllCanUnloadNow();
}
// 返回一个类工厂以创建所请求类型的对象。
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
#ifdef _MERGE_PROXYSTUB
if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
return S_OK;
#endif
return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
}
// DllRegisterServer - 在系统注册表中添加项。
STDAPI DllRegisterServer(void)
{
// 注册对象、类型库和类型库中的所有接口
HRESULT hr = _AtlModule.DllRegisterServer();
#ifdef _MERGE_PROXYSTUB
if (FAILED(hr))
return hr;
hr = PrxDllRegisterServer();
#endif
return hr;
}
// DllUnregisterServer - 在系统注册表中移除项。
STDAPI DllUnregisterServer(void)
{
HRESULT hr = _AtlModule.DllUnregisterServer();
#ifdef _MERGE_PROXYSTUB
if (FAILED(hr))
return hr;
hr = PrxDllRegisterServer();
if (FAILED(hr))
return hr;
hr = PrxDllUnregisterServer();
#endif
return hr;
}
// DllInstall - 按用户和计算机在系统注册表中逐一添加/移除项。
STDAPI DllInstall(BOOL bInstall, 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;
}
\ No newline at end of file
; PluginComDll.def : ģ
LIBRARY
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
DllInstall PRIVATE
// PluginComDll.idl : PluginComDll IDL
//
// 此文件将由 MIDL 工具处理以
// 产生类型库(PluginComDll.tlb)和封送处理代码。
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(C38672FA-B5C8-4D9D-89B5-2D71F0760661),
dual,
nonextensible,
pointer_default(unique)
]
interface ITextFile : IDispatch{
};
[
object,
uuid(E46E1B5B-2891-414F-A21A-17B00231E650),
dual,
nonextensible,
pointer_default(unique)
]
interface ISysInfo : IDispatch{
};
[
uuid(A22E18F1-95F8-4FDB-99D2-188E5FB12B23),
version(1.0),
]
library PluginComDllLib
{
importlib("stdole2.tlb");
[
uuid(40756D41-E6C7-4648-80C4-AB70A325F831)
]
dispinterface _ITextFileEvents
{
properties:
methods:
};
[
uuid(40613676-C8A5-4879-A59B-9CE6406476F6)
]
coclass TextFile
{
[default] interface ITextFile;
[default, source] dispinterface _ITextFileEvents;
};
[
uuid(FAC6FC19-9B22-4904-A656-581FCB35EC98)
]
dispinterface _ISysInfoEvents
{
properties:
methods:
};
[
uuid(6D7595BD-BFB0-4D2C-906B-247028691A50)
]
coclass SysInfo
{
[default] interface ISysInfo;
[default, source] dispinterface _ISysInfoEvents;
};
};
B// Microsoft Visual C++ generated resource script.

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PluginComDll", "PluginComDll.vcxproj", "{880E1365-4E58-469D-809B-6BE3B1D1EC5F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{880E1365-4E58-469D-809B-6BE3B1D1EC5F}.Debug|Win32.ActiveCfg = Debug|Win32
{880E1365-4E58-469D-809B-6BE3B1D1EC5F}.Debug|Win32.Build.0 = Debug|Win32
{880E1365-4E58-469D-809B-6BE3B1D1EC5F}.Debug|x64.ActiveCfg = Debug|x64
{880E1365-4E58-469D-809B-6BE3B1D1EC5F}.Debug|x64.Build.0 = Debug|x64
{880E1365-4E58-469D-809B-6BE3B1D1EC5F}.Release|Win32.ActiveCfg = Release|Win32
{880E1365-4E58-469D-809B-6BE3B1D1EC5F}.Release|Win32.Build.0 = Release|Win32
{880E1365-4E58-469D-809B-6BE3B1D1EC5F}.Release|x64.ActiveCfg = Release|x64
{880E1365-4E58-469D-809B-6BE3B1D1EC5F}.Release|x64.Build.0 = Release|x64
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="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{880E1365-4E58-469D-809B-6BE3B1D1EC5F}</ProjectGuid>
<Keyword>AtlProj</Keyword>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccProvider>
</SccProvider>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<UseOfAtl>Dynamic</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<UseOfAtl>Dynamic</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<UseOfAtl>Static</UseOfAtl>
<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 Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<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 Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<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>
<OutDir>\$(Configuration)\$(Platform)\Plugins\$(ProjectName)\</OutDir>
<IntDir>$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>true</LinkIncremental>
<OutDir>\$(Configuration)\$(Platform)\Plugins\$(ProjectName)\</OutDir>
<IntDir>$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<OutDir>\$(Configuration)\$(Platform)\Plugins\$(ProjectName)\</OutDir>
<IntDir>\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<OutDir>\$(Configuration)\$(Platform)\Plugins\$(ProjectName)\</OutDir>
<IntDir>\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<HeaderFileName>PluginComDll_i.h</HeaderFileName>
<InterfaceIdentifierFileName>PluginComDll_i.c</InterfaceIdentifierFileName>
<ProxyFileName>PluginComDll_p.c</ProxyFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)PluginComDll.tlb</TypeLibraryName>
<DllDataFileName>
</DllDataFileName>
<ValidateAllParameters>true</ValidateAllParameters>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
<ModuleDefinitionFile>.\PluginComDll.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<RegisterOutput>false</RegisterOutput>
<ProgramDatabaseFile>\$(Configuration)\$(Platform)\$(TargetName).pdb</ProgramDatabaseFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_WIN64;WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<HeaderFileName>PluginComDll_i.h</HeaderFileName>
<InterfaceIdentifierFileName>PluginComDll_i.c</InterfaceIdentifierFileName>
<ProxyFileName>PluginComDll_p.c</ProxyFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)PluginComDll.tlb</TypeLibraryName>
<DllDataFileName>
</DllDataFileName>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
<ModuleDefinitionFile>.\PluginComDll.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<RegisterOutput>false</RegisterOutput>
<ProgramDatabaseFile>\$(Configuration)\$(Platform)\$(TargetName).pdb</ProgramDatabaseFile>
</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>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<HeaderFileName>PluginComDll_i.h</HeaderFileName>
<InterfaceIdentifierFileName>PluginComDll_i.c</InterfaceIdentifierFileName>
<ProxyFileName>PluginComDll_p.c</ProxyFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)PluginComDll.tlb</TypeLibraryName>
<DllDataFileName>
</DllDataFileName>
<ValidateAllParameters>true</ValidateAllParameters>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
<ModuleDefinitionFile>.\PluginComDll.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<RegisterOutput>false</RegisterOutput>
<ProgramDatabaseFile>\$(Configuration)\$(Platform)\$(TargetName).pdb</ProgramDatabaseFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>_WIN64;WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<HeaderFileName>PluginComDll_i.h</HeaderFileName>
<InterfaceIdentifierFileName>PluginComDll_i.c</InterfaceIdentifierFileName>
<ProxyFileName>PluginComDll_p.c</ProxyFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)PluginComDll.tlb</TypeLibraryName>
<DllDataFileName>
</DllDataFileName>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
<ModuleDefinitionFile>.\PluginComDll.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<RegisterOutput>false</RegisterOutput>
<ProgramDatabaseFile>\$(Configuration)\$(Platform)\$(TargetName).pdb</ProgramDatabaseFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="PluginComDll.cpp" />
<ClCompile Include="PluginComDll_i.c">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</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>
<ClCompile Include="SysInfo.cpp" />
<ClCompile Include="TextFile.cpp" />
<ClCompile Include="TextFileHelper.cpp" />
<ClCompile Include="xdlldata.c">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="dllmain.h" />
<ClInclude Include="PluginComDll_i.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="SysInfo.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="TextFile.h" />
<ClInclude Include="TextFileHelper.h" />
<ClInclude Include="xdlldata.h" />
<ClInclude Include="_ISysInfoEvents_CP.h" />
<ClInclude Include="_ITextFileEvents_CP.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="PluginComDll.rc" />
</ItemGroup>
<ItemGroup>
<None Include="PluginComDll.def" />
<None Include="PluginComDll.rgs" />
<None Include="PluginConfig.json" />
<None Include="ReadMe.txt" />
<None Include="SysInfo.rgs" />
<None Include="TextFile.rgs" />
</ItemGroup>
<ItemGroup>
<Midl Include="PluginComDll.idl" />
</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="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="生成的文件">
<UniqueIdentifier>{8153f5ab-ee41-475a-9302-f858f98c99a9}</UniqueIdentifier>
<SourceControlFiles>False</SourceControlFiles>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="PluginComDll.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="xdlldata.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="PluginComDll_i.c">
<Filter>生成的文件</Filter>
</ClCompile>
<ClCompile Include="TextFile.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="SysInfo.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="TextFileHelper.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="xdlldata.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="PluginComDll_i.h">
<Filter>生成的文件</Filter>
</ClInclude>
<ClInclude Include="_ITextFileEvents_CP.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="TextFile.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="_ISysInfoEvents_CP.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="SysInfo.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="TextFileHelper.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="PluginComDll.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
<None Include="PluginComDll.rgs">
<Filter>资源文件</Filter>
</None>
<None Include="PluginComDll.def">
<Filter>源文件</Filter>
</None>
<None Include="TextFile.rgs">
<Filter>资源文件</Filter>
</None>
<None Include="SysInfo.rgs">
<Filter>资源文件</Filter>
</None>
<None Include="PluginConfig.json">
<Filter>资源文件</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Midl Include="PluginComDll.idl">
<Filter>源文件</Filter>
</Midl>
</ItemGroup>
</Project>
\ No newline at end of file
{
"Type": 1,
"OS": 1,
"Control": 0,
"OSMinVer": "5.0",
"Version": "2.0.2.1",
"Name": "无窗口小程序范例(C++语言)",
"Corp": "ZorroSoft",
"Icon": "",
"Date": "2020.08.25",
"Desc": "无窗口小程序(C++语言)-读写TXT记事本及获取当前系统信息",
"Home": "http://zorrosoft.com/WRL",
"Down": "http://zorrosoft.com/WRL",
"Module": "PluginComDll.dll",
"PID": "A22E18F1-95F8-4FDB-99D2-188E5FB12B23",
"Objects": [
{
"ProgID": "C38672FA-B5C8-4D9D-89B5-2D71F0760661",
"ClassID": "40613676-C8A5-4879-A59B-9CE6406476F6"
},
{
"ProgID": "E46E1B5B-2891-414F-A21A-17B00231E650",
"ClassID": "6D7595BD-BFB0-4D2C-906B-247028691A50"
}
],
"Updates": []
}
\ No newline at end of file
========================================================================
活动模板库 : PluginComDll 项目概述
========================================================================
应用程序向导已为您创建了此 PluginComDll 项目,作为编写动态链接库 (DLL)
的起点。
本文件概要介绍组成项目的每个文件的内容。
PluginComDll.vcxproj
这是使用应用程序向导生成的 VC++ 项目的主项目文件,
其中包含生成该文件的 Visual C++ 的版本信息,
以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
PluginComDll.vcxproj.filters
这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。
它包含有关项目文件与筛选器之间的关联信息。 在 IDE 中,通过这种关联,
在特定节点下以分组形式显示具有相似扩展名的文件。
例如,“.cpp”文件与“源文件”筛选器关联。
PluginComDll.idl
此文件包含项目中定义的类型库、接口和组件类的 IDL 定义。
此文件将由 MIDL 编译器处理以生成:
C++ 接口定义和 GUID 声明 (PluginComDll.h)
GUID 定义 (PluginComDll_i.c)
类型库 (PluginComDll.tlb)
封送处理代码 (PluginComDll_p.c 和
dlldata.c)
PluginComDll.h
此文件包含 PluginComDll.idl 中定义的项目的 C++ 接口定义
和 GUID 声明。 它将在编译过程中由 MIDL 重新生成。
PluginComDll.cpp
此文件包含对象映射和 DLL 导出的实现。
PluginComDll.rc
这是程序使用的所有 Microsoft Windows 资源的列表。
PluginComDll.def
此模块定义文件为链接器提供有关 DLL 所要求的导出的信息,
它包含用于以下内容的导出:
DllGetClassObject
DllCanUnloadNow
DllRegisterServer
DllUnregisterServer
DllInstall
/////////////////////////////////////////////////////////////////////////////
其他标准文件:
StdAfx.h,StdAfx.cpp
这些文件用于生成名为 PluginComDll.pch 的预编译头 (PCH) 文件和
名为 StdAfx.obj 的预编译类型文件。
Resource.h
这是用于定义资源 ID 的标准头文件。
/////////////////////////////////////////////////////////////////////////////
// SysInfo.cpp : CSysInfo 的实现
#include "stdafx.h"
#include "SysInfo.h"
#include <atlcomtime.h>
// CSysInfo
STDMETHODIMP CSysInfo::RecText(BSTR bstrContent)
{
// TODO: Add your implementation code here
ATLASSERT(NULL != m_spiSocketConnect);
if(NULL == bstrContent || NULL == m_spiSocketConnect)
return E_POINTER;
m_spiSocketConnect->put_ActiveTime(COleDateTime::GetCurrentTime().m_dt);
/// 请处理收到的文本信息,这里演示直接回复原内容
ULONG nReqID = 0;
m_spiSocketConnect->AsynSendText(bstrContent,&nReqID);
return S_OK;
}
STDMETHODIMP CSysInfo::RecJson(ULONG nReqID,BSTR bstrReqName,BSTR bstrContent)
{
// TODO: Add your implementation code here
ATLASSERT(NULL != m_spiSocketConnect);
if(NULL == bstrContent || NULL == m_spiSocketConnect)
return E_POINTER;
/// 请处理收到的普通JSON数据包
return S_OK;
}
// SysInfo.h : CSysInfo 的声明
#pragma once
#include "resource.h" // 主符号
#ifdef _USRDLL
#include "PluginComDll_i.h"
#else
#include "PluginComExe_i.h"
#endif
#include "_ISysInfoEvents_CP.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
// CSysInfo
class ATL_NO_VTABLE CSysInfo :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CSysInfo, &CLSID_SysInfo>,
public IConnectionPointContainerImpl<CSysInfo>,
public CProxy_ISysInfoEvents<CSysInfo>,
#ifdef _USRDLL
public IDispatchImpl<ISysInfo, &IID_ISysInfo, &LIBID_PluginComDllLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
#else
public IDispatchImpl<ISysInfo, &IID_ISysInfo, &LIBID_PluginComExeLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
#endif
public IDispatchImpl<IWrlConn, &__uuidof(IWrlConn), &LIBID_WrlBase, /* wMajor = */ 1>
{
protected:
/// WEB SOCKET连接对象
IWebSocketConnectPtr m_spiSocketConnect;
public:
CSysInfo()
:m_spiSocketConnect(NULL)
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_SYSINFO)
BEGIN_COM_MAP(CSysInfo)
COM_INTERFACE_ENTRY(ISysInfo)
COM_INTERFACE_ENTRY2(IDispatch, IWrlConn)
COM_INTERFACE_ENTRY(IConnectionPointContainer)
COM_INTERFACE_ENTRY(IWrlConn)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(CSysInfo)
CONNECTION_POINT_ENTRY(__uuidof(_ISysInfoEvents))
END_CONNECTION_POINT_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
if (NULL != m_spiSocketConnect)
m_spiSocketConnect = NULL;
}
public:
// IWrlConn Methods
STDMETHOD(Load)(LPDISPATCH piDispatch,BSTR bstrAuthInfo,BSTR bstrLang)
{
HRESULT hRet = piDispatch->QueryInterface(IID_IWebSocketConnect,(LPVOID *)&m_spiSocketConnect);
ATLASSERT(NULL != m_spiSocketConnect);
return hRet;
}
STDMETHOD(Unload)(EWrlCloseConnType eCloseConnType, BSTR bstrReason)
{
if(NULL != m_spiSocketConnect)
m_spiSocketConnect = NULL;
return S_OK;
}
STDMETHOD(UsbChanged)(BSTR bstrDisk, ULONG nStatus, BSTR bstrName)
{
/// 收到USB变化通知
return S_OK;
}
STDMETHOD(SendJson)(BSTR bstrContent)
{
HRESULT hRet(S_FALSE);
if (NULL != m_spiSocketConnect)
{
ULONG nRet = 0;
hRet = m_spiSocketConnect->AsynSendText(bstrContent, &nRet);
}
return hRet;
}
STDMETHOD(RecText)(BSTR bstrContent);
STDMETHOD(RecJson)(ULONG nReqID,BSTR bstrReqName,BSTR bstrContent);
STDMETHOD(RecByte)(BYTE* pContent,ULONG nLen)
{
return S_FALSE;
}
STDMETHOD(HttpRequst)(BSTR bstrUrl,BSTR bstrPara, BSTR* pVal)
{
/// HTTP服务请求响应
return E_NOTIMPL;
}
};
OBJECT_ENTRY_AUTO(__uuidof(SysInfo), CSysInfo)
HKCR
{
PluginComDll.SysInfo.1 = s 'SysInfo Class'
{
CLSID = s '{6D7595BD-BFB0-4D2C-906B-247028691A50}'
}
PluginComDll.SysInfo = s 'SysInfo Class'
{
CurVer = s 'PluginComDll.SysInfo.1'
}
NoRemove CLSID
{
ForceRemove {6D7595BD-BFB0-4D2C-906B-247028691A50} = s 'SysInfo Class'
{
ProgID = s 'PluginComDll.SysInfo.1'
VersionIndependentProgID = s 'PluginComDll.SysInfo'
ForceRemove Programmable
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
TypeLib = s '{A22E18F1-95F8-4FDB-99D2-188E5FB12B23}'
Version = s '1.0'
}
}
}
// TextFile.cpp : CTextFile 的实现
#include "stdafx.h"
#include <shlobj.h>
#include "TextFile.h"
// CTextFile
STDMETHODIMP CTextFile::RecText(BSTR bstrContent)
{
// TODO: Add your implementation code here
if(NULL == bstrContent || NULL == m_spiSocketConnect)
{
return E_POINTER;
}
HRESULT hRet = m_spiSocketConnect->put_ActiveTime(COleDateTime::GetCurrentTime().m_dt);
/// 请处理收到的文本信息,这里演示直接回复原内容
hRet = m_spiSocketConnect->AsynSendText(bstrContent,NULL);
ATLASSERT(SUCCEEDED(hRet));
/// 也可以直接发送二进制数据流,建议把二进制流进行编码后再传输
// BYTE szContent[] = "TestByte";
// hRet = m_spiSocketConnect->AsynSendByte(szContent,strlen((char*)szContent),NULL);
return hRet;
}
ATL::CString GetSpecialFolderPath(long lFoldID)
{
TCHAR szSpecialPath[MAX_PATH];
::memset(szSpecialPath,0,MAX_PATH*sizeof(TCHAR));
BOOL bGetFlag = ::SHGetSpecialFolderPath(NULL,szSpecialPath,lFoldID,TRUE);
if(!bGetFlag)
{
return _T("");
}
ATL::CString strSpecialPath(szSpecialPath);
///路径后面都有"\"
if(!strSpecialPath.IsEmpty() && 0 != strSpecialPath.Right(1).CompareNoCase(_T("\\")))
strSpecialPath+=_T("\\");
return strSpecialPath;
}
STDMETHODIMP CTextFile::RecJson(ULONG nReqID,BSTR bstrReqName,BSTR bstrContent)
{
// TODO: Add your implementation code here
ATLASSERT(NULL != m_spiSocketConnect);
if(NULL == bstrContent || NULL == m_spiSocketConnect)
return E_POINTER;
m_spiSocketConnect->put_ActiveTime(COleDateTime::GetCurrentTime().m_dt);
IJsonServicePtr spiJsonService = NULL;
HRESULT hRet = spiJsonService.CreateInstance(__uuidof(JsonService));
if(NULL == spiJsonService)
return hRet;/// 创建JSON解析器对象失败
VARIANT_BOOL bLoadFlag = VARIANT_FALSE;
spiJsonService->put_CodingType(CODINGTYPE_US2);
hRet = spiJsonService->ParseString(bstrContent,&bLoadFlag);
if(VARIANT_FALSE == bLoadFlag)
{
spiJsonService = NULL;
return hRet;
}
/// 请处理收到的普通JSON数据包
/// 在这里解析请求并作出回应
CString strReqName(bstrReqName);
if(0 == strReqName.CompareNoCase(L"Demo_WriteFile"))
{
CString strFilePath = GetSpecialFolderPath(CSIDL_COMMON_DESKTOPDIRECTORY);
CComBSTR bstrVal;
spiJsonService->GetStringValue(CComBSTR(L"Name"),&bstrVal);;
strFilePath += bstrVal.m_str;
bstrVal.Empty();
spiJsonService->GetStringValue(CComBSTR(L"Content"),&bstrVal);;
CString strContent = bstrVal.m_str;
bstrVal.Empty();
CTextFileWrite WriteFile(strFilePath);
WriteFile.Write(strContent);
WriteFile.Close();
CString strReturn;
strContent.Replace(L"\"",L"\\\"");
strFilePath.Replace(L"\\",L"/");
strReturn.Format(_T("{\"rid\":%ld,\"data\":{\"Content\":\"%s\"}}"), \
nReqID,strFilePath + L" 文件写入完成");
m_spiSocketConnect->AsynSendText(CComBSTR(strReturn),NULL);
}
else if(0 == strReqName.CompareNoCase(L"Demo_ReadFile"))
{
CString strFilePath = GetSpecialFolderPath(CSIDL_COMMON_DESKTOPDIRECTORY);
CComBSTR bstrVal;
spiJsonService->GetStringValue(CComBSTR(L"Name"),&bstrVal);;
strFilePath += bstrVal.m_str;
bstrVal.Empty();
CString strReturn;
CTextFileRead ReadFile(strFilePath);
string strLine;
while(ReadFile.ReadLine(strLine))
{
if(!strLine.length())
continue;/// 空行不发送
strReturn.Empty();
strReturn.Format(_T("{\"rid\":%ld,\"data\":{\"ReadLine\":\"%s\"}}"), \
nReqID,CString(strLine.c_str()));
m_spiSocketConnect->AsynSendText(CComBSTR(strReturn),NULL);
strLine.clear();
}
ReadFile.Close();
strReturn.Empty();
strReturn.Format(_T("{\"rid\":%ld,\"data\":{\"End\":\"%s\"}}"), \
nReqID,L"读取完成");
m_spiSocketConnect->AsynSendText(CComBSTR(strReturn), NULL);
}
else
{
CString strReturn,strContent(bstrContent);
strContent.Replace(L"\"",L"\\\"");
strReturn.Format(L"{\"rid\":%ld,\"data\":{\"Req\":\"%s\",\"Content\":\"%s\",\"Status\":\"不识别的请求\"}}",\
nReqID,strReqName,strContent);
m_spiSocketConnect->AsynSendText(CComBSTR(strReturn), NULL);
}
return S_OK;
}
\ No newline at end of file
// TextFile.h : CTextFile 的声明
#pragma once
#include "resource.h" // 主符号
#include <atlcomtime.h>
#ifdef _USRDLL
#include "PluginComDll_i.h"
#else
#include "PluginComExe_i.h"
#endif
#include "_ITextFileEvents_CP.h"
#include "TextFileHelper.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
// CTextFile
class ATL_NO_VTABLE CTextFile :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<CTextFile, &CLSID_TextFile>,
public IConnectionPointContainerImpl<CTextFile>,
public CProxy_ITextFileEvents<CTextFile>,
#ifdef _USRDLL
public IDispatchImpl<ITextFile, &IID_ITextFile, &LIBID_PluginComDllLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
#else
public IDispatchImpl<ITextFile, &IID_ITextFile, &LIBID_PluginComExeLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
#endif
public IDispatchImpl<IWrlConn, &__uuidof(IWrlConn), &LIBID_WrlBase, /* wMajor = */ 1>
{
protected:
/// WEB SOCKET连接对象
IWebSocketConnectPtr m_spiSocketConnect;
public:
CTextFile()
:m_spiSocketConnect(NULL)
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_TEXTFILE)
BEGIN_COM_MAP(CTextFile)
COM_INTERFACE_ENTRY(ITextFile)
COM_INTERFACE_ENTRY2(IDispatch, IWrlConn)
COM_INTERFACE_ENTRY(IConnectionPointContainer)
COM_INTERFACE_ENTRY(IWrlConn)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(CTextFile)
CONNECTION_POINT_ENTRY(__uuidof(_ITextFileEvents))
END_CONNECTION_POINT_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
if (NULL != m_spiSocketConnect)
m_spiSocketConnect = NULL;
}
public:
// IWrlConn Methods
STDMETHOD(Load)(LPDISPATCH piDispatch,BSTR bstrAuthInfo,BSTR bstrLang)
{
if(NULL == piDispatch)
return E_POINTER;
HRESULT hRet = piDispatch->QueryInterface(IID_IWebSocketConnect,(LPVOID *)&m_spiSocketConnect);
if(NULL != m_spiSocketConnect)
hRet = m_spiSocketConnect->put_ActiveTime(COleDateTime::GetCurrentTime().m_dt);
return hRet;
}
STDMETHOD(Unload)(EWrlCloseConnType eCloseConnType, BSTR bstrReason)
{
if(NULL != m_spiSocketConnect)
m_spiSocketConnect = NULL;
return S_OK;
}
STDMETHOD(UsbChanged)(BSTR bstrDisk, ULONG nStatus, BSTR bstrName)
{
/// 收到USB变化通知
return S_OK;
}
STDMETHOD(SendJson)(BSTR bstrContent)
{
HRESULT hRet(S_FALSE);
if (NULL != m_spiSocketConnect)
{
ULONG nRet = 0;
hRet = m_spiSocketConnect->AsynSendText(bstrContent,&nRet);
}
return hRet;
}
STDMETHOD(RecText)(BSTR bstrContent);
STDMETHOD(RecJson)(ULONG nReqID,BSTR bstrReqName,BSTR bstrContent);
STDMETHOD(RecByte)(BYTE* pContent,ULONG nLen)
{
return S_FALSE;
}
STDMETHOD(HttpRequst)(BSTR bstrUrl,BSTR bstrPara, BSTR* pVal)
{
/// HTTP服务请求响应
return E_NOTIMPL;
}
};
OBJECT_ENTRY_AUTO(__uuidof(TextFile), CTextFile)
\ No newline at end of file
HKCR
{
PluginComDll.TextFile.1 = s 'TextFile Class'
{
CLSID = s '{40613676-C8A5-4879-A59B-9CE6406476F6}'
}
PluginComDll.TextFile = s 'TextFile Class'
{
CurVer = s 'PluginComDll.TextFile.1'
}
NoRemove CLSID
{
ForceRemove {40613676-C8A5-4879-A59B-9CE6406476F6} = s 'TextFile Class'
{
ProgID = s 'PluginComDll.TextFile.1'
VersionIndependentProgID = s 'PluginComDll.TextFile'
ForceRemove Programmable
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
TypeLib = s '{A22E18F1-95F8-4FDB-99D2-188E5FB12B23}'
Version = s '1.0'
}
}
}
此差异已折叠。
// TextFileHelper.h: interface for the CTextFile class.
//
//////////////////////////////////////////////////////////////////////
#pragma once
/*
CTextFileDocument let you write and read text files with
different encodings (ASCII, UTF-8, Unicode 16 little/big
endian is supported). When you work with ASCII-files
CTextFileDocument will help you convert strings to/from
different code-pages.
Let me now if you find something strange or just gets
a clever idea...
Get the latest version at
http://www.codeproject.com/file/textfiledocument.asp
Version 1.22 - 21 May 2005
! Reading a line before reading everything could add an
extra line break.
! A member variable wasn't always initialized, could cause
problems when reading single lines.
! A smarter/easier algorithm is used when reading single lines.
Version 1.21 - 10 Apr 2005
! Fix by sammyc: If it was not possible to open a file in techlevel 1,
IsOpen returned a bad result.
Version 1.20 - 15 Jan 2005
! Fixed some problems when converting multi-byte string to Unicode,
and vice versa.
+ Improved conversion routines. It's now possible to define
which code-page to use.
+ It's now possible to set which character to use when it's
not possible to convert an Unicode character to an multi-byte character.
+ It's now possible to see if data was lost during conversion.
+ Better support for other platforms, it's no longer necessary to use
MFC in Windows.
! Reading very small files (1 byte) failed.
Version 1.13 - 26 Dec 2004
! Fixes by drinktea:
! If a text file begun with an empty line, the file
wasn't read correctly (first empty line was ignored).
! Fixes in CharToWstring and WcharToString.
Version 1.12 - 17 Oct 2004
+ Minor memory leak when open file failed, fixed.
Version 1.11 - 28 Aug 2004
! Calling WriteEndl() when writing an ASCII file could make
the file incorrectly written. Fixed.
+ ASCII files is written faster.
Version 1.10 - 13 Aug 2004
Sorry about the quick update.
+ Improved performance (much faster now, but code is more complicated :-/).
+ Buffer is used when writing files.
+ Buffer is used in non-mfc compilers
Version 1.0 - 12 Aug 2004
Initial version.
PEK
*/
/*
If you are creating a console project that doesn't support
MFC in Visual Studio, you will probably need to define
techlevel to 0:
#define PEK_TX_TECHLEVEL 0
In other cases it usually not necessary to define which "tech-level"
to use, the code below should do this for you. However,
if you need to this is the difference:
#define PEK_TX_TECHLEVEL 0
You should use this if you running on a none-Windows
platform. This uses fstream internally to read and
write files. If you want to change codepage you should
call setlocal.
#define PEK_TX_TECHLEVEL 1
Use this on Windows if you don't use MFC. This calls
Windows API directly to read and write files. If
something couldn't be read/written a CTextFileException
is thrown. Unicode in filenames are supported.
Codepages are supported.
#define PEK_TX_TECHLEVEL 2
Use this when you are using MFC. This uses CFile
internally to read and write files. If data can't be
read/written, CFile will throw an exception. Codepages
are supported. Unicode in filenames are supported.
CString is supported.
*/
#define PEK_TX_TECHLEVEL 1
#ifndef PEK_TX_TECHLEVEL
//Autodetect which "tech level" to use
#ifdef _MFC_VER
#define PEK_TX_TECHLEVEL 2
#else
#ifdef _WIN32
#define PEK_TX_TECHLEVEL 1
#else
#define PEK_TX_TECHLEVEL 0
#endif
#endif
#endif
#if PEK_TX_TECHLEVEL > 0
/*
In windows it's possible to use Unicode in filenames,
in unix it's not possible (afaik). FILENAMECHAR is the
charactertype.
*/
#ifndef _UNICODE
typedef char FILENAMECHAR;
#else
typedef wchar_t FILENAMECHAR;
#endif
#else
#include <fstream>
typedef char FILENAMECHAR;
#endif
#include <string>
#include <vector>
using namespace std;
class CTextFileBase
{
public:
enum TEXTENCODING
{
ASCII=0,
UNI16_BE,
UNI16_LE,
UTF_8
};
CTextFileBase();
~CTextFileBase();
//Is the file open?
int IsOpen();
//Close the file
virtual void Close();
//Return the encoding of the file (ASCII, UNI16_BE, UNI16_LE or UTF_8);
TEXTENCODING GetEncoding() const;
//Set which character that should be used when converting
//Unicode->multi byte and an unknown character is found ('?' is default)
void SetUnknownChar(const char unknown);
//Returns true if data was lost
//(happens when converting Unicode->multi byte string and an unmappable
//characters is found).
bool IsDataLost() const;
//Reset the data lost flag
void ResetDataLostFlag();
#if PEK_TX_TECHLEVEL > 0
/* Note!
The codepage is only used when converting from multibyte
to Unicode or vice versa. It is not used when reading
ANSI-files in none-Unicode strings, or reading
Unicode-files in Unicode strings.
This means that if you want to read a ANSI-textfile
(with some code page) to an non-Unicode string you
must do the conversion yourself. But this is easy :-).
Read the file with the codepage to a wstring, then use
ConvertCharToWstring to convert the wstring to a
string.
*/
//Set codepage to use when working with none-Unicode strings
void SetCodePage(const UINT codepage);
//Get codepage to use when working with none-Unicode strings
UINT GetCodePage() const;
//Convert char* to wstring
static void ConvertCharToWstring(const char* from, wstring &to, UINT codepage=CP_ACP);
//Convert wchar_t* to string
static void ConvertWcharToString(const wchar_t* from, string &to, UINT codepage=CP_ACP, bool* datalost=NULL, char unknownchar=0);
#else
//Convert char* to wstring
static void ConvertCharToWstring(const char* from, wstring &to);
//Convert wchar_t* to string
static void ConvertWcharToString(const wchar_t* from, string &to, bool* datalost=NULL, char unknownchar='a');
#endif
protected:
//Convert char* to wstring
void CharToWstring(const char* from, wstring &to) const;
//Convert wchar_t* to string
void WcharToString(const wchar_t* from, string &to);
//The enocoding of the file
TEXTENCODING m_encoding;
//Buffersize
#define BUFFSIZE 1024
#if PEK_TX_TECHLEVEL == 0
//Use fstream
fstream m_file;
#elif PEK_TX_TECHLEVEL == 1
HANDLE m_hFile;
#else
//In windows we are using CFile
CFile* m_file;
bool m_closeAndDeleteFile;
#endif
//These controls the buffer for reading/writing
//True if end of file
bool m_endoffile;
//Readingbuffer
char m_buf[BUFFSIZE];
//Bufferposition
int m_buffpos;
//Size of buffer
int m_buffsize;
//Character used when converting Unicode->multi byte and an unknown character was found
char m_unknownChar;
//Is true if data was lost when converting Unicode->multi-byte
bool m_datalost;
#if PEK_TX_TECHLEVEL > 0
UINT m_codepage;
#endif
};
class CTextFileWrite : public CTextFileBase
{
public:
CTextFileWrite(const FILENAMECHAR* filename, TEXTENCODING type=ASCII);
#if PEK_TX_TECHLEVEL == 2
CTextFileWrite(CFile* file, TEXTENCODING type=ASCII);
#endif
~CTextFileWrite();
//Write routines
void Write(const char* text);
void Write(const wchar_t* text);
BOOL Write(const string& text);
BOOL Write(const wstring& text);
CTextFileWrite& operator << (const char c);
CTextFileWrite& operator << (const char* text);
CTextFileWrite& operator << (const string& text);
CTextFileWrite& operator << (const wchar_t wc);
CTextFileWrite& operator << (const wchar_t* text);
CTextFileWrite& operator << (const wstring& text);
//Write new line (two characters, 13 and 10)
void WriteEndl();
//Close the file
virtual void Close();
private:
//Write and empty buffer
void Flush();
//Write a single one wchar_t, convert first
void WriteWchar(const wchar_t ch);
//Write one byte
void WriteByte(const unsigned char byte);
//Write a c-string in ASCII-format
void WriteAsciiString(const char* s);
//Write byte order mark
void WriteBOM();
};
class CTextFileRead : public CTextFileBase
{
public:
/**
* @brief
*
*
* @param filename
* @param hRecorder 文件记录句柄
* @return
*/
CTextFileRead(const FILENAMECHAR* filename);
#if PEK_TX_TECHLEVEL == 2
CTextFileRead(CFile* file);
#endif
//Returns false if end-of-file was reached
//(line will not be changed). If returns true,
//it means that last line ended with a line break.
bool ReadLine(string& line,bool bRecordSection = false);
bool ReadLine(wstring& line,bool bRecordSection = false);
//通过段落序号,获取段落内容
bool ReadLineByID(string& line,long section_id);
bool ReadLineByID(wstring& line,long section_id);
//Returns everything from current position.
bool Read(string& all, const string newline="\r\n");
bool Read(wstring& all, const wstring newline=L"\r\n");
//保存和载入段落信息
bool LoadSectionInfo(HANDLE hRecorder);
bool SaveSectionInfo(HANDLE hRecorder);
/**
* @brief 段落信息有效
*
*
* @param hRecorder 有效段落信息的文件句柄
*/
long EnableSection(HANDLE hRecorder = NULL);
//获取文件大小
DWORD GetFileSize();
#if PEK_TX_TECHLEVEL == 2
bool ReadLine(CString& line);
bool Read(CString& all, const CString newline=_T("\r\n"));
#endif
//End of file?
bool Eof() const;
private:
//Guess the number of characters in the file
int GuessCharacterCount();
//Read line to wstring
bool ReadWcharLine(wstring& line);
//Read line to string
bool ReadCharLine(string& line);
//Reset the filepointer to start
void ResetFilePointer();
//Read one wchar_t
void ReadWchar(wchar_t& ch);
//Read one byte
void ReadByte(unsigned char& ch);
//Detect encoding
void ReadBOM();
//Use extra buffer. Sometimes we read one character to much, save it.
bool m_useExtraBuffer;
//Used to read see if the first line in file is to read
//(so we know how to handle \n\r)
bool m_firstLine;
//Extra buffer. It's ok to share the memory
union
{
char m_extraBuffer_char;
wchar_t m_extraBuffer_wchar;
};
//段落位置映射表
std::vector<long> m_section_position;
bool m_section_enable;
long m_current_pos; //当前读取的位置
bool m_dirty; //写文件标志
long m_section_count; //段数
std::vector<string> m_section_buf; //段落的缓存
long m_buf_first_section; //段落缓存首段号
std::vector<wstring> m_wsection_buf; //段落的缓存
long m_wbuf_first_section; //段落缓存首段号
};
#if PEK_TX_TECHLEVEL == 1
//This is only used in Windows mode (no MFC)
//An exception is thrown will data couldn't be read or written
class CTextFileException
{
public:
CTextFileException(DWORD err)
{
m_errorCode = err;
}
//Value returned by GetLastError()
DWORD m_errorCode;
};
#endif
\ No newline at end of file
#pragma once
using namespace ATL;
template <class T>
class CProxy_ISysInfoEvents : public IConnectionPointImpl<T, &__uuidof( _ISysInfoEvents ), CComDynamicUnkArray>
{
// 警告: 此类可以由向导重新生成
public:
};
#pragma once
using namespace ATL;
template <class T>
class CProxy_ITextFileEvents : public IConnectionPointImpl<T, &__uuidof( _ITextFileEvents ), CComDynamicUnkArray>
{
// 警告: 此类可以由向导重新生成
public:
};
/*********************************************************
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( PluginComDll )
PROXYFILE_LIST_START
/* Start of list */
REFERENCE_PROXY_FILE( PluginComDll ),
/* End of list */
PROXYFILE_LIST_END
DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )
#ifdef __cplusplus
} /*extern "C" */
#endif
/* end of generated dlldata file */
// dllmain.cpp : DllMain ʵ֡
#include "stdafx.h"
#include "resource.h"
#include "PluginComDll_i.h"
#include "dllmain.h"
#include "xdlldata.h"
CPluginComDllModule _AtlModule;
// DLL ڵ
extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
#ifdef _MERGE_PROXYSTUB
if (!PrxDllMain(hInstance, dwReason, lpReserved))
return FALSE;
#endif
hInstance;
return _AtlModule.DllMain(dwReason, lpReserved);
}
// dllmain.h : ģ
class CPluginComDllModule : public ATL::CAtlDllModuleT< CPluginComDllModule >
{
public :
DECLARE_LIBID(LIBID_PluginComDllLib)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_PLUGINCOMDLL, "{F0FFF18E-E8C7-4778-8B38-45C9CD71912E}")
};
extern class CPluginComDllModule _AtlModule;
// stdafx.cpp : 只包括标准包含文件的源文件
// PluginComDll.pch 将作为预编译头
// stdafx.obj 将包含预编译类型信息
#include "stdafx.h"
// 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 构造函数将是显式的
#define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW
#include "resource.h"
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
#include <atlstr.h>
using namespace ATL;
#pragma warning( disable : 4100 )
#pragma warning( disable : 4510 )
#pragma warning( disable : 4610 )
#pragma warning( disable : 4206 )
#import "..\\Bin\\WrlEngine.dll" no_namespace, raw_interfaces_only, raw_native_types, named_guids
#import "..\\Bin\\WrlBase.dll" no_namespace, raw_interfaces_only, raw_native_types, named_guids
#pragma once
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
// WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
#include <SDKDDKVer.h>
// dlldata.c 的包装
#ifdef _MERGE_PROXYSTUB // 合并代理存根(stub) DLL
#define REGISTER_PROXY_DLL //DllRegisterServer 等
#define _WIN32_WINNT 0x0500 //对于 WinNT 4.0 或安装了 DCOM 的 Win95
#define USE_STUBLESS_PROXY //仅当使用 MIDL 开关 /Oicf 时定义
#pragma comment(lib, "rpcns4.lib")
#pragma comment(lib, "rpcrt4.lib")
#define ENTRY_PREFIX Prx
#include "dlldata.c"
#include "PluginComDll_p.c"
#endif //_MERGE_PROXYSTUB
#pragma once
#ifdef _MERGE_PROXYSTUB
extern "C"
{
BOOL WINAPI PrxDllMain(HINSTANCE hInstance, DWORD dwReason,
LPVOID lpReserved);
STDAPI PrxDllCanUnloadNow(void);
STDAPI PrxDllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv);
STDAPI PrxDllRegisterServer(void);
STDAPI PrxDllUnregisterServer(void);
}
#endif
{
"PORT": 12900
}
\ No newline at end of file
namespace PluginExeDemo
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.IEBrowser = new System.Windows.Forms.WebBrowser();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// IEBrowser
//
this.IEBrowser.Location = new System.Drawing.Point(12, 12);
this.IEBrowser.MinimumSize = new System.Drawing.Size(20, 20);
this.IEBrowser.Name = "IEBrowser";
this.IEBrowser.Size = new System.Drawing.Size(699, 604);
this.IEBrowser.TabIndex = 0;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(732, 12);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(459, 258);
this.textBox1.TabIndex = 1;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(732, 318);
this.textBox2.Multiline = true;
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(459, 298);
this.textBox2.TabIndex = 2;
//
// button1
//
this.button1.Location = new System.Drawing.Point(732, 281);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 26);
this.button1.TabIndex = 3;
this.button1.Text = "发送内容";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1203, 628);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.IEBrowser);
this.Name = "Form1";
this.Text = "C#弹窗小程序范例";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.WebBrowser IEBrowser;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button1;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;
/// 添加核心组件引用
using WrlEngine;
using WrlBase;
namespace PluginExeDemo
{
public partial class Form1 : Form
{
/// <summary>
/// web socket服务对象
/// </summary>
SocketProxyClass WebSocketServer = null;
/// <summary>
/// web socket服务事件对象
/// </summary>
WebSocketEventSink WebSocketEvent = null;
/// <summary>
/// 命令行启动参数
/// </summary>
Dictionary<string, string> m_Para;
public Form1(string strPara)
{
InitializeComponent();
m_Para = new Dictionary<string, string>();
/// 解析命令行参数
string[] cmdArray = strPara.Split('&');
foreach (string cmd in cmdArray)
{
string[] paraArray = cmd.Split('=');
foreach (string para in paraArray)
{
m_Para.Add(paraArray[0], paraArray[1]);
break;
}
}
}
public void Send(string strSID,string strContent)
{
WebSocketServer.AsynSendText(strSID,strContent);
}
public void OpenUrl(string strUrl)
{
this.IEBrowser.Navigate(strUrl);
}
private void Form1_Load(object sender, EventArgs e)
{
WebSocketServer = new SocketProxyClass();
if (null == WebSocketServer)
return;
WebSocketEvent = new WebSocketEventSink();
if (null == WebSocketEvent)
return;
WebSocketEvent.SetForm(this);
ushort nPort = ushort.Parse(m_Para["PORT"]);
ushort nListenPort = WebSocketServer.Listen(nPort, m_Para["SID"], m_Para["AI"]);
/// 建立事件通知
WebSocketServer.NewConnEvent += WebSocketEvent.NewConnEvent;
WebSocketServer.RecMsgEvent += WebSocketEvent.RecMsgEvent;
WebSocketServer.RecTextEvent += WebSocketEvent.RecTextEvent;
WebSocketServer.ConnCloseEvent += WebSocketEvent.ConnCloseEvent;
}
private void Form1_Closed(object sender, EventArgs e)
{
/// 移除事件通知
WebSocketServer.NewConnEvent -= WebSocketEvent.NewConnEvent;
WebSocketServer.RecMsgEvent -= WebSocketEvent.RecMsgEvent;
WebSocketServer.RecTextEvent -= WebSocketEvent.RecTextEvent;
WebSocketServer.ConnCloseEvent -= WebSocketEvent.ConnCloseEvent;
/// 释放对象
if (null != WebSocketServer)
{
WebSocketServer.Close();
WebSocketServer = null;
}
WebSocketServer = null;
}
private void button1_Click(object sender, EventArgs e)
{
string strLastSID = WebSocketEvent.GetLastSID();
if (null == strLastSID || 0 == strLastSID.Length)
{
MessageBox.Show("还未有来自网页的连接!");
return;
}
Send(strLastSID, this.textBox1.Text);
this.textBox1.Text = "";
}
/// <summary>
/// WebSocket服务事件通知
/// </summary>
public class WebSocketEventSink : _ISocketProxyEvents
{
/// <summary>
/// 主窗口
/// </summary>
Form1 m_Form;
string m_strLastSID;
public void SetForm(Form1 Form)
{
m_Form = Form;
}
public string GetLastSID()
{
return m_strLastSID;
}
public void WriteLog(string documentName, string msg)
{
string LogFilePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data");
if (!System.IO.Directory.Exists(LogFilePath))
System.IO.Directory.CreateDirectory(LogFilePath);
string logFile = System.IO.Path.Combine(LogFilePath, documentName + "@" + DateTime.Today.ToString("yyyy-MM-dd") + ".txt");
bool writeBaseInfo = System.IO.File.Exists(logFile);
StreamWriter swLogFile = new StreamWriter(logFile, true, Encoding.Unicode);
swLogFile.WriteLine(DateTime.Now.ToString("HH:mm:ss") + "\t" + msg);
swLogFile.Close();
swLogFile.Dispose();
}
/// <summary>
/// 通知新连接
/// </summary>
/// <param name="bstrSID"></param>
public void NewConnEvent(string bstrSID)
{
m_strLastSID = bstrSID;
m_Form.textBox2.AppendText("收到新连接:");
m_Form.textBox2.AppendText(bstrSID);
m_Form.textBox2.AppendText("\r\n");
}
/// <summary>
/// 通知连接收到JSON数据包
/// </summary>
/// <param name="bstrSID"></param>
/// <param name="nReqID"></param>
/// <param name="bstrReqName"></param>
/// <param name="bstrContent"></param>
public void RecMsgEvent(string bstrSID, uint nReqID, string bstrPushName, string bstrMsg)
{
m_Form.textBox2.AppendText("收到新数据包,请求序号:");
m_Form.textBox2.AppendText(nReqID.ToString());
m_Form.textBox2.AppendText("协议名:");
m_Form.textBox2.AppendText(bstrPushName);
m_Form.textBox2.AppendText("内容:");
m_Form.textBox2.AppendText(bstrMsg);
m_Form.textBox2.AppendText("\r\n");
if (bstrPushName == "Demo_OpenUrl")
{
/// 获得打开URL地址,调用浏览器打开
JsonServiceClass JsonService = new JsonServiceClass();
JsonService.ParseString(bstrMsg);
string strUrl = JsonService.GetStringValue("url");
JsonService = null;
m_Form.OpenUrl(strUrl);
return;
}
/// 回传给网页内容
m_Form.Send(bstrSID,"收到请求" + bstrPushName);
}
/// <summary>
/// 通知连接收到文本内容
/// </summary>
/// <param name="bstrSID"></param>
/// <param name="bstrText"></param>
public void RecTextEvent(string bstrSID, string bstrText)
{
m_Form.textBox2.AppendText("收到文本内容:");
m_Form.textBox2.AppendText(bstrText);
m_Form.textBox2.AppendText("\r\n");
/// 回传给网页内容
m_Form.Send(bstrSID,"收到文本内容" + bstrText);
}
/// <summary>
///
/// </summary>
/// <param name="bstrSID"></param>
/// <param name="Content"></param>
/// <param name="nLen"></param>
public void RecByteEvent(string bstrSID, Object Content, uint nLen)
{
}
/// <summary>
///
/// </summary>
/// <param name="nSessionID"></param>
/// <param name="strUrl"></param>
/// <param name="strPara"></param>
public void HttpReqEvent(uint nSessionID, string strUrl, string strPara)
{
}
/// <summary>
/// 通知关闭连接
/// </summary>
/// <param name="bstrSID"></param>
public void ConnCloseEvent(string bstrSID)
{
}
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
{
"Type": 2,
"OS": 1,
"Control": 0,
"OSMinVer": "5.0",
"Version": "2.0.2.1",
"Name": "弹窗小程序范例(C#语言)",
"Corp": "ZorroSoft",
"Icon": "",
"Date": "2020.08.25",
"Desc": "弹窗小程序范例(C#语言)-演示脚本请求打开指定网站",
"Home": "http://zorrosoft.com/WRL",
"Down": "http://zorrosoft.com/WRL",
"Module": "PluginExeDemo.exe",
"PID": "99225C6D-B7A3-441c-AEFB-3EE23ACA2209",
"Updates": []
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A293EC60-CDAD-4A3A-8BD6-953924479BBC}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PluginExeDemo</RootNamespace>
<AssemblyName>PluginExeDemo</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>bin\Debug\PluginExeDemo.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>bin\Release\PluginExeDemo.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="PluginConfig.json" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<COMReference Include="WrlBase">
<Guid>{A2B9ADBB-78A5-471C-BDBD-F9294BC6C798}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
<COMReference Include="WrlEngine">
<Guid>{FD6C16D6-F0F0-4A64-A104-201AD09C795D}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginExeDemo", "PluginExeDemo.csproj", "{A293EC60-CDAD-4A3A-8BD6-953924479BBC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A293EC60-CDAD-4A3A-8BD6-953924479BBC}.Debug|x86.ActiveCfg = Debug|x86
{A293EC60-CDAD-4A3A-8BD6-953924479BBC}.Debug|x86.Build.0 = Debug|x86
{A293EC60-CDAD-4A3A-8BD6-953924479BBC}.Release|x86.ActiveCfg = Release|x86
{A293EC60-CDAD-4A3A-8BD6-953924479BBC}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {ED83012C-0D95-4661-8381-C87370A29FDD}
EndGlobalSection
EndGlobal
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace PluginExeDemo
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
if (args.Length <= 0)
{
MessageBox.Show("请输入启动参数");
Application.Exit();
return;
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1(args[0]));
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("PluginExeDemo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PluginExeDemo")]
[assembly: AssemblyCopyright("Copyright(C) 2013-? ZorroSoft. All Rights Reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("4823a65a-0ab1-4ee8-8030-24b050a00f79")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 内部版本号
// 修订号
//
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.1.1")]
[assembly: AssemblyFileVersion("2.0.1.1")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace PluginExeDemo.Properties
{
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的、缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PluginExeDemo.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 为所有资源查找重写当前线程的 CurrentUICulture 属性,
/// 方法是使用此强类型资源类。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PluginExeDemo.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
{
"Type": 1,
"OS": 1,
"Control": 0,
"Asm": 1,
"OSMinVer": "5.0",
"Version": "2.0.2.1",
"Name": "无窗口小程序范例(C#语言)",
"Corp": "ZorroSoft",
"Icon": "",
"Date": "2020.08.25",
"Desc": "无窗口小程序范例(C#语言)",
"Home": "http://zorrosoft.com/WRL",
"Down": "http://zorrosoft.com/WRL",
"Module": "PluginNetDll.dll",
"PID": "D10495F4-DF0F-44FA-8647-91275347214A",
"Objects": [
{
"ProgID": "FCADA8A7-D975-42c6-B5D3-FA40F6FE1286",
"ClassID": "5DDA3CFF-6AD1-4836-B378-628B43748626"
}
],
"Updates": []
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{4B48FC7A-94AC-45C1-9361-D12ADF21893A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PluginNetDll</RootNamespace>
<AssemblyName>PluginNetDll</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RegisterForComInterop>false</RegisterForComInterop>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisLogFile>bin\Debug\PluginNetDll.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisLogFile>bin\Release\PluginNetDll.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="TestWrl.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<COMReference Include="WrlBase">
<Guid>{A2B9ADBB-78A5-471C-BDBD-F9294BC6C798}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
<COMReference Include="WrlEngine">
<Guid>{FD6C16D6-F0F0-4A64-A104-201AD09C795D}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<None Include="PluginConfig.json" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginNetDll", "PluginNetDll.csproj", "{4B48FC7A-94AC-45C1-9361-D12ADF21893A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4B48FC7A-94AC-45C1-9361-D12ADF21893A}.Debug|x86.ActiveCfg = Debug|x86
{4B48FC7A-94AC-45C1-9361-D12ADF21893A}.Debug|x86.Build.0 = Debug|x86
{4B48FC7A-94AC-45C1-9361-D12ADF21893A}.Release|x86.ActiveCfg = Release|x86
{4B48FC7A-94AC-45C1-9361-D12ADF21893A}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("PluginNetDll")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WRL")]
[assembly: AssemblyCopyright("ZorroSoft Copyright © 2013-2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(true)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("D10495F4-DF0F-44FA-8647-91275347214A")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 内部版本号
// 修订号
//
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.1.1")]
[assembly: AssemblyFileVersion("2.0.1.1")]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using WrlEngine;
using WrlBase;
[Guid("FCADA8A7-D975-42c6-B5D3-FA40F6FE1286")]
[TypeLibType(4160)]
[ComVisible(true)]
public interface ITestWrl
{
}
namespace PluginNetDll
{
[Guid("5DDA3CFF-6AD1-4836-B378-628B43748626")]
[TypeLibType(4160)]
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof(ITestWrl))]
[ComSourceInterfaces(typeof(ITestWrl))]
public class TestWrl : ITestWrl, IWrlConn
{
/// <summary>
/// Web Socket连接对象
/// </summary>
IWebSocketConnect m_WebSocketConnect;
#region IWrlConn Members
void IWrlConn.Load(object piDispatch, string bstrAuthInfo, string bstrLang)
{
m_WebSocketConnect = piDispatch as IWebSocketConnect;
if (null != m_WebSocketConnect)
WriteLog("PluginNetDll", "成功获得WS接口");
else
WriteLog("PluginNetDll", "获取WS接口失败");
}
void IWrlConn.Unload(EWrlCloseConnType eCloseConnType, string bstrReason)
{
m_WebSocketConnect = null;
WriteLog("PluginNetDll", "请求卸小程序");
}
string IWrlConn.HttpRequst(string bstrUrl, string bstrPara)
{
/// 收到HTTP类型请求,暂未实现
return "";
}
void IWrlConn.RecByte(ref byte pContent, uint nLen)
{
/// 收到二进制数据流,特殊用途
WriteLog("PluginNetDll", "我不是机器人!");
}
/// <summary>
/// 重点处理此函数
/// </summary>
/// <param name="nReqID"></param>
/// <param name="bstrPushName"></param>
/// <param name="bstrContent"></param>
void IWrlConn.RecJson(uint nReqID, string bstrPushName, string bstrContent)
{
/// 创建JSON解析器
JsonServiceClass JsonService = new JsonServiceClass();
bool bRet = JsonService.ParseString(bstrContent);
/// 根据请求名称bstrPushName和请求参数bstrContent分别定义自己的协议进行处理。
string strReturn = "";
if(bstrPushName == "Demo_Return")
{
strReturn = "收到请求 ";
strReturn += bstrPushName;
strReturn += " 内容:";
strReturn += bstrContent;
strReturn += " 序号:";
strReturn += nReqID.ToString();
}
else if(bstrPushName == "Demo_WriteFile")
{
string strName = JsonService.GetStringValue("Name");
string strContent = JsonService.GetStringValue("Content");
string strAppPath = this.GetType().Assembly.Location;
strAppPath.Replace(".exe","");
strAppPath += "\\Data\\";
StreamWriter swFile = new StreamWriter(strAppPath + strName, true, Encoding.Unicode);
swFile.WriteLine(strContent);
swFile.Close();
swFile.Dispose();
strReturn = strAppPath + strName + "写入内容" ;
}
else
strReturn = "收到未知请求:" + bstrPushName;
WriteLog(bstrPushName, strReturn);
/// 给前端回复请求
m_WebSocketConnect.AsynSendText(strReturn);
}
void IWrlConn.RecText(string bstrContent)
{
/// 收到文本请求,一般都是JSON包
m_WebSocketConnect.AsynSendText("你确定没发错?");
}
/// <summary>
/// 框架调用发送通知
/// </summary>
/// <param name="bstrContent"></param>
void IWrlConn.SendJson(string bstrContent)
{
if (null != m_WebSocketConnect)
m_WebSocketConnect.AsynSendText(bstrContent);
}
void IWrlConn.UsbChanged(string bstrDisk, uint nStatus, string bstrName)
{
/// USB存储设备插拔通知
}
#endregion
public void WriteLog(string documentName, string msg)
{
string LogFilePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data");
if (!System.IO.Directory.Exists(LogFilePath))
System.IO.Directory.CreateDirectory(LogFilePath);
string logFile = System.IO.Path.Combine(LogFilePath, documentName + "@" + DateTime.Today.ToString("yyyy-MM-dd") + ".txt");
bool writeBaseInfo = System.IO.File.Exists(logFile);
StreamWriter swLogFile = new StreamWriter(logFile, true, Encoding.Unicode);
swLogFile.WriteLine(DateTime.Now.ToString("HH:mm:ss") + "\t" + msg);
swLogFile.Close();
swLogFile.Dispose();
}
}
}
\ No newline at end of file
#pragma once
#include <exdisp.h> // browser control definitions
#include <exdispid.h> // browser event dispatch IDs
#include <mshtmdid.h>
enum CONTEXT_MENU_MODE // 上下文菜单
{
NoContextMenu, // 无菜单
DefaultMenu, // 默认菜单
TextSelectionOnly, // 仅文本选择菜单
CustomMenu // 自定义菜单
};
class CDocHostUIHandler :
public IDocHostUIHandler,
public IOleCommandTarget
{
protected:
LONG m_cRef;
// Default interface pointers
CComQIPtr<IDocHostUIHandler, &IID_IDocHostUIHandler> m_spDefaultDocHostUIHandler;
CComQIPtr<IOleCommandTarget, &IID_IOleCommandTarget> m_spDefaultOleCommandTarget;
public:
CDocHostUIHandler()
:m_cRef(0)
{
}
void ReleaseCom()
{
m_cRef = 0;
if(NULL != m_spDefaultDocHostUIHandler)
m_spDefaultDocHostUIHandler.Release();
if(NULL != m_spDefaultOleCommandTarget)
m_spDefaultOleCommandTarget.Release();
}
HRESULT STDMETHODCALLTYPE SetHandler(CComPtr<IWebBrowser2> spWebBrowser)
{
HRESULT result = E_NOINTERFACE;
if(NULL == spWebBrowser)
return E_POINTER;
CComPtr<IDispatch> spDisp = NULL;
HRESULT hr = spWebBrowser->get_Document(&spDisp);
if (SUCCEEDED(hr) && spDisp)
{
// If this is not an HTML document (e.g., it's a Word doc or a PDF), don't sink.
CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spHTML(spDisp);
if (spHTML)
{
// Get pointers to default interfaces
CComQIPtr<IOleObject, &IID_IOleObject> spOleObject(spDisp);
if (spOleObject)
{
CComPtr<IOleClientSite> spClientSite = NULL;
hr = spOleObject->GetClientSite(&spClientSite);
if (SUCCEEDED(hr) && spClientSite)
{
m_spDefaultDocHostUIHandler = spClientSite;
m_spDefaultOleCommandTarget = spClientSite;
}
}
// Set this class to be the IDocHostUIHandler
CComQIPtr<ICustomDoc, &IID_ICustomDoc> spCustomDoc(spDisp);
if (spCustomDoc)
{
spCustomDoc->SetUIHandler(this);
result = S_OK;
}
}
}
spDisp = NULL;
return result;
}
/// IDocHostUIHandler
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject)
{
HRESULT result = S_OK;
if (IsBadWritePtr(ppvObject, sizeof(LPVOID)))
result = E_INVALIDARG;
if (result == S_OK)
{
*ppvObject = NULL;
if ( IsEqualIID( riid, IID_IUnknown ) )
*ppvObject = this;
else if ( IsEqualIID( riid, IID_IDispatch ) )
*ppvObject = (IDispatch *) this;
else if ( IsEqualIID( riid, IID_IDocHostUIHandler ) )
*ppvObject = (IDocHostUIHandler *) this;
else if ( IsEqualIID( riid, IID_IOleCommandTarget ) )
*ppvObject = (IOleCommandTarget *) this;
else
result = E_NOINTERFACE;
}
if (result == S_OK)
this->AddRef();
return result;
}
ULONG STDMETHODCALLTYPE AddRef()
{
InterlockedIncrement(&m_cRef);
return m_cRef;
}
ULONG STDMETHODCALLTYPE Release()
{
ULONG ulRefCount = InterlockedDecrement(&m_cRef);
if(m_cRef == 0)
{
delete this;
}
return ulRefCount;
}
STDMETHOD(ShowContextMenu)(DWORD dwID, POINT FAR* ppt, IUnknown FAR* pcmdTarget, IDispatch FAR* pdispReserved)
{
if (m_spDefaultDocHostUIHandler)
return m_spDefaultDocHostUIHandler->ShowContextMenu(dwID, ppt, pcmdTarget, pdispReserved);
return S_FALSE;
}
STDMETHOD(ShowUI)(DWORD dwID, IOleInPlaceActiveObject FAR* pActiveObject,
IOleCommandTarget FAR* pCommandTarget,
IOleInPlaceFrame FAR* pFrame,
IOleInPlaceUIWindow FAR* pDoc)
{
if (m_spDefaultDocHostUIHandler)
return m_spDefaultDocHostUIHandler->ShowUI(dwID, pActiveObject, pCommandTarget, pFrame, pDoc);
return S_FALSE;
}
STDMETHOD(GetHostInfo)(DOCHOSTUIINFO FAR *pInfo)
{
pInfo->cbSize = sizeof(DOCHOSTUIINFO);
pInfo->dwFlags = DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION;
pInfo->dwDoubleClick = DOCHOSTUIDBLCLK_DEFAULT;
pInfo->pchHostCss = 0;
pInfo->pchHostNS = 0;
// if(m_spDefaultDocHostUIHandler)
// return m_spDefaultDocHostUIHandler->GetHostInfo(pInfo);
return S_OK;
}
STDMETHOD(HideUI)(void)
{
if (m_spDefaultDocHostUIHandler)
return m_spDefaultDocHostUIHandler->HideUI();
return S_OK;
}
STDMETHOD(UpdateUI)(void)
{
if (m_spDefaultDocHostUIHandler)
return m_spDefaultDocHostUIHandler->UpdateUI();
return S_OK;
}
STDMETHOD(EnableModeless)(BOOL fEnable)
{
if (m_spDefaultDocHostUIHandler)
return m_spDefaultDocHostUIHandler->EnableModeless(fEnable);
return S_OK;
}
STDMETHOD(OnDocWindowActivate)(BOOL fActivate)
{
if (m_spDefaultDocHostUIHandler)
return m_spDefaultDocHostUIHandler->OnDocWindowActivate(fActivate);
return S_OK;
}
STDMETHOD(OnFrameWindowActivate)(BOOL fActivate)
{
if (m_spDefaultDocHostUIHandler)
return m_spDefaultDocHostUIHandler->OnFrameWindowActivate(fActivate);
return S_OK;
}
STDMETHOD(ResizeBorder)(LPCRECT prcBorder, IOleInPlaceUIWindow FAR* pUIWindow, BOOL fFrameWindow)
{
if (m_spDefaultDocHostUIHandler)
return m_spDefaultDocHostUIHandler->ResizeBorder(prcBorder, pUIWindow, fFrameWindow);
return S_OK;
}
STDMETHOD(TranslateAccelerator)(LPMSG lpMsg, const GUID FAR* pguidCmdGroup, DWORD nCmdID)
{
if (m_spDefaultDocHostUIHandler)
return m_spDefaultDocHostUIHandler->TranslateAccelerator(lpMsg, pguidCmdGroup, nCmdID);
return E_NOTIMPL;
}
STDMETHOD(GetOptionKeyPath)(LPOLESTR FAR* pchKey, DWORD dw)
{
if (m_spDefaultDocHostUIHandler)
return m_spDefaultDocHostUIHandler->GetOptionKeyPath(pchKey, dw);
return E_FAIL;
}
STDMETHOD(GetDropTarget)(IDropTarget* pDropTarget, IDropTarget** ppDropTarget)
{
if (m_spDefaultDocHostUIHandler)
m_spDefaultDocHostUIHandler->GetDropTarget(pDropTarget, ppDropTarget);
return S_OK;
}
STDMETHOD(GetExternal)(IDispatch** ppDispatch)
{
if (m_spDefaultDocHostUIHandler)
return m_spDefaultDocHostUIHandler->GetExternal(ppDispatch);
return S_FALSE;
}
STDMETHOD(TranslateUrl)(DWORD dwTranslate, OLECHAR* pchURLIn, OLECHAR** ppchURLOut)
{
if (m_spDefaultDocHostUIHandler)
return m_spDefaultDocHostUIHandler->TranslateUrl(dwTranslate, pchURLIn, ppchURLOut);
return S_FALSE;
}
STDMETHOD(FilterDataObject)(IDataObject* pDO, IDataObject** ppDORet)
{
if (m_spDefaultDocHostUIHandler)
return m_spDefaultDocHostUIHandler->FilterDataObject(pDO, ppDORet);
return S_FALSE;
}
//
// IOleCommandTarget
//
STDMETHOD(QueryStatus)(
/*[in]*/ const GUID *pguidCmdGroup,
/*[in]*/ ULONG cCmds,
/*[in,out][size_is(cCmds)]*/ OLECMD *prgCmds,
/*[in,out]*/ OLECMDTEXT *pCmdText)
{
if(NULL == m_spDefaultOleCommandTarget)
return E_NOINTERFACE;
return m_spDefaultOleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
}
/// 屏蔽JS脚本错误
STDMETHOD(Exec)(
/*[in]*/ const GUID *pguidCmdGroup,
/*[in]*/ DWORD nCmdID,
/*[in]*/ DWORD nCmdExecOpt,
/*[in]*/ VARIANTARG *pvaIn,
/*[in,out]*/ VARIANTARG *pvaOut)
{
if (nCmdID == OLECMDID_SHOWSCRIPTERROR)
{
// Don't show the error dialog, but
// continue running scripts on the page.
(*pvaOut).vt = VT_BOOL;
(*pvaOut).boolVal = VARIANT_TRUE;
return S_OK;
}
if(NULL == m_spDefaultOleCommandTarget)
return E_NOINTERFACE;
return m_spDefaultOleCommandTarget->Exec(pguidCmdGroup, nCmdID, nCmdExecOpt, pvaIn, pvaOut);
}
};
\ No newline at end of file
{
"PORT": 12800
}
\ No newline at end of file
此差异已折叠。
此差异已折叠。
{
"Type": 2,
"OS": 1,
"Control": 0,
"OSMinVer": "5.0",
"Version": "2.0.2.1",
"Name": "弹窗小程序范例(C++语言)",
"Corp": "ZorroSoft",
"Icon": "",
"Date": "2020.08.25",
"Desc": "弹窗小程序(C++语言)-演示脚本请求打开指定网站",
"Home": "http://zorrosoft.com/WRL",
"Down": "http://zorrosoft.com/WRL",
"Module": "PluginWinExe.exe",
"PID": "F90B1CF0-8485-40ec-B4E8-B87598AAB35D",
"Updates": []
}
\ No newline at end of file
此差异已折叠。
此差异已折叠。

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PluginWinExe", "PluginWinExe.vcxproj", "{BC97A227-EBF0-41F2-93EE-C00E0F7C5C08}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BC97A227-EBF0-41F2-93EE-C00E0F7C5C08}.Debug|Win32.ActiveCfg = Debug|Win32
{BC97A227-EBF0-41F2-93EE-C00E0F7C5C08}.Debug|Win32.Build.0 = Debug|Win32
{BC97A227-EBF0-41F2-93EE-C00E0F7C5C08}.Debug|x64.ActiveCfg = Debug|x64
{BC97A227-EBF0-41F2-93EE-C00E0F7C5C08}.Debug|x64.Build.0 = Debug|x64
{BC97A227-EBF0-41F2-93EE-C00E0F7C5C08}.Release|Win32.ActiveCfg = Release|Win32
{BC97A227-EBF0-41F2-93EE-C00E0F7C5C08}.Release|Win32.Build.0 = Release|Win32
{BC97A227-EBF0-41F2-93EE-C00E0F7C5C08}.Release|x64.ActiveCfg = Release|x64
{BC97A227-EBF0-41F2-93EE-C00E0F7C5C08}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by PluginWinExe.rc
//
#define IDD_ABOUTBOX 100
#define IDR_MAINFRAME 128
#define IDD_MAINDLG 129
#define IDC_EDIT_CONTENT 1000
#define IDC_EDIT_LOG 1001
#define IDC_WEB_BROWSER 1002
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 201
#define _APS_NEXT_COMMAND_VALUE 32775
#define _APS_NEXT_CONTROL_VALUE 1003
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
// stdafx.cpp : source file that includes just the standard includes
// PluginWinExe.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
#if (_ATL_VER < 0x0700)
#include <atlimpl.cpp>
#endif //(_ATL_VER < 0x0700)
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册