| | |
| | | SourceCode/Bond/x64/Release/BEQ.exp |
| | | SourceCode/Bond/x64/Release/Bonder.dat |
| | | SourceCode/Bond/Servo/x64/ |
| | | SourceCode/Bond/BoounionPLC/x64/ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | // BoounionPLC.cpp : å®ä¹åºç¨ç¨åºçç±»è¡ä¸ºã |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BoounionPLC.h" |
| | | #include "BoounionPLCDlg.h" |
| | | |
| | | #ifdef _DEBUG |
| | | #define new DEBUG_NEW |
| | | #endif |
| | | |
| | | |
| | | // CBoounionPLCApp |
| | | |
| | | BEGIN_MESSAGE_MAP(CBoounionPLCApp, CWinApp) |
| | | ON_COMMAND(ID_HELP, &CWinApp::OnHelp) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CBoounionPLCApp æé |
| | | |
| | | CBoounionPLCApp::CBoounionPLCApp() |
| | | { |
| | | // æ¯æéæ°å¯å¨ç®¡çå¨ |
| | | m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART; |
| | | |
| | | // TODO: 卿¤å¤æ·»å æé 代ç ï¼ |
| | | // å°ææéè¦çåå§åæ¾ç½®å¨ InitInstance ä¸ |
| | | } |
| | | |
| | | |
| | | // å¯ä¸çä¸ä¸ª CBoounionPLCApp 对象 |
| | | |
| | | CBoounionPLCApp theApp; |
| | | |
| | | |
| | | // CBoounionPLCApp åå§å |
| | | |
| | | BOOL CBoounionPLCApp::InitInstance() |
| | | { |
| | | // 妿ä¸ä¸ªè¿è¡å¨ Windows XP ä¸çåºç¨ç¨åºæ¸
åæå®è¦ |
| | | // ä½¿ç¨ ComCtl32.dll çæ¬ 6 ææ´é«çæ¬æ¥å¯ç¨å¯è§åæ¹å¼ï¼ |
| | | //åéè¦ InitCommonControlsEx()ã å¦åï¼å°æ æ³å建çªå£ã |
| | | INITCOMMONCONTROLSEX InitCtrls; |
| | | InitCtrls.dwSize = sizeof(InitCtrls); |
| | | // å°å®è®¾ç½®ä¸ºå
æ¬ææè¦å¨åºç¨ç¨åºä¸ä½¿ç¨ç |
| | | // å
Œ
±æ§ä»¶ç±»ã |
| | | InitCtrls.dwICC = ICC_WIN95_CLASSES; |
| | | InitCommonControlsEx(&InitCtrls); |
| | | |
| | | CWinApp::InitInstance(); |
| | | |
| | | |
| | | AfxEnableControlContainer(); |
| | | |
| | | // å建 shell 管çå¨ï¼ä»¥é²å¯¹è¯æ¡å
å« |
| | | // ä»»ä½ shell æ è§å¾æ§ä»¶æ shell å表è§å¾æ§ä»¶ã |
| | | CShellManager *pShellManager = new CShellManager; |
| | | |
| | | // æ¿æ´»âWindows Nativeâè§è§ç®¡çå¨ï¼ä»¥ä¾¿å¨ MFC æ§ä»¶ä¸å¯ç¨ä¸»é¢ |
| | | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); |
| | | |
| | | // æ ååå§å |
| | | // 妿æªä½¿ç¨è¿äºåè½å¹¶å¸æåå° |
| | | // æç»å¯æ§è¡æä»¶ç大å°ï¼ååºç§»é¤ä¸å |
| | | // ä¸éè¦çç¹å®åå§åä¾ç¨ |
| | | // æ´æ¹ç¨äºåå¨è®¾ç½®ç注å表项 |
| | | // TODO: åºéå½ä¿®æ¹è¯¥åç¬¦ä¸²ï¼ |
| | | // ä¾å¦ä¿®æ¹ä¸ºå
¬å¸æç»ç»å |
| | | SetRegistryKey(_T("åºç¨ç¨åºå导çæçæ¬å°åºç¨ç¨åº")); |
| | | |
| | | |
| | | // æ¬ç¨åºæä»¶ç®å½ |
| | | TCHAR sDrive[_MAX_DRIVE]; |
| | | TCHAR sDir[_MAX_DIR]; |
| | | TCHAR sFilename[_MAX_FNAME], sAppFilename[_MAX_FNAME]; |
| | | TCHAR sExt[_MAX_EXT]; |
| | | GetModuleFileName(AfxGetInstanceHandle(), sAppFilename, _MAX_FNAME); |
| | | _tsplitpath_s(sAppFilename, sDrive, sDir, sFilename, sExt); |
| | | m_strAppDir = CString(sDrive) + CString(sDir); |
| | | m_strAppFile = CString(sFilename); |
| | | m_model.setWorkDir((LPTSTR)(LPCTSTR)m_strAppDir); |
| | | |
| | | |
| | | CString strIniFile; |
| | | strIniFile.Format(_T("%s\\BoounionPLCconfiguration.ini"), (LPTSTR)(LPCTSTR)m_strAppDir); |
| | | int plcTimeout = GetPrivateProfileInt("PLC", "Timeout", 700, strIniFile); |
| | | int plcBufSize = GetPrivateProfileInt("PLC", "BufSize", 20, strIniFile); |
| | | int plcPacketSize = GetPrivateProfileInt("PLC", "PacketSize", 80, strIniFile); |
| | | MCL_Initialize(); |
| | | MCL_SetTimeout(plcTimeout); |
| | | MCL_SetMaxActionSize(plcBufSize); |
| | | MCL_SetPacketSize(plcPacketSize); |
| | | RX_Init(); |
| | | |
| | | |
| | | m_hAppMutex = CreateMutexA(NULL, FALSE, _T("BoounionPLC")); |
| | | if (GetLastError() == ERROR_ALREADY_EXISTS) { |
| | | AfxMessageBox(_T("å·²ç»è¿è¡äºä¸ä¸ªå®ä¾ï¼å¯å¨å¤±è´¥!")); |
| | | return FALSE; |
| | | } |
| | | |
| | | |
| | | CBoounionPLCDlg dlg; |
| | | m_pMainWnd = &dlg; |
| | | INT_PTR nResponse = dlg.DoModal(); |
| | | if (nResponse == IDOK) |
| | | { |
| | | // TODO: 卿¤æ¾ç½®å¤ç使¶ç¨ |
| | | // âç¡®å®âæ¥å
³éå¯¹è¯æ¡ç代ç |
| | | } |
| | | else if (nResponse == IDCANCEL) |
| | | { |
| | | // TODO: 卿¤æ¾ç½®å¤ç使¶ç¨ |
| | | // âåæ¶âæ¥å
³éå¯¹è¯æ¡ç代ç |
| | | } |
| | | else if (nResponse == -1) |
| | | { |
| | | TRACE(traceAppMsg, 0, "è¦å: å¯¹è¯æ¡å建失败ï¼åºç¨ç¨åºå°æå¤ç»æ¢ã\n"); |
| | | TRACE(traceAppMsg, 0, "è¦å: 妿æ¨å¨å¯¹è¯æ¡ä¸ä½¿ç¨ MFC æ§ä»¶ï¼åæ æ³ #define _AFX_NO_MFC_CONTROLS_IN_DIALOGSã\n"); |
| | | } |
| | | |
| | | // å é¤ä¸é¢å建ç shell 管çå¨ã |
| | | if (pShellManager != NULL) |
| | | { |
| | | delete pShellManager; |
| | | } |
| | | |
| | | // ç±äºå¯¹è¯æ¡å·²å
³éï¼æä»¥å°è¿å FALSE 以便éåºåºç¨ç¨åºï¼ |
| | | // è䏿¯å¯å¨åºç¨ç¨åºçæ¶æ¯æ³µã |
| | | return FALSE; |
| | | } |
| | | |
| | | int CBoounionPLCApp::ExitInstance() |
| | | { |
| | | m_model.term(); |
| | | RX_Term(); |
| | | MCL_Term(); |
| | | CloseHandle(m_hAppMutex); |
| | | |
| | | return CWinApp::ExitInstance(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | // BoounionPLC.h : PROJECT_NAME åºç¨ç¨åºç主头æä»¶ |
| | | // |
| | | |
| | | #pragma once |
| | | |
| | | #ifndef __AFXWIN_H__ |
| | | #error "å¨å
嫿¤æä»¶ä¹åå
å«âstdafx.hâä»¥çæ PCH æä»¶" |
| | | #endif |
| | | |
| | | #include "resource.h" // ä¸»ç¬¦å· |
| | | #include "Model.h" |
| | | |
| | | |
| | | // CBoounionPLCApp: |
| | | // æå
³æ¤ç±»çå®ç°ï¼è¯·åé
BoounionPLC.cpp |
| | | // |
| | | |
| | | class CBoounionPLCApp : public CWinApp |
| | | { |
| | | public: |
| | | CBoounionPLCApp(); |
| | | |
| | | public: |
| | | CModel m_model; |
| | | HANDLE m_hAppMutex; |
| | | CString m_strAppDir; |
| | | CString m_strAppFile; |
| | | int m_nVersionNumber; |
| | | CString m_strVersionName; |
| | | |
| | | // éå |
| | | public: |
| | | virtual BOOL InitInstance(); |
| | | |
| | | // å®ç° |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | virtual int ExitInstance(); |
| | | }; |
| | | |
| | | extern CBoounionPLCApp theApp; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| | | <ItemGroup Label="ProjectConfigurations"> |
| | | <ProjectConfiguration Include="Debug|Win32"> |
| | | <Configuration>Debug</Configuration> |
| | | <Platform>Win32</Platform> |
| | | </ProjectConfiguration> |
| | | <ProjectConfiguration Include="Release|Win32"> |
| | | <Configuration>Release</Configuration> |
| | | <Platform>Win32</Platform> |
| | | </ProjectConfiguration> |
| | | <ProjectConfiguration Include="Debug|x64"> |
| | | <Configuration>Debug</Configuration> |
| | | <Platform>x64</Platform> |
| | | </ProjectConfiguration> |
| | | <ProjectConfiguration Include="Release|x64"> |
| | | <Configuration>Release</Configuration> |
| | | <Platform>x64</Platform> |
| | | </ProjectConfiguration> |
| | | </ItemGroup> |
| | | <PropertyGroup Label="Globals"> |
| | | <ProjectGuid>{6DC0600E-5588-4033-A281-3626A4F74B67}</ProjectGuid> |
| | | <RootNamespace>BoounionPLC</RootNamespace> |
| | | <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> |
| | | <Keyword>MFCProj</Keyword> |
| | | </PropertyGroup> |
| | | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
| | | <ConfigurationType>Application</ConfigurationType> |
| | | <UseDebugLibraries>true</UseDebugLibraries> |
| | | <PlatformToolset>v140</PlatformToolset> |
| | | <CharacterSet>Unicode</CharacterSet> |
| | | <UseOfMfc>Dynamic</UseOfMfc> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
| | | <ConfigurationType>Application</ConfigurationType> |
| | | <UseDebugLibraries>false</UseDebugLibraries> |
| | | <PlatformToolset>v140</PlatformToolset> |
| | | <WholeProgramOptimization>true</WholeProgramOptimization> |
| | | <CharacterSet>Unicode</CharacterSet> |
| | | <UseOfMfc>Dynamic</UseOfMfc> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
| | | <ConfigurationType>Application</ConfigurationType> |
| | | <UseDebugLibraries>true</UseDebugLibraries> |
| | | <PlatformToolset>v140</PlatformToolset> |
| | | <CharacterSet>MultiByte</CharacterSet> |
| | | <UseOfMfc>Dynamic</UseOfMfc> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
| | | <ConfigurationType>Application</ConfigurationType> |
| | | <UseDebugLibraries>false</UseDebugLibraries> |
| | | <PlatformToolset>v140</PlatformToolset> |
| | | <WholeProgramOptimization>true</WholeProgramOptimization> |
| | | <CharacterSet>Unicode</CharacterSet> |
| | | <UseOfMfc>Dynamic</UseOfMfc> |
| | | </PropertyGroup> |
| | | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
| | | <ImportGroup Label="ExtensionSettings"> |
| | | </ImportGroup> |
| | | <ImportGroup Label="Shared"> |
| | | </ImportGroup> |
| | | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
| | | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
| | | </ImportGroup> |
| | | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
| | | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
| | | </ImportGroup> |
| | | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
| | | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
| | | </ImportGroup> |
| | | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
| | | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
| | | </ImportGroup> |
| | | <PropertyGroup Label="UserMacros" /> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
| | | <LinkIncremental>true</LinkIncremental> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
| | | <LinkIncremental>true</LinkIncremental> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
| | | <LinkIncremental>false</LinkIncremental> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
| | | <LinkIncremental>false</LinkIncremental> |
| | | </PropertyGroup> |
| | | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
| | | <ClCompile> |
| | | <PrecompiledHeader>Use</PrecompiledHeader> |
| | | <WarningLevel>Level3</WarningLevel> |
| | | <Optimization>Disabled</Optimization> |
| | | <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <SDLCheck>true</SDLCheck> |
| | | </ClCompile> |
| | | <Link> |
| | | <SubSystem>Windows</SubSystem> |
| | | <GenerateDebugInformation>true</GenerateDebugInformation> |
| | | </Link> |
| | | <Midl> |
| | | <MkTypLibCompatible>false</MkTypLibCompatible> |
| | | <ValidateAllParameters>true</ValidateAllParameters> |
| | | <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | </Midl> |
| | | <ResourceCompile> |
| | | <Culture>0x0804</Culture> |
| | | <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| | | </ResourceCompile> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
| | | <ClCompile> |
| | | <PrecompiledHeader>Use</PrecompiledHeader> |
| | | <WarningLevel>Level3</WarningLevel> |
| | | <Optimization>Disabled</Optimization> |
| | | <PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <SDLCheck>true</SDLCheck> |
| | | </ClCompile> |
| | | <Link> |
| | | <SubSystem>Windows</SubSystem> |
| | | <GenerateDebugInformation>true</GenerateDebugInformation> |
| | | </Link> |
| | | <Midl> |
| | | <MkTypLibCompatible>false</MkTypLibCompatible> |
| | | <ValidateAllParameters>true</ValidateAllParameters> |
| | | <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | </Midl> |
| | | <ResourceCompile> |
| | | <Culture>0x0804</Culture> |
| | | <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| | | </ResourceCompile> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
| | | <ClCompile> |
| | | <WarningLevel>Level3</WarningLevel> |
| | | <PrecompiledHeader>Use</PrecompiledHeader> |
| | | <Optimization>MaxSpeed</Optimization> |
| | | <FunctionLevelLinking>true</FunctionLevelLinking> |
| | | <IntrinsicFunctions>true</IntrinsicFunctions> |
| | | <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <SDLCheck>true</SDLCheck> |
| | | </ClCompile> |
| | | <Link> |
| | | <SubSystem>Windows</SubSystem> |
| | | <GenerateDebugInformation>true</GenerateDebugInformation> |
| | | <EnableCOMDATFolding>true</EnableCOMDATFolding> |
| | | <OptimizeReferences>true</OptimizeReferences> |
| | | </Link> |
| | | <Midl> |
| | | <MkTypLibCompatible>false</MkTypLibCompatible> |
| | | <ValidateAllParameters>true</ValidateAllParameters> |
| | | <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | </Midl> |
| | | <ResourceCompile> |
| | | <Culture>0x0804</Culture> |
| | | <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| | | </ResourceCompile> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
| | | <ClCompile> |
| | | <WarningLevel>Level3</WarningLevel> |
| | | <PrecompiledHeader>Use</PrecompiledHeader> |
| | | <Optimization>MaxSpeed</Optimization> |
| | | <FunctionLevelLinking>true</FunctionLevelLinking> |
| | | <IntrinsicFunctions>true</IntrinsicFunctions> |
| | | <PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <SDLCheck>true</SDLCheck> |
| | | </ClCompile> |
| | | <Link> |
| | | <SubSystem>Windows</SubSystem> |
| | | <GenerateDebugInformation>true</GenerateDebugInformation> |
| | | <EnableCOMDATFolding>true</EnableCOMDATFolding> |
| | | <OptimizeReferences>true</OptimizeReferences> |
| | | </Link> |
| | | <Midl> |
| | | <MkTypLibCompatible>false</MkTypLibCompatible> |
| | | <ValidateAllParameters>true</ValidateAllParameters> |
| | | <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | </Midl> |
| | | <ResourceCompile> |
| | | <Culture>0x0804</Culture> |
| | | <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| | | </ResourceCompile> |
| | | </ItemDefinitionGroup> |
| | | <ItemGroup> |
| | | <Text Include="ReadMe.txt" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="BoounionPLC.h" /> |
| | | <ClInclude Include="BoounionPLCDlg.h" /> |
| | | <ClInclude Include="Common.h" /> |
| | | <ClInclude Include="Configuration.h" /> |
| | | <ClInclude Include="Log.h" /> |
| | | <ClInclude Include="Model.h" /> |
| | | <ClInclude Include="Resource.h" /> |
| | | <ClInclude Include="stdafx.h" /> |
| | | <ClInclude Include="targetver.h" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClCompile Include="BoounionPLC.cpp" /> |
| | | <ClCompile Include="BoounionPLCDlg.cpp" /> |
| | | <ClCompile Include="Configuration.cpp" /> |
| | | <ClCompile Include="Log.cpp" /> |
| | | <ClCompile Include="Model.cpp" /> |
| | | <ClCompile Include="stdafx.cpp"> |
| | | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> |
| | | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> |
| | | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> |
| | | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> |
| | | </ClCompile> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ResourceCompile Include="BoounionPLC.rc" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <None Include="res\BoounionPLC.rc2" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Image Include="res\BoounionPLC.ico" /> |
| | | </ItemGroup> |
| | | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
| | | <ImportGroup Label="ExtensionTargets"> |
| | | </ImportGroup> |
| | | </Project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| | | <ItemGroup> |
| | | <Filter Include="æºæä»¶"> |
| | | <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> |
| | | <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> |
| | | </Filter> |
| | | <Filter Include="头æä»¶"> |
| | | <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> |
| | | <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> |
| | | </Filter> |
| | | <Filter Include="èµæºæä»¶"> |
| | | <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> |
| | | <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> |
| | | </Filter> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Text Include="ReadMe.txt" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="BoounionPLC.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="BoounionPLCDlg.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="stdafx.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="targetver.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Resource.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Model.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Common.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Configuration.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Log.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClCompile Include="BoounionPLC.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="BoounionPLCDlg.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="stdafx.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Model.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Configuration.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Log.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ResourceCompile Include="BoounionPLC.rc"> |
| | | <Filter>èµæºæä»¶</Filter> |
| | | </ResourceCompile> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <None Include="res\BoounionPLC.rc2"> |
| | | <Filter>èµæºæä»¶</Filter> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Image Include="res\BoounionPLC.ico"> |
| | | <Filter>èµæºæä»¶</Filter> |
| | | </Image> |
| | | </ItemGroup> |
| | | </Project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | // BoounionPLCDlg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BoounionPLC.h" |
| | | #include "BoounionPLCDlg.h" |
| | | #include "afxdialogex.h" |
| | | |
| | | #ifdef _DEBUG |
| | | #define new DEBUG_NEW |
| | | #endif |
| | | |
| | | |
| | | // ç¨äºåºç¨ç¨åºâå
³äºâèå项ç CAboutDlg å¯¹è¯æ¡ |
| | | |
| | | class CAboutDlg : public CDialogEx |
| | | { |
| | | public: |
| | | CAboutDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_ABOUTBOX }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | // å®ç° |
| | | protected: |
| | | DECLARE_MESSAGE_MAP() |
| | | }; |
| | | |
| | | CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX) |
| | | { |
| | | } |
| | | |
| | | void CAboutDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | } |
| | | |
| | | BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CBoounionPLCDlg å¯¹è¯æ¡ |
| | | |
| | | |
| | | |
| | | CBoounionPLCDlg::CBoounionPLCDlg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_BOOUNIONPLC_DIALOG, pParent) |
| | | { |
| | | m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); |
| | | } |
| | | |
| | | void CBoounionPLCDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | } |
| | | |
| | | BEGIN_MESSAGE_MAP(CBoounionPLCDlg, CDialogEx) |
| | | ON_WM_SYSCOMMAND() |
| | | ON_WM_PAINT() |
| | | ON_WM_QUERYDRAGICON() |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CBoounionPLCDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | BOOL CBoounionPLCDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // å°âå
³äº...âèå项添å å°ç³»ç»èåä¸ã |
| | | |
| | | // IDM_ABOUTBOX å¿
é¡»å¨ç³»ç»å½ä»¤èå´å
ã |
| | | ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); |
| | | ASSERT(IDM_ABOUTBOX < 0xF000); |
| | | |
| | | CMenu* pSysMenu = GetSystemMenu(FALSE); |
| | | if (pSysMenu != NULL) |
| | | { |
| | | BOOL bNameValid; |
| | | CString strAboutMenu; |
| | | bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX); |
| | | ASSERT(bNameValid); |
| | | if (!strAboutMenu.IsEmpty()) |
| | | { |
| | | pSysMenu->AppendMenu(MF_SEPARATOR); |
| | | pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); |
| | | } |
| | | } |
| | | |
| | | // 设置æ¤å¯¹è¯æ¡ç徿 ã å½åºç¨ç¨åºä¸»çªå£ä¸æ¯å¯¹è¯æ¡æ¶ï¼æ¡æ¶å°èªå¨ |
| | | // æ§è¡æ¤æä½ |
| | | SetIcon(m_hIcon, TRUE); // è®¾ç½®å¤§å¾æ |
| | | SetIcon(m_hIcon, FALSE); // 设置å°å¾æ |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å代ç |
| | | |
| | | return TRUE; // é¤éå°ç¦ç¹è®¾ç½®å°æ§ä»¶ï¼å¦åè¿å TRUE |
| | | } |
| | | |
| | | void CBoounionPLCDlg::OnSysCommand(UINT nID, LPARAM lParam) |
| | | { |
| | | if ((nID & 0xFFF0) == IDM_ABOUTBOX) |
| | | { |
| | | CAboutDlg dlgAbout; |
| | | dlgAbout.DoModal(); |
| | | } |
| | | else |
| | | { |
| | | CDialogEx::OnSysCommand(nID, lParam); |
| | | } |
| | | } |
| | | |
| | | // 妿åå¯¹è¯æ¡æ·»å æå°åæé®ï¼åéè¦ä¸é¢ç代ç |
| | | // æ¥ç»å¶è¯¥å¾æ ã 对äºä½¿ç¨ææ¡£/è§å¾æ¨¡åç MFC åºç¨ç¨åºï¼ |
| | | // è¿å°ç±æ¡æ¶èªå¨å®æã |
| | | |
| | | void CBoounionPLCDlg::OnPaint() |
| | | { |
| | | if (IsIconic()) |
| | | { |
| | | CPaintDC dc(this); // ç¨äºç»å¶ç设å¤ä¸ä¸æ |
| | | |
| | | SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0); |
| | | |
| | | // ä½¿å¾æ å¨å·¥ä½åºç©å½¢ä¸å±
ä¸ |
| | | int cxIcon = GetSystemMetrics(SM_CXICON); |
| | | int cyIcon = GetSystemMetrics(SM_CYICON); |
| | | CRect rect; |
| | | GetClientRect(&rect); |
| | | int x = (rect.Width() - cxIcon + 1) / 2; |
| | | int y = (rect.Height() - cyIcon + 1) / 2; |
| | | |
| | | // ç»å¶å¾æ |
| | | dc.DrawIcon(x, y, m_hIcon); |
| | | } |
| | | else |
| | | { |
| | | CDialogEx::OnPaint(); |
| | | } |
| | | } |
| | | |
| | | //å½ç¨æ·æå¨æå°åçªå£æ¶ç³»ç»è°ç¨æ¤å½æ°åå¾å
æ |
| | | //æ¾ç¤ºã |
| | | HCURSOR CBoounionPLCDlg::OnQueryDragIcon() |
| | | { |
| | | return static_cast<HCURSOR>(m_hIcon); |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | // BoounionPLCDlg.h : 头æä»¶ |
| | | // |
| | | |
| | | #pragma once |
| | | |
| | | |
| | | // CBoounionPLCDlg å¯¹è¯æ¡ |
| | | class CBoounionPLCDlg : public CDialogEx |
| | | { |
| | | // æé |
| | | public: |
| | | CBoounionPLCDlg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_BOOUNIONPLC_DIALOG }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | |
| | | // å®ç° |
| | | protected: |
| | | HICON m_hIcon; |
| | | |
| | | // çæçæ¶æ¯æ å°å½æ° |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnSysCommand(UINT nID, LPARAM lParam); |
| | | afx_msg void OnPaint(); |
| | | afx_msg HCURSOR OnQueryDragIcon(); |
| | | DECLARE_MESSAGE_MAP() |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | |
| | | /* Rx Code */ |
| | | #define RX_CODE_TEST 0 |
| | | #define RX_CODE_LOG 1000 |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "Configuration.h" |
| | | |
| | | |
| | | CConfiguration::CConfiguration() |
| | | { |
| | | } |
| | | |
| | | CConfiguration::CConfiguration(const char* pszFilepath) |
| | | { |
| | | m_strFilepath = pszFilepath; |
| | | } |
| | | |
| | | CConfiguration::~CConfiguration() |
| | | { |
| | | } |
| | | |
| | | void CConfiguration::setFilepath(const char* pszFilepath) |
| | | { |
| | | m_strFilepath = pszFilepath; |
| | | } |
| | | |
| | | void CConfiguration::getUnitId(CString& strUnitId) |
| | | { |
| | | char szTemp[256]; |
| | | GetPrivateProfileString("App", _T("UnitId"), _T(""), szTemp, 256, m_strFilepath); |
| | | strUnitId = szTemp; |
| | | } |
| | | |
| | | void CConfiguration::getBond1(CString& strIp, UINT& port, UINT& doorCount) |
| | | { |
| | | char szTemp[256]; |
| | | |
| | | // 读IPåç«¯å£ |
| | | GetPrivateProfileString("Bond1", _T("IP"), _T(""), szTemp, 256, m_strFilepath); |
| | | strIp = szTemp; |
| | | port = GetPrivateProfileInt("Bond1", _T("Port"), 0, m_strFilepath); |
| | | doorCount = GetPrivateProfileInt("Bond1", _T("DoorCount"), 0, m_strFilepath); |
| | | } |
| | | |
| | | int CConfiguration::getLogcatLevel() |
| | | { |
| | | return GetPrivateProfileInt(_T("Logcat"), _T("Level"), 0, m_strFilepath); |
| | | } |
| | | |
| | | void CConfiguration::setLogcatLevel(int level) |
| | | { |
| | | WritePrivateProfileString(_T("Logcat"), _T("Level"), |
| | | std::to_string(level).c_str(), m_strFilepath); |
| | | } |
| | | |
| | | int CConfiguration::setLogcatIncludeText(CString& strInclude) |
| | | { |
| | | WritePrivateProfileString(_T("Logcat"), _T("IncludeText"), |
| | | strInclude, m_strFilepath); |
| | | return 0; |
| | | } |
| | | |
| | | int CConfiguration::getLogcatIncludeText(CString& strInclude) |
| | | { |
| | | char szTemp[256]; |
| | | GetPrivateProfileString("Logcat", _T("IncludeText"), _T(""), szTemp, 256, m_strFilepath); |
| | | strInclude = szTemp; |
| | | return 0; |
| | | } |
| | | |
| | | void CConfiguration::setLogcatIncludeRegex(BOOL bRegex) |
| | | { |
| | | WritePrivateProfileString(_T("Logcat"), _T("IncludeRegex"), |
| | | bRegex ? "1" : "0", m_strFilepath); |
| | | } |
| | | |
| | | BOOL CConfiguration::isLogcatIncludeRegex() |
| | | { |
| | | return GetPrivateProfileInt(_T("Logcat"), _T("IncludeRegex"), 0, m_strFilepath); |
| | | } |
| | | |
| | | int CConfiguration::getCustomLogcatIncludeTexts(std::vector<std::string>& texts) |
| | | { |
| | | char szSection[256], szTemp[256]; |
| | | |
| | | for (int i = 0; i < 10; i++) { |
| | | sprintf_s(szSection, 256, "CustomInclude%d", i + 1); |
| | | GetPrivateProfileString("Logcat", szSection, _T(""), |
| | | szTemp, 256, m_strFilepath); |
| | | std::string strInclude(szTemp); |
| | | if (!strInclude.empty()) { |
| | | texts.push_back(strInclude); |
| | | } |
| | | } |
| | | |
| | | return (int)texts.size(); |
| | | } |
| | | |
| | | int CConfiguration::getP2RemoteEqReconnectInterval() |
| | | { |
| | | return GetPrivateProfileInt(_T("P2"), _T("RemoteEqReconnectInterval"), 20, m_strFilepath); |
| | | } |
| | | |
| | | void CConfiguration::setP2RemoteEqReconnectInterval(int second) |
| | | { |
| | | WritePrivateProfileString(_T("P2"), _T("RemoteEqReconnectInterval"), |
| | | std::to_string(second).c_str(), m_strFilepath); |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include <vector> |
| | | #include <string> |
| | | |
| | | class CConfiguration |
| | | { |
| | | public: |
| | | CConfiguration(); |
| | | CConfiguration(const char* pszFilepath); |
| | | ~CConfiguration(); |
| | | |
| | | public: |
| | | void setFilepath(const char* pszFilepath); |
| | | void getUnitId(CString& strUnitId); |
| | | void getBond1(CString& strIp, UINT& port, UINT& doorCount); |
| | | int getLogcatLevel(); |
| | | void setLogcatLevel(int level); |
| | | int setLogcatIncludeText(CString& strInclude); |
| | | int getLogcatIncludeText(CString& strInclude); |
| | | void setLogcatIncludeRegex(BOOL bRegex); |
| | | BOOL isLogcatIncludeRegex(); |
| | | int getCustomLogcatIncludeTexts(std::vector<std::string>& texts); |
| | | |
| | | public: |
| | | void setP2RemoteEqReconnectInterval(int second); |
| | | int getP2RemoteEqReconnectInterval(); |
| | | |
| | | private: |
| | | CString m_strFilepath; |
| | | }; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "Log.h" |
| | | |
| | | |
| | | static const char* pszLevel[] = {" [Debug] ", " [Info] ", " [Warn] ", " [Error] "}; |
| | | |
| | | CLog::CLog() |
| | | { |
| | | m_nLevel = 0; |
| | | m_nOutputTarget = OT_TRACE; |
| | | m_bAutoAppendTime = TRUE; |
| | | m_strEquipmentId = _T("Unknown"); |
| | | m_nDay = 0; |
| | | m_funOnLog = nullptr; |
| | | InitializeCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | | |
| | | CLog::~CLog() |
| | | { |
| | | DeleteCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | | CLog *CLog::GetLog(void) |
| | | { |
| | | static CLog* pLog = NULL; |
| | | if (pLog == NULL) { |
| | | static CLog log; |
| | | pLog = &log; |
| | | } |
| | | |
| | | return pLog; |
| | | } |
| | | |
| | | void CLog::SetOnLogCallback(ONLOG funOnLog) |
| | | { |
| | | m_funOnLog = funOnLog; |
| | | } |
| | | |
| | | void CLog::SetOutputTarget(int flag) |
| | | { |
| | | m_nOutputTarget = flag; |
| | | } |
| | | |
| | | void CLog::SetEquipmentId(const char* pszEquipmentId) |
| | | { |
| | | m_strEquipmentId = pszEquipmentId; |
| | | } |
| | | |
| | | void CLog::SetAutoAppendTimeString(BOOL bAutoAppendTime) |
| | | { |
| | | m_bAutoAppendTime = bAutoAppendTime; |
| | | } |
| | | |
| | | void CLog::Batch() |
| | | { |
| | | if (m_file.m_hFile != CFile::hFileNull) { |
| | | m_file.Close(); |
| | | } |
| | | } |
| | | |
| | | BOOL CLog::BatchAndNew(int& nDay) |
| | | { |
| | | Batch(); |
| | | if ( (m_nOutputTarget & OT_FILE) && m_file.m_hFile == CFile::hFileNull) { |
| | | CString strFilepath; |
| | | BOOL bRet = m_file.Open(MakeFilepathD(strFilepath, nDay), CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite | CFile::shareDenyWrite); |
| | | if (bRet) { |
| | | m_file.SeekToEnd(); |
| | | } |
| | | return bRet; |
| | | } |
| | | |
| | | return FALSE; |
| | | } |
| | | |
| | | #define BUFFERSIZE 1024*10 |
| | | void CLog::LogFormat(int nLevel, const char* pszTag, char* szMessage, ...) |
| | | { |
| | | // æ£æ¥æ¥ææ¯å¦æååï¼æåååç»æ¹ |
| | | Lock(); |
| | | _SYSTEMTIME sysTime; |
| | | GetLocalTime(&sysTime); |
| | | if(m_nDay != sysTime.wDay) { |
| | | int nDay = 0; |
| | | if (BatchAndNew(nDay)) { |
| | | m_nDay = nDay; |
| | | } |
| | | } |
| | | Unlock(); |
| | | |
| | | if (nLevel < m_nLevel) { |
| | | return; |
| | | } |
| | | |
| | | char szFullMessage[BUFFERSIZE]; |
| | | char szFormatMessage[BUFFERSIZE]; |
| | | |
| | | // format message |
| | | va_list ap; |
| | | va_start(ap, szMessage); |
| | | _vsnprintf_s(szFormatMessage, BUFFERSIZE, szMessage, ap); |
| | | va_end(ap); |
| | | |
| | | if (m_bAutoAppendTime) { |
| | | CString strTime; |
| | | strcpy_s(szFullMessage, BUFFERSIZE, (LPTSTR)(LPCTSTR)GetCurTime(strTime)); |
| | | } |
| | | strcat_s(szFullMessage, BUFFERSIZE, pszLevel[nLevel]); |
| | | strcat_s(szFullMessage, szFormatMessage); |
| | | strcat_s(szFullMessage, BUFFERSIZE, "\n"); |
| | | |
| | | if (m_nOutputTarget & OT_FILE) { |
| | | Lock(); |
| | | if (m_file.m_hFile != CFile::hFileNull) { |
| | | m_file.WriteString(szFullMessage); |
| | | } |
| | | Unlock(); |
| | | } |
| | | if (m_nOutputTarget & OT_ODSTRING) { |
| | | OutputDebugStringA(szFullMessage); |
| | | } |
| | | else if(m_nOutputTarget & OT_TRACE) { |
| | | TRACE(szFormatMessage); |
| | | } |
| | | |
| | | if (m_funOnLog != nullptr) { |
| | | m_funOnLog(nLevel, szFullMessage); |
| | | } |
| | | } |
| | | |
| | | void CLog::Log(int nLevel, const char* pszTag, const char* szMessage) |
| | | { |
| | | // æ£æ¥æ¥ææ¯å¦æååï¼æåååç»æ¹ |
| | | Lock(); |
| | | _SYSTEMTIME sysTime; |
| | | GetLocalTime(&sysTime); |
| | | if (m_nDay != sysTime.wDay) { |
| | | int nDay = 0; |
| | | if (BatchAndNew(nDay)) { |
| | | m_nDay = nDay; |
| | | } |
| | | } |
| | | Unlock(); |
| | | |
| | | if (nLevel < m_nLevel) { |
| | | return; |
| | | } |
| | | |
| | | CString strMsg; |
| | | if (m_bAutoAppendTime) { |
| | | CString strTime; |
| | | GetCurTime(strTime); |
| | | strMsg.Append(strTime); |
| | | } |
| | | strMsg.Append(pszTag); |
| | | strMsg.Append(szMessage); |
| | | strMsg.Append("\n"); |
| | | |
| | | if (m_nOutputTarget & OT_FILE) { |
| | | Lock(); |
| | | if (m_file.m_hFile != CFile::hFileNull) { |
| | | m_file.WriteString(strMsg); |
| | | } |
| | | Unlock(); |
| | | } |
| | | if (m_nOutputTarget & OT_ODSTRING) { |
| | | OutputDebugStringA(strMsg); |
| | | } |
| | | else if (m_nOutputTarget & OT_TRACE) { |
| | | TRACE(strMsg); |
| | | } |
| | | |
| | | if (m_funOnLog != nullptr) { |
| | | m_funOnLog(nLevel, strMsg); |
| | | } |
| | | } |
| | | |
| | | CString& CLog::GetCurTime(CString& strTime) |
| | | { |
| | | _SYSTEMTIME sysTime; |
| | | GetLocalTime(&sysTime); |
| | | strTime.Format(_T("%d/%02d/%02d %02d:%02d:%02d.%03d"), sysTime.wYear, sysTime.wMonth, sysTime.wDay, |
| | | sysTime.wHour, sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds); |
| | | return strTime; |
| | | } |
| | | |
| | | CString& CLog::MakeFilepath(CString& strFilepath) |
| | | { |
| | | _SYSTEMTIME sysTime; |
| | | GetLocalTime(&sysTime); |
| | | strFilepath.Format(_T("%s\\Log(%s)_%d_%02d_%02d.log"), (LPTSTR)(LPCTSTR)m_strLogsDir, |
| | | (LPTSTR)(LPCTSTR)m_strEquipmentId, |
| | | sysTime.wYear, sysTime.wMonth, sysTime.wDay); |
| | | |
| | | return strFilepath; |
| | | } |
| | | |
| | | CString& CLog::MakeFilepathD(CString& strFilepath, int& day) |
| | | { |
| | | _SYSTEMTIME sysTime; |
| | | GetLocalTime(&sysTime); |
| | | strFilepath.Format(_T("%s\\Log(%s)_%d_%02d_%02d.log"), (LPTSTR)(LPCTSTR)m_strLogsDir, |
| | | (LPTSTR)(LPCTSTR)m_strEquipmentId, |
| | | sysTime.wYear, sysTime.wMonth, sysTime.wDay); |
| | | day = sysTime.wDay; |
| | | |
| | | return strFilepath; |
| | | } |
| | | |
| | | void CLog::SetLogsDir(CString strDir) |
| | | { |
| | | m_strLogsDir = strDir; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include <functional> |
| | | |
| | | |
| | | #define LEVEL_DEBUG 0 |
| | | #define LEVEL_INFO 1 |
| | | #define LEVEL_WARN 2 |
| | | #define LEVEL_ERROR 3 |
| | | |
| | | |
| | | #define LOGD(msg, ...) CLog::GetLog()->LogFormat(LEVEL_DEBUG, "", msg, __VA_ARGS__) |
| | | #define LOGI(msg, ...) CLog::GetLog()->LogFormat(LEVEL_INFO, "", msg, __VA_ARGS__) |
| | | #define LOGW(msg, ...) CLog::GetLog()->LogFormat(LEVEL_WARN, "", msg, __VA_ARGS__) |
| | | #define LOGE(msg, ...) CLog::GetLog()->LogFormat(LEVEL_ERROR, "", msg, __VA_ARGS__) |
| | | |
| | | |
| | | #define OT_FILE 0x01 |
| | | #define OT_ODSTRING 0x02 |
| | | #define OT_TRACE 0x04 |
| | | #define LOGBATHCH() CLog::GetLog()->Batch() |
| | | #define LOGNEW() CLog::GetLog()->BatchAndNew() |
| | | |
| | | typedef std::function<void(int level, const char* pszMessage)> ONLOG; |
| | | |
| | | class CLog |
| | | { |
| | | public: |
| | | CLog(); |
| | | ~CLog(); |
| | | |
| | | public: |
| | | void SetOnLogCallback(ONLOG funOnLog); |
| | | static CLog *GetLog(void); |
| | | void SetOutputTarget(int flag); |
| | | void SetEquipmentId(const char* pszEquipmentId); |
| | | static CString& GetCurTime(CString& strTime); |
| | | CString& MakeFilepath(CString& strFilepath); |
| | | CString& MakeFilepathD(CString& strFilepath, int& day); |
| | | void LogFormat(int nLevel, const char* pszTag, char* szMessage, ...); |
| | | void Log(int nLevel, const char* pszTag, const char* szMessage); |
| | | void SetAutoAppendTimeString(BOOL bAutoAppendTime); |
| | | void SetLogsDir(CString strDir); |
| | | void Batch(); |
| | | BOOL BatchAndNew(int& nDay); |
| | | |
| | | private: |
| | | inline void Lock() { EnterCriticalSection(&m_criticalSection); } |
| | | inline void Unlock() { LeaveCriticalSection(&m_criticalSection); } |
| | | |
| | | private: |
| | | ONLOG m_funOnLog; |
| | | int m_nOutputTarget; |
| | | int m_nLevel; |
| | | BOOL m_bAutoAppendTime; |
| | | CString m_strLogsDir; |
| | | CString m_strEquipmentId; |
| | | CStdioFile m_file; |
| | | int m_nDay; // ææ¥ä¿å䏿¡è®°å½ï¼æ¯è¾æ¤æ°åï¼ä»¥å³å®æ¯å¦ç»æ¹å¹¶åå»ºæ°æä»¶ |
| | | CRITICAL_SECTION m_criticalSection; |
| | | }; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "Model.h" |
| | | #include "Log.h" |
| | | #include "Common.h" |
| | | |
| | | |
| | | CModel* g_pModel = NULL; |
| | | void CALLBACK ModerTimerProc(HWND hWnd, UINT nMsg, UINT nTimerid, DWORD dwTime) |
| | | { |
| | | if (g_pModel != NULL) { |
| | | g_pModel->onTimer(nTimerid); |
| | | } |
| | | } |
| | | |
| | | |
| | | CModel::CModel() |
| | | { |
| | | m_pObservableEmitter = nullptr; |
| | | m_pObservable = nullptr; |
| | | m_nTimerID = 0; |
| | | } |
| | | |
| | | |
| | | CModel::~CModel() |
| | | { |
| | | } |
| | | |
| | | IObservable* CModel::getObservable() |
| | | { |
| | | return m_pObservable; |
| | | } |
| | | |
| | | void CModel::setWorkDir(const char* pszWorkDir) |
| | | { |
| | | m_strWorkDir = pszWorkDir; |
| | | } |
| | | |
| | | int CModel::init() |
| | | { |
| | | CString strIniFile; |
| | | CString strUnitId; |
| | | strIniFile.Format(_T("%s\\Configuration.ini"), (LPTSTR)(LPCTSTR)m_strWorkDir); |
| | | m_configuration.setFilepath((LPTSTR)(LPCTSTR)strIniFile); |
| | | m_configuration.getUnitId(strUnitId); |
| | | |
| | | |
| | | // Log |
| | | CString strLogDir; |
| | | strLogDir.Format(_T("%s\\BoounionPLCLog"), (LPTSTR)(LPCTSTR)m_strWorkDir); |
| | | ::CreateDirectory(strLogDir, NULL); |
| | | CLog::GetLog()->SetOnLogCallback([&](int level, const char* pszMessage) -> void { |
| | | notifyTextAndInt(RX_CODE_LOG, pszMessage, level); |
| | | }); |
| | | CLog::GetLog()->SetAutoAppendTimeString(TRUE); |
| | | CLog::GetLog()->SetOutputTarget(OT_FILE); |
| | | CLog::GetLog()->SetLogsDir(strLogDir); |
| | | CLog::GetLog()->SetEquipmentId((LPTSTR)(LPCTSTR)strUnitId); |
| | | LOGI("\r\n\r\n~~~ Prog Start! ~~~"); |
| | | |
| | | |
| | | |
| | | m_pObservable = RX_AllocaObservable([&](IObservableEmitter* e) -> void { |
| | | m_pObservableEmitter = e; // ä¿ååå°å¨ |
| | | }); |
| | | |
| | | |
| | | m_nTimerID = (int)SetTimer(NULL, 1, 1000, (TIMERPROC)ModerTimerProc); |
| | | g_pModel = this; |
| | | |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::term() |
| | | { |
| | | CLog::GetLog()->SetOnLogCallback(nullptr); |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notify(int code) |
| | | { |
| | | /* code */ |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int CModel::notifyPtr(int code, void* ptr/* = NULL*/) |
| | | { |
| | | /* code */ |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setPtrValue("ptr", ptr); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int CModel::notifyObj(int code, IRxObject* pObj) |
| | | { |
| | | /* code */ |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setObject("obj", pObj); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int CModel::notifyObjAndPtr(int code, IRxObject* pObj, void* ptr) |
| | | { |
| | | /* code */ |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setObject("obj", pObj); |
| | | pAny->setPtrValue("ptr", ptr); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int CModel::notifyInt(int code, int exCode) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setIntValue("exCode", exCode); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notifyInt2(int code, int exCode, int exCode2) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setIntValue("exCode", exCode); |
| | | pAny->setIntValue("exCode2", exCode2); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notifyDouble(int code, double dValue) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setDoubleValue("value", dValue); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notifyObjAndInt(int code, IRxObject* pObj1, IRxObject* pObj2, int exCode) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | if (pObj1 != nullptr) pAny->setObject("obj", pObj1); |
| | | if (pObj2 != nullptr) pAny->setObject("obj2", pObj2); |
| | | pAny->setIntValue("exCode", exCode); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notifyText(int code, const char* pszText) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setStringValue("text", pszText); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notifyTextAndInt(int code, const char* pszText, int exCode) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setStringValue("text", pszText); |
| | | pAny->setIntValue("exCode", exCode); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notifyPtrAndInt(int code, void* ptr1, void* ptr2, int exCode) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setPtrValue("ptr", ptr1); |
| | | pAny->setPtrValue("ptr1", ptr1); |
| | | pAny->setPtrValue("ptr2", ptr2); |
| | | pAny->setIntValue("exCode", exCode); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notifyMesMsg(int code, int stream, int function, const char* pszText) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setIntValue("stream", stream); |
| | | pAny->setIntValue("function", function); |
| | | pAny->setStringValue("text", pszText); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | void CModel::onTimer(UINT nTimerid) |
| | | { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "Configuration.h" |
| | | |
| | | |
| | | class CModel |
| | | { |
| | | public: |
| | | CModel(); |
| | | ~CModel(); |
| | | |
| | | public: |
| | | IObservable* getObservable(); |
| | | void setWorkDir(const char* pszWorkDir); |
| | | int init(); |
| | | int term(); |
| | | void onTimer(UINT nTimerid); |
| | | |
| | | public: |
| | | int notify(int code); |
| | | int notifyPtr(int code, void* ptr = NULL); |
| | | int notifyObj(int code, IRxObject* pObj); |
| | | int notifyObjAndPtr(int code, IRxObject* pObj, void* ptr); |
| | | int notifyObjAndInt(int code, IRxObject* pObj1, IRxObject* pObj2, int exCode); |
| | | int notifyInt(int code, int exCode); |
| | | int notifyInt2(int code, int exCode, int exCode2); |
| | | int notifyDouble(int code, double dValue); |
| | | int notifyText(int code, const char* pszText); |
| | | int notifyPtrAndInt(int code, void* ptr1, void* ptr2, int exCode); |
| | | int notifyTextAndInt(int code, const char* pszText, int exCode); |
| | | int notifyMesMsg(int code, int stream, int function, const char* pszText); |
| | | |
| | | public: |
| | | CConfiguration m_configuration; |
| | | |
| | | |
| | | private: |
| | | IObservable* m_pObservable; |
| | | IObservableEmitter* m_pObservableEmitter; |
| | | CString m_strWorkDir; |
| | | |
| | | private: |
| | | int m_nTimerID; |
| | | }; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | ================================================================================ |
| | | MICROSOFT åºç¡ç±»åº : BoounionPLC é¡¹ç®æ¦è¿° |
| | | =============================================================================== |
| | | |
| | | åºç¨ç¨åºå导已为æ¨åå»ºäºæ¤ BoounionPLC åºç¨ç¨åºãæ¤åºç¨ç¨åºä¸ä»
æ¼ç¤º Microsoft åºç¡ç±»çåºæ¬ä½¿ç¨æ¹æ³ï¼è¿å¯ä½ä¸ºæ¨ç¼ååºç¨ç¨åºçèµ·ç¹ã |
| | | |
| | | æ¬æä»¶æ¦è¦ä»ç»ç»æ BoounionPLC åºç¨ç¨åºçæ¯ä¸ªæä»¶çå
容ã |
| | | |
| | | BoounionPLC.vcxproj |
| | | è¿æ¯ä½¿ç¨åºç¨ç¨åºå导çæç VC++ 项ç®çä¸»é¡¹ç®æä»¶ï¼å
¶ä¸å
å«çæè¯¥æä»¶ç Visual C++ ççæ¬ä¿¡æ¯ï¼ä»¥åæå
³ä½¿ç¨åºç¨ç¨åºå坼鿩çå¹³å°ãé
ç½®å项ç®åè½çä¿¡æ¯ã |
| | | |
| | | BoounionPLC.vcxproj.filters |
| | | è¿æ¯ä½¿ç¨âåºç¨ç¨åºå导âçæç VC++ 项ç®çé卿件ãå®å
嫿å
³é¡¹ç®æä»¶ä¸çéå¨ä¹é´çå
³èä¿¡æ¯ãå¨ IDE ä¸ï¼éè¿è¿ç§å
³èï¼å¨ç¹å®èç¹ä¸ä»¥åç»å½¢å¼æ¾ç¤ºå
·æç¸ä¼¼æ©å±åçæä»¶ãä¾å¦ï¼â.cppâæä»¶ä¸âæºæä»¶âçéå¨å
³èã |
| | | |
| | | BoounionPLC.h |
| | | è¿æ¯åºç¨ç¨åºç主头æä»¶ã |
| | | å
¶ä¸å
æ¬å
¶ä»é¡¹ç®ç¹å®çæ 头ï¼å
æ¬ Resource.hï¼ï¼å¹¶å£°æ CBoounionPLCApp åºç¨ç¨åºç±»ã |
| | | |
| | | BoounionPLC.cpp |
| | | è¿æ¯å
å«åºç¨ç¨åºç±» CBoounionPLCApp ç主åºç¨ç¨åºæºæä»¶ã |
| | | |
| | | BoounionPLC.rc |
| | | è¿æ¯ç¨åºä½¿ç¨çææ Microsoft Windows èµæºçå表ãå®å
æ¬ RES åç®å½ä¸åå¨ç徿 ãä½å¾åå
æ ãæ¤æä»¶å¯ä»¥ç´æ¥å¨ Microsoft Visual C++ ä¸è¿è¡ç¼è¾ã项ç®èµæºå
å«å¨ 2052 ä¸ã |
| | | |
| | | res\BoounionPLC.ico |
| | | è¿æ¯ç¨ä½åºç¨ç¨åºå¾æ ç徿 æä»¶ãæ¤å¾æ å
æ¬å¨ä¸»èµæºæä»¶ BoounionPLC.rc ä¸ã |
| | | |
| | | res\BoounionPLC.rc2 |
| | | æ¤æä»¶å
å«ä¸å¨ Microsoft Visual C++ ä¸è¿è¡ç¼è¾çèµæºãæ¨åºè¯¥å°ä¸å¯ç±èµæºç¼è¾å¨ç¼è¾çææèµæºæ¾å¨æ¤æä»¶ä¸ã |
| | | |
| | | |
| | | ///////////////////////////////////////////////////////////////////////////// |
| | | |
| | | åºç¨ç¨åºå导å建ä¸ä¸ªå¯¹è¯æ¡ç±»ï¼ |
| | | |
| | | BoounionPLCDlg.hãBoounionPLCDlg.cpp - å¯¹è¯æ¡ |
| | | è¿äºæä»¶å
å« CBoounionPLCDlg ç±»ãæ¤ç±»å®ä¹åºç¨ç¨åºçä¸»å¯¹è¯æ¡çè¡ä¸ºãå¯¹è¯æ¡æ¨¡æ¿å
å«å¨ BoounionPLC.rc ä¸ï¼è¯¥æä»¶å¯ä»¥å¨ Microsoft Visual C++ ä¸ç¼è¾ã |
| | | |
| | | ///////////////////////////////////////////////////////////////////////////// |
| | | |
| | | å
¶ä»åè½ï¼ |
| | | |
| | | ActiveX æ§ä»¶ |
| | | 该åºç¨ç¨åºå
å«å¯¹ä½¿ç¨ ActiveX æ§ä»¶çæ¯æã |
| | | |
| | | ///////////////////////////////////////////////////////////////////////////// |
| | | |
| | | å
¶ä»æ åæä»¶: |
| | | |
| | | StdAfx.h, StdAfx.cpp |
| | | è¿äºæä»¶ç¨äºçæå为 BoounionPLC.pch çé¢ç¼è¯å¤´ (PCH) æä»¶åå为 StdAfx.obj çé¢ç¼è¯ç±»åæä»¶ã |
| | | |
| | | Resource.h |
| | | è¿æ¯æ å头æä»¶ï¼å¯ç¨äºå®ä¹æ°çèµæº IDãMicrosoft Visual C++ å°è¯»åå¹¶æ´æ°æ¤æä»¶ã |
| | | |
| | | BoounionPLC.manifest |
| | | Windows XP 使ç¨åºç¨ç¨åºæ¸
åæä»¶æ¥æè¿°ç¹å®çæ¬çå¹¶è¡ç¨åºéçåºç¨ç¨åºä¾èµé¡¹ãå è½½ç¨åºä½¿ç¨è¿äºä¿¡æ¯æ¥ä»ç¨åºéç¼åä¸å è½½ç¸åºçç¨åºéï¼å¹¶ä¿æ¤å
¶ä¸è¢«åºç¨ç¨åºè®¿é®ãåºç¨ç¨åºæ¸
åå¯è½ä¼å
å«å¨å
ï¼ä»¥ä½ä¸ºä¸åºç¨ç¨åºå¯æ§è¡æä»¶å®è£
å¨å䏿件夹ä¸çå¤é¨ .manifest æä»¶è¿è¡éæ°ååï¼å®è¿å¯è½ä»¥èµæºçå½¢å¼å
å«å¨å¯æ§è¡æä»¶ä¸ã |
| | | ///////////////////////////////////////////////////////////////////////////// |
| | | |
| | | å
¶ä»æ³¨é: |
| | | |
| | | åºç¨ç¨åºå导使ç¨âTODO:âæ¥æç¤ºåºæ·»å æèªå®ä¹çæºä»£ç é¨åã |
| | | |
| | | 妿åºç¨ç¨åºä½¿ç¨å
±äº« DLL ä¸ç MFCï¼æ¨å°éè¦éæ°åå MFC DLLã妿åºç¨ç¨åºæä½¿ç¨çè¯è¨ä¸æä½ç³»ç»çåºå设置ä¸åï¼åè¿éè¦éæ°ååç¸åºçæ¬å°åèµæº mfc110XXX.DLLã |
| | | æå
³ä¸è¿°è¯é¢çæ´å¤ä¿¡æ¯ï¼è¯·åè§ MSDN ææ¡£ä¸æå
³éæ°åå Visual C++ åºç¨ç¨åºçé¨åã |
| | | |
| | | ///////////////////////////////////////////////////////////////////////////// |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | //{{NO_DEPENDENCIES}} |
| | | // Microsoft Visual C++ çæçå
嫿件ã |
| | | // ç± BoounionPLC.rc ä½¿ç¨ |
| | | // |
| | | #define IDR_MAINFRAME 128 |
| | | #define IDM_ABOUTBOX 0x0010 |
| | | #define IDD_ABOUTBOX 100 |
| | | #define IDS_ABOUTBOX 101 |
| | | #define IDD_BOOUNIONPLC_DIALOG 102 |
| | | |
| | | // æ°å¯¹è±¡çä¸ä¸ç»é»è®¤å¼ |
| | | // |
| | | #ifdef APSTUDIO_INVOKED |
| | | #ifndef APSTUDIO_READONLY_SYMBOLS |
| | | |
| | | #define _APS_NEXT_RESOURCE_VALUE 129 |
| | | #define _APS_NEXT_CONTROL_VALUE 1000 |
| | | #define _APS_NEXT_SYMED_VALUE 101 |
| | | #define _APS_NEXT_COMMAND_VALUE 32771 |
| | | #endif |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | // stdafx.cpp : åªå
æ¬æ åå
å«æä»¶çæºæä»¶ |
| | | // BoounionPLC.pch å°ä½ä¸ºé¢ç¼è¯å¤´ |
| | | // stdafx.obj å°å
å«é¢ç¼è¯ç±»åä¿¡æ¯ |
| | | |
| | | #include "stdafx.h" |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | // stdafx.h : æ åç³»ç»å
嫿件çå
å«æä»¶ï¼ |
| | | // ææ¯ç»å¸¸ä½¿ç¨ä½ä¸å¸¸æ´æ¹ç |
| | | // ç¹å®äºé¡¹ç®çå
嫿件 |
| | | |
| | | #pragma once |
| | | |
| | | #ifndef VC_EXTRALEAN |
| | | #define VC_EXTRALEAN // ä» Windows 头䏿餿å°ä½¿ç¨çèµæ |
| | | #endif |
| | | |
| | | #include "targetver.h" |
| | | |
| | | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // æäº CString æé 彿°å°æ¯æ¾å¼ç |
| | | |
| | | // å
³é MFC 对æäºå¸¸è§ä½ç»å¸¸å¯æ¾å¿å¿½ç¥çè¦åæ¶æ¯çéè |
| | | #define _AFX_ALL_WARNINGS |
| | | |
| | | #include <afxwin.h> // MFC æ ¸å¿ç»ä»¶åæ åç»ä»¶ |
| | | #include <afxext.h> // MFC æ©å± |
| | | |
| | | |
| | | #include <afxdisp.h> // MFC èªå¨åç±» |
| | | |
| | | |
| | | |
| | | #ifndef _AFX_NO_OLE_SUPPORT |
| | | #include <afxdtctl.h> // MFC 对 Internet Explorer 4 å
Œ
±æ§ä»¶çæ¯æ |
| | | #endif |
| | | #ifndef _AFX_NO_AFXCMN_SUPPORT |
| | | #include <afxcmn.h> // MFC 对 Windows å
Œ
±æ§ä»¶çæ¯æ |
| | | #endif // _AFX_NO_AFXCMN_SUPPORT |
| | | |
| | | #include <afxcontrolbars.h> // åè½åºåæ§ä»¶æ¡ç MFC æ¯æ |
| | | |
| | | |
| | | |
| | | |
| | | #include "..\RxWindows1.0\include\RxWindowsLib.h" |
| | | #include "..\McLibrarySDK\include\McLib.h" |
| | | |
| | | |
| | | |
| | | |
| | | #ifdef _UNICODE |
| | | #if defined _M_IX86 |
| | | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") |
| | | #elif defined _M_X64 |
| | | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") |
| | | #else |
| | | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") |
| | | #endif |
| | | #endif |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | // å
æ¬ SDKDDKVer.h å°å®ä¹å¯ç¨çæé«çæ¬ç Windows å¹³å°ã |
| | | |
| | | // 妿è¦ä¸ºä»¥åç Windows å¹³å°çæåºç¨ç¨åºï¼è¯·å
æ¬ WinSDKVer.hï¼å¹¶å° |
| | | // å° _WIN32_WINNT å®è®¾ç½®ä¸ºè¦æ¯æçå¹³å°ï¼ç¶ååå
æ¬ SDKDDKVer.hã |
| | | |
| | | #include <SDKDDKVer.h> |
| | |
| | | EndProject |
| | | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Servo", "Servo\Servo.vcxproj", "{66ADACE5-3166-4D1F-B30B-DE5E01FB01A2}" |
| | | EndProject |
| | | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BoounionPLC", "BoounionPLC\BoounionPLC.vcxproj", "{6DC0600E-5588-4033-A281-3626A4F74B67}" |
| | | EndProject |
| | | Global |
| | | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
| | | Debug|x64 = Debug|x64 |
| | |
| | | {66ADACE5-3166-4D1F-B30B-DE5E01FB01A2}.Release|x64.Build.0 = Release|x64 |
| | | {66ADACE5-3166-4D1F-B30B-DE5E01FB01A2}.Release|x86.ActiveCfg = Release|Win32 |
| | | {66ADACE5-3166-4D1F-B30B-DE5E01FB01A2}.Release|x86.Build.0 = Release|Win32 |
| | | {6DC0600E-5588-4033-A281-3626A4F74B67}.Debug|x64.ActiveCfg = Debug|x64 |
| | | {6DC0600E-5588-4033-A281-3626A4F74B67}.Debug|x64.Build.0 = Debug|x64 |
| | | {6DC0600E-5588-4033-A281-3626A4F74B67}.Debug|x86.ActiveCfg = Debug|Win32 |
| | | {6DC0600E-5588-4033-A281-3626A4F74B67}.Debug|x86.Build.0 = Debug|Win32 |
| | | {6DC0600E-5588-4033-A281-3626A4F74B67}.Release|x64.ActiveCfg = Release|x64 |
| | | {6DC0600E-5588-4033-A281-3626A4F74B67}.Release|x64.Build.0 = Release|x64 |
| | | {6DC0600E-5588-4033-A281-3626A4F74B67}.Release|x86.ActiveCfg = Release|Win32 |
| | | {6DC0600E-5588-4033-A281-3626A4F74B67}.Release|x86.Build.0 = Release|Win32 |
| | | EndGlobalSection |
| | | GlobalSection(SolutionProperties) = preSolution |
| | | HideSolutionNode = FALSE |