mirror of
https://github.com/UnknownObject000/NTV03_MessageBoxTimeout.git
synced 2026-08-12 20:32:21 +08:00
Add files via upload
This commit is contained in:
@@ -0,0 +1,28 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "MessageBoxTimeout.h"
|
||||||
|
|
||||||
|
int MessageBoxTimeoutA(IN HWND hWnd, IN LPCSTR lpText, IN LPCSTR lpCaption, IN UINT uType, IN WORD wLanguageId, IN DWORD dwMilliseconds)
|
||||||
|
{
|
||||||
|
MSGBOXAAPI func_MessageBoxTimeoutA = nullptr;
|
||||||
|
HMODULE hUser32 = GetModuleHandle(L"user32.dll");
|
||||||
|
if (!hUser32)
|
||||||
|
return -1;
|
||||||
|
func_MessageBoxTimeoutA = (MSGBOXAAPI)GetProcAddress(hUser32, "MessageBoxTimeoutA");
|
||||||
|
if (func_MessageBoxTimeoutA)
|
||||||
|
return func_MessageBoxTimeoutA(hWnd, lpText, lpCaption, uType, wLanguageId, dwMilliseconds);
|
||||||
|
else
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int MessageBoxTimeoutW(IN HWND hWnd, IN LPCWSTR lpText, IN LPCWSTR lpCaption, IN UINT uType, IN WORD wLanguageId, IN DWORD dwMilliseconds)
|
||||||
|
{
|
||||||
|
MSGBOXWAPI func_MessageBoxTimeoutW = nullptr;
|
||||||
|
HMODULE hUser32 = GetModuleHandle(L"user32.dll");
|
||||||
|
if (!hUser32)
|
||||||
|
return -1;
|
||||||
|
func_MessageBoxTimeoutW = (MSGBOXWAPI)GetProcAddress(hUser32, "MessageBoxTimeoutW");
|
||||||
|
if (func_MessageBoxTimeoutW)
|
||||||
|
return func_MessageBoxTimeoutW(hWnd, lpText, lpCaption, uType, wLanguageId, dwMilliseconds);
|
||||||
|
else
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <Windows.h>
|
||||||
|
|
||||||
|
//函数指针定义
|
||||||
|
typedef int(__stdcall* MSGBOXAAPI)(IN HWND hWnd, IN LPCSTR lpText, IN LPCSTR lpCaption, IN UINT uType, IN WORD wLanguageId, IN DWORD dwMilliseconds);
|
||||||
|
typedef int(__stdcall* MSGBOXWAPI)(IN HWND hWnd, IN LPCWSTR lpText, IN LPCWSTR lpCaption, IN UINT uType, IN WORD wLanguageId, IN DWORD dwMilliseconds);
|
||||||
|
|
||||||
|
|
||||||
|
//ANSI版本函数
|
||||||
|
int MessageBoxTimeoutA(IN HWND hWnd, IN LPCSTR lpText, IN LPCSTR lpCaption, IN UINT uType, IN WORD wLanguageId, IN DWORD dwMilliseconds);
|
||||||
|
//Unicode版本函数
|
||||||
|
int MessageBoxTimeoutW(IN HWND hWnd, IN LPCWSTR lpText, IN LPCWSTR lpCaption, IN UINT uType, IN WORD wLanguageId, IN DWORD dwMilliseconds);
|
||||||
|
|
||||||
|
//Windows针对不同版本的函数进行的宏定义判断
|
||||||
|
#ifdef _UNICODE
|
||||||
|
#define MessageBoxTimeout MessageBoxTimeoutW
|
||||||
|
#else
|
||||||
|
#define MessageBoxTimeout MessageBoxTimeoutA
|
||||||
|
#endif
|
||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,107 @@
|
|||||||
|
|
||||||
|
// NTV_03_MessageBoxTimeout.cpp: 定义应用程序的类行为。
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
#include "framework.h"
|
||||||
|
#include "NTV_03_MessageBoxTimeout.h"
|
||||||
|
#include "NTV_03_MessageBoxTimeoutDlg.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// CNTV03MessageBoxTimeoutApp
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CNTV03MessageBoxTimeoutApp, CWinApp)
|
||||||
|
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
// CNTV03MessageBoxTimeoutApp 构造
|
||||||
|
|
||||||
|
CNTV03MessageBoxTimeoutApp::CNTV03MessageBoxTimeoutApp()
|
||||||
|
{
|
||||||
|
// 支持重新启动管理器
|
||||||
|
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
|
||||||
|
|
||||||
|
// TODO: 在此处添加构造代码,
|
||||||
|
// 将所有重要的初始化放置在 InitInstance 中
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 唯一的 CNTV03MessageBoxTimeoutApp 对象
|
||||||
|
|
||||||
|
CNTV03MessageBoxTimeoutApp theApp;
|
||||||
|
|
||||||
|
|
||||||
|
// CNTV03MessageBoxTimeoutApp 初始化
|
||||||
|
|
||||||
|
BOOL CNTV03MessageBoxTimeoutApp::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("应用程序向导生成的本地应用程序"));
|
||||||
|
|
||||||
|
CNTV03MessageBoxTimeoutDlg 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 != nullptr)
|
||||||
|
{
|
||||||
|
delete pShellManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS)
|
||||||
|
ControlBarCleanUp();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
|
||||||
|
// 而不是启动应用程序的消息泵。
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
// NTV_03_MessageBoxTimeout.h: PROJECT_NAME 应用程序的主头文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __AFXWIN_H__
|
||||||
|
#error "在包含此文件之前包含 'pch.h' 以生成 PCH"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "resource.h" // 主符号
|
||||||
|
|
||||||
|
|
||||||
|
// CNTV03MessageBoxTimeoutApp:
|
||||||
|
// 有关此类的实现,请参阅 NTV_03_MessageBoxTimeout.cpp
|
||||||
|
//
|
||||||
|
|
||||||
|
class CNTV03MessageBoxTimeoutApp : public CWinApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CNTV03MessageBoxTimeoutApp();
|
||||||
|
|
||||||
|
// 重写
|
||||||
|
public:
|
||||||
|
virtual BOOL InitInstance();
|
||||||
|
|
||||||
|
// 实现
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CNTV03MessageBoxTimeoutApp theApp;
|
||||||
@@ -0,0 +1,217 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>17.0</VCProjectVersion>
|
||||||
|
<ProjectGuid>{F6094314-5D4D-41B8-A33D-987A7D92CB4C}</ProjectGuid>
|
||||||
|
<Keyword>MFCProj</Keyword>
|
||||||
|
<RootNamespace>NTV03MessageBoxTimeout</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</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>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</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|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<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|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
</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|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
</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>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<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>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<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>
|
||||||
|
<ClInclude Include="framework.h" />
|
||||||
|
<ClInclude Include="MessageBoxTimeout.h" />
|
||||||
|
<ClInclude Include="NTV_03_MessageBoxTimeout.h" />
|
||||||
|
<ClInclude Include="NTV_03_MessageBoxTimeoutDlg.h" />
|
||||||
|
<ClInclude Include="pch.h" />
|
||||||
|
<ClInclude Include="Resource.h" />
|
||||||
|
<ClInclude Include="targetver.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="MessageBoxTimeout.cpp" />
|
||||||
|
<ClCompile Include="NTV_03_MessageBoxTimeout.cpp" />
|
||||||
|
<ClCompile Include="NTV_03_MessageBoxTimeoutDlg.cpp" />
|
||||||
|
<ClCompile Include="pch.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="NTV03MessageBoxTimeout.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="res\NTV03MessageBoxTimeout.rc2" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="res\NTV_03_MessageBoxTimeout.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
+69
@@ -0,0 +1,69 @@
|
|||||||
|
<?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;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="头文件">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="资源文件">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="NTV_03_MessageBoxTimeout.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="NTV_03_MessageBoxTimeoutDlg.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="framework.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="targetver.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Resource.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="pch.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="MessageBoxTimeout.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="NTV_03_MessageBoxTimeout.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="NTV_03_MessageBoxTimeoutDlg.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="pch.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="MessageBoxTimeout.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="NTV03MessageBoxTimeout.rc">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="res\NTV03MessageBoxTimeout.rc2">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="res\NTV_03_MessageBoxTimeout.ico">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</Image>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<RESOURCE_FILE>NTV03MessageBoxTimeout.rc</RESOURCE_FILE>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,299 @@
|
|||||||
|
|
||||||
|
// NTV_03_MessageBoxTimeoutDlg.cpp: 实现文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
#include "framework.h"
|
||||||
|
#include "NTV_03_MessageBoxTimeout.h"
|
||||||
|
#include "NTV_03_MessageBoxTimeoutDlg.h"
|
||||||
|
#include "afxdialogex.h"
|
||||||
|
#include "MessageBoxTimeout.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define GetControl(Class,ID) ((Class*)(GetDlgItem(ID)))
|
||||||
|
|
||||||
|
// 用于应用程序“关于”菜单项的 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()
|
||||||
|
|
||||||
|
|
||||||
|
// CNTV03MessageBoxTimeoutDlg 对话框
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CNTV03MessageBoxTimeoutDlg::CNTV03MessageBoxTimeoutDlg(CWnd* pParent /*=nullptr*/)
|
||||||
|
: CDialogEx(IDD_NTV_03_MESSAGEBOXTIMEOUT_DIALOG, pParent)
|
||||||
|
{
|
||||||
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNTV03MessageBoxTimeoutDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialogEx::DoDataExchange(pDX);
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CNTV03MessageBoxTimeoutDlg, CDialogEx)
|
||||||
|
ON_WM_SYSCOMMAND()
|
||||||
|
ON_WM_PAINT()
|
||||||
|
ON_WM_QUERYDRAGICON()
|
||||||
|
ON_BN_CLICKED(IDOK, &CNTV03MessageBoxTimeoutDlg::OnBnClickedOk)
|
||||||
|
ON_BN_CLICKED(IDCANCEL, &CNTV03MessageBoxTimeoutDlg::OnBnClickedCancel)
|
||||||
|
ON_WM_CLOSE()
|
||||||
|
ON_BN_CLICKED(IDB_CREATE, &CNTV03MessageBoxTimeoutDlg::OnBnClickedCreate)
|
||||||
|
ON_BN_CLICKED(IDB_EXIT, &CNTV03MessageBoxTimeoutDlg::OnBnClickedExit)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
void CNTV03MessageBoxTimeoutDlg::InitGUI()
|
||||||
|
{
|
||||||
|
GetControl(CComboBox, IDC_ICON_STYLE)->AddString(L"<无>");
|
||||||
|
GetControl(CComboBox, IDC_ICON_STYLE)->AddString(L"红色错号(MB_ICONHAND/MB_ICONERROR/MB_ICONSTOP)");
|
||||||
|
GetControl(CComboBox, IDC_ICON_STYLE)->AddString(L"黄色三角警告(MB_ICONEXCLAMATION/MB_ICONWARNING)");
|
||||||
|
GetControl(CComboBox, IDC_ICON_STYLE)->AddString(L"蓝色圆叹号(MB_ICONASTERISK/MB_ICONINFORMATION)");
|
||||||
|
GetControl(CComboBox, IDC_ICON_STYLE)->AddString(L"蓝色圆问号(MB_ICONQUESTION)");
|
||||||
|
GetControl(CComboBox, IDC_ICON_STYLE)->SetCurSel(0);
|
||||||
|
GetControl(CComboBox, IDC_BUTTON_STYLE)->AddString(L"【确定】(MB_OK)");
|
||||||
|
GetControl(CComboBox, IDC_BUTTON_STYLE)->AddString(L"【确定】【取消】(MB_OKCANCEL)");
|
||||||
|
GetControl(CComboBox, IDC_BUTTON_STYLE)->AddString(L"【是】【否】(MB_YESNO)");
|
||||||
|
GetControl(CComboBox, IDC_BUTTON_STYLE)->AddString(L"【是】【否】【取消】(MB_YESNOCANCEL)");
|
||||||
|
GetControl(CComboBox, IDC_BUTTON_STYLE)->AddString(L"【中止】【重试】【忽略】(MB_ABORTRETRYIGNORE)");
|
||||||
|
GetControl(CComboBox, IDC_BUTTON_STYLE)->AddString(L"【重试】【取消】(MB_RETRYCANCEL)");
|
||||||
|
GetControl(CComboBox, IDC_BUTTON_STYLE)->SetCurSel(0);
|
||||||
|
SetDlgItemText(IDE_LAST_STATUS, L"<无数据>");
|
||||||
|
}
|
||||||
|
|
||||||
|
int CNTV03MessageBoxTimeoutDlg::CreateMessageBox()
|
||||||
|
{
|
||||||
|
CString caption, text;
|
||||||
|
DWORD messagebox_flag = 0;
|
||||||
|
int timeout_value, icon_style, button_style;
|
||||||
|
GetDlgItemText(IDE_CAPTION, caption);
|
||||||
|
GetDlgItemText(IDE_TEXT, text);
|
||||||
|
timeout_value = GetDlgItemInt(IDE_TIMEOUT_VALUE);
|
||||||
|
icon_style = GetControl(CComboBox, IDC_ICON_STYLE)->GetCurSel();
|
||||||
|
button_style = GetControl(CComboBox, IDC_BUTTON_STYLE)->GetCurSel();
|
||||||
|
switch (button_style)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
messagebox_flag = MB_OK;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
messagebox_flag = MB_OKCANCEL;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
messagebox_flag = MB_YESNO;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
messagebox_flag = MB_YESNOCANCEL;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
messagebox_flag = MB_ABORTRETRYIGNORE;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
messagebox_flag = MB_RETRYCANCEL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
messagebox_flag = MB_OK;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (icon_style)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
messagebox_flag |= MB_ICONERROR;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
messagebox_flag |= MB_ICONWARNING;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
messagebox_flag |= MB_ICONINFORMATION;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
messagebox_flag |= MB_ICONQUESTION;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//此处应返回MessageBoxTimeout的返回值
|
||||||
|
return MessageBoxTimeout(NULL, text.GetString(), caption.GetString(), messagebox_flag, 0, timeout_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// CNTV03MessageBoxTimeoutDlg 消息处理程序
|
||||||
|
|
||||||
|
BOOL CNTV03MessageBoxTimeoutDlg::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialogEx::OnInitDialog();
|
||||||
|
|
||||||
|
// 将“关于...”菜单项添加到系统菜单中。
|
||||||
|
|
||||||
|
// IDM_ABOUTBOX 必须在系统命令范围内。
|
||||||
|
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
|
||||||
|
ASSERT(IDM_ABOUTBOX < 0xF000);
|
||||||
|
|
||||||
|
CMenu* pSysMenu = GetSystemMenu(FALSE);
|
||||||
|
if (pSysMenu != nullptr)
|
||||||
|
{
|
||||||
|
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: 在此添加额外的初始化代码
|
||||||
|
|
||||||
|
InitGUI();
|
||||||
|
|
||||||
|
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNTV03MessageBoxTimeoutDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||||||
|
{
|
||||||
|
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
|
||||||
|
{
|
||||||
|
CAboutDlg dlgAbout;
|
||||||
|
dlgAbout.DoModal();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CDialogEx::OnSysCommand(nID, lParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果向对话框添加最小化按钮,则需要下面的代码
|
||||||
|
// 来绘制该图标。 对于使用文档/视图模型的 MFC 应用程序,
|
||||||
|
// 这将由框架自动完成。
|
||||||
|
|
||||||
|
void CNTV03MessageBoxTimeoutDlg::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 CNTV03MessageBoxTimeoutDlg::OnQueryDragIcon()
|
||||||
|
{
|
||||||
|
return static_cast<HCURSOR>(m_hIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CNTV03MessageBoxTimeoutDlg::OnClose()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加消息处理程序代码和/或调用默认值
|
||||||
|
exit(0);
|
||||||
|
CDialogEx::OnClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CNTV03MessageBoxTimeoutDlg::OnBnClickedOk()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
//CDialogEx::OnOK();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CNTV03MessageBoxTimeoutDlg::OnBnClickedCancel()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
//CDialogEx::OnCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CNTV03MessageBoxTimeoutDlg::OnBnClickedCreate()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
int result = CreateMessageBox();
|
||||||
|
CString status_str = L"<无数据>";
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case IDOK:
|
||||||
|
status_str = L"按下了【确定】按钮 (IDOK)";
|
||||||
|
break;
|
||||||
|
case IDCANCEL:
|
||||||
|
status_str = L"按下了【取消】按钮 (IDCANCEL)";
|
||||||
|
break;
|
||||||
|
case IDABORT:
|
||||||
|
status_str = L"按下了【中止】按钮 (IDABORT)";
|
||||||
|
break;
|
||||||
|
case IDRETRY:
|
||||||
|
status_str = L"按下了【重试】按钮 (IDRETRY)";
|
||||||
|
break;
|
||||||
|
case IDIGNORE:
|
||||||
|
status_str = L"按下了【忽略】按钮 (IDIGNORE)";
|
||||||
|
break;
|
||||||
|
case IDYES:
|
||||||
|
status_str = L"按下了【是】按钮 (IDYES)";
|
||||||
|
break;
|
||||||
|
case IDNO:
|
||||||
|
status_str = L"按下了【否】按钮 (IDNO)";
|
||||||
|
break;
|
||||||
|
case IDTIMEOUT:
|
||||||
|
status_str = L"对话框超时退出 (IDTIMEOUT)";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SetDlgItemText(IDE_LAST_STATUS, status_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CNTV03MessageBoxTimeoutDlg::OnBnClickedExit()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
// NTV_03_MessageBoxTimeoutDlg.h: 头文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
// CNTV03MessageBoxTimeoutDlg 对话框
|
||||||
|
class CNTV03MessageBoxTimeoutDlg : public CDialogEx
|
||||||
|
{
|
||||||
|
// 构造
|
||||||
|
public:
|
||||||
|
CNTV03MessageBoxTimeoutDlg(CWnd* pParent = nullptr); // 标准构造函数
|
||||||
|
|
||||||
|
// 对话框数据
|
||||||
|
#ifdef AFX_DESIGN_TIME
|
||||||
|
enum { IDD = IDD_NTV_03_MESSAGEBOXTIMEOUT_DIALOG };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||||
|
|
||||||
|
|
||||||
|
// 实现
|
||||||
|
protected:
|
||||||
|
HICON m_hIcon;
|
||||||
|
|
||||||
|
void InitGUI();
|
||||||
|
|
||||||
|
int CreateMessageBox();
|
||||||
|
|
||||||
|
// 生成的消息映射函数
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
|
||||||
|
afx_msg void OnPaint();
|
||||||
|
afx_msg HCURSOR OnQueryDragIcon();
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
public:
|
||||||
|
afx_msg void OnBnClickedOk();
|
||||||
|
afx_msg void OnBnClickedCancel();
|
||||||
|
afx_msg void OnClose();
|
||||||
|
afx_msg void OnBnClickedCreate();
|
||||||
|
afx_msg void OnBnClickedExit();
|
||||||
|
};
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
#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 支持功能区和控制条
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
// pch.cpp: 与预编译标头对应的源文件
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
// 当使用预编译的头时,需要使用此源文件,编译才能成功。
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
// pch.h: 这是预编译标头文件。
|
||||||
|
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
|
||||||
|
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
|
||||||
|
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
|
||||||
|
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
|
||||||
|
|
||||||
|
#ifndef PCH_H
|
||||||
|
#define PCH_H
|
||||||
|
|
||||||
|
// 添加要在此处预编译的标头
|
||||||
|
#include "framework.h"
|
||||||
|
|
||||||
|
#endif //PCH_H
|
||||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
@@ -0,0 +1,28 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ 生成的包含文件。
|
||||||
|
// 供 NTV03MessageBoxTimeout.rc 使用
|
||||||
|
//
|
||||||
|
#define IDM_ABOUTBOX 0x0010
|
||||||
|
#define IDD_ABOUTBOX 100
|
||||||
|
#define IDS_ABOUTBOX 101
|
||||||
|
#define IDD_NTV_03_MESSAGEBOXTIMEOUT_DIALOG 102
|
||||||
|
#define IDR_MAINFRAME 128
|
||||||
|
#define IDE_CAPTION 1000
|
||||||
|
#define IDE_TEXT 1001
|
||||||
|
#define IDC_ICON_STYLE 1002
|
||||||
|
#define IDE_TIMEOUT_VALUE 1003
|
||||||
|
#define IDC_BUTTON_STYLE 1004
|
||||||
|
#define IDB_CREATE 1005
|
||||||
|
#define IDB_EXIT 1006
|
||||||
|
#define IDE_LAST_STATUS 1007
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 130
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1008
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user