mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Merge pull request #6 from Squirrel/setup-create
Create a Setup.exe project
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -72,6 +72,7 @@ ipch/
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.vcxproj.filters
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
|
||||
28
Squirrel.sln
28
Squirrel.sln
@@ -7,20 +7,48 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Squirrel", "src\Squirrel\Sq
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Squirrel.Tests", "test\Squirrel.Tests.csproj", "{98AEB048-E27D-42F4-9440-505B7F78BAFD}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Setup", "src\Setup\Setup.vcxproj", "{C1D40624-A484-438A-B846-052F321C89D1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|Mixed Platforms = Release|Mixed Platforms
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1436E22A-FE3C-4D68-9A85-9E74DF2E6A92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1436E22A-FE3C-4D68-9A85-9E74DF2E6A92}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1436E22A-FE3C-4D68-9A85-9E74DF2E6A92}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{1436E22A-FE3C-4D68-9A85-9E74DF2E6A92}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{1436E22A-FE3C-4D68-9A85-9E74DF2E6A92}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||
{1436E22A-FE3C-4D68-9A85-9E74DF2E6A92}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1436E22A-FE3C-4D68-9A85-9E74DF2E6A92}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1436E22A-FE3C-4D68-9A85-9E74DF2E6A92}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{1436E22A-FE3C-4D68-9A85-9E74DF2E6A92}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{1436E22A-FE3C-4D68-9A85-9E74DF2E6A92}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||
{98AEB048-E27D-42F4-9440-505B7F78BAFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{98AEB048-E27D-42F4-9440-505B7F78BAFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{98AEB048-E27D-42F4-9440-505B7F78BAFD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{98AEB048-E27D-42F4-9440-505B7F78BAFD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{98AEB048-E27D-42F4-9440-505B7F78BAFD}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||
{98AEB048-E27D-42F4-9440-505B7F78BAFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{98AEB048-E27D-42F4-9440-505B7F78BAFD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{98AEB048-E27D-42F4-9440-505B7F78BAFD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{98AEB048-E27D-42F4-9440-505B7F78BAFD}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{98AEB048-E27D-42F4-9440-505B7F78BAFD}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||
{C1D40624-A484-438A-B846-052F321C89D1}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{C1D40624-A484-438A-B846-052F321C89D1}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{C1D40624-A484-438A-B846-052F321C89D1}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{C1D40624-A484-438A-B846-052F321C89D1}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C1D40624-A484-438A-B846-052F321C89D1}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C1D40624-A484-438A-B846-052F321C89D1}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{C1D40624-A484-438A-B846-052F321C89D1}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{C1D40624-A484-438A-B846-052F321C89D1}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{C1D40624-A484-438A-B846-052F321C89D1}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C1D40624-A484-438A-B846-052F321C89D1}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
3
src/Setup/Setup.h
Normal file
3
src/Setup/Setup.h
Normal file
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#include "resource.h"
|
||||
BIN
src/Setup/Setup.ico
Normal file
BIN
src/Setup/Setup.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
BIN
src/Setup/Setup.rc
Normal file
BIN
src/Setup/Setup.rc
Normal file
Binary file not shown.
111
src/Setup/Setup.vcxproj
Normal file
111
src/Setup/Setup.vcxproj
Normal file
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{C1D40624-A484-438A-B846-052F321C89D1}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>Setup</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<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 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>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(ProjectDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectDir)obj\$(Configuration)\</IntDir>
|
||||
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)/wtl90</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)/wtl90</IncludePath>
|
||||
<OutDir>$(ProjectDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectDir)obj\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="Setup.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="winmain.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Setup.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Setup.ico" />
|
||||
<Image Include="small.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
BIN
src/Setup/resource.h
Normal file
BIN
src/Setup/resource.h
Normal file
Binary file not shown.
BIN
src/Setup/small.ico
Normal file
BIN
src/Setup/small.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
8
src/Setup/stdafx.cpp
Normal file
8
src/Setup/stdafx.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// Setup.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
||||
34
src/Setup/stdafx.h
Normal file
34
src/Setup/stdafx.h
Normal file
@@ -0,0 +1,34 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
// Windows Header Files:
|
||||
#include <windows.h>
|
||||
|
||||
// C RunTime Header Files
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include <atlbase.h>
|
||||
#include <atlapp.h>
|
||||
|
||||
#include <atlwin.h>
|
||||
|
||||
#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_IA64
|
||||
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' 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
|
||||
11
src/Setup/targetver.h
Normal file
11
src/Setup/targetver.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
// Including SDKDDKVer.h defines the highest available Windows platform.
|
||||
|
||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||
|
||||
#include <WinSDKVer.h>
|
||||
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#include <SDKDDKVer.h>
|
||||
18
src/Setup/winmain.cpp
Normal file
18
src/Setup/winmain.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
// Setup.cpp : Defines the entry point for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Setup.h"
|
||||
|
||||
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
||||
_In_opt_ HINSTANCE hPrevInstance,
|
||||
_In_ LPWSTR lpCmdLine,
|
||||
_In_ int nCmdShow)
|
||||
{
|
||||
HRESULT hr = ::CoInitialize(NULL);
|
||||
|
||||
MessageBoxW(NULL, L"This is a test", L"My message is here", MB_OK);
|
||||
|
||||
::CoUninitialize();
|
||||
return 0;
|
||||
}
|
||||
2259
src/Setup/wtl90/atlapp.h
Normal file
2259
src/Setup/wtl90/atlapp.h
Normal file
File diff suppressed because it is too large
Load Diff
2398
src/Setup/wtl90/atlcrack.h
Normal file
2398
src/Setup/wtl90/atlcrack.h
Normal file
File diff suppressed because it is too large
Load Diff
10240
src/Setup/wtl90/atlctrls.h
Normal file
10240
src/Setup/wtl90/atlctrls.h
Normal file
File diff suppressed because it is too large
Load Diff
4194
src/Setup/wtl90/atlctrlw.h
Normal file
4194
src/Setup/wtl90/atlctrlw.h
Normal file
File diff suppressed because it is too large
Load Diff
5096
src/Setup/wtl90/atlctrlx.h
Normal file
5096
src/Setup/wtl90/atlctrlx.h
Normal file
File diff suppressed because it is too large
Load Diff
687
src/Setup/wtl90/atlddx.h
Normal file
687
src/Setup/wtl90/atlddx.h
Normal file
@@ -0,0 +1,687 @@
|
||||
// Windows Template Library - WTL version 9.0
|
||||
// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
|
||||
//
|
||||
// This file is a part of the Windows Template Library.
|
||||
// The use and distribution terms for this software are covered by the
|
||||
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
|
||||
// which can be found in the file CPL.TXT at the root of this distribution.
|
||||
// By using this software in any fashion, you are agreeing to be bound by
|
||||
// the terms of this license. You must not remove this notice, or
|
||||
// any other, from this software.
|
||||
|
||||
#ifndef __ATLDDX_H__
|
||||
#define __ATLDDX_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __ATLAPP_H__
|
||||
#error atlddx.h requires atlapp.h to be included first
|
||||
#endif
|
||||
|
||||
#if defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT)
|
||||
#error Cannot use floating point DDX with _ATL_MIN_CRT defined
|
||||
#endif // defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT)
|
||||
|
||||
#ifdef _ATL_USE_DDX_FLOAT
|
||||
#include <float.h>
|
||||
#endif // _ATL_USE_DDX_FLOAT
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Classes in this file:
|
||||
//
|
||||
// CWinDataExchange<T>
|
||||
|
||||
|
||||
namespace WTL
|
||||
{
|
||||
|
||||
// Constants
|
||||
#define DDX_LOAD FALSE
|
||||
#define DDX_SAVE TRUE
|
||||
|
||||
// DDX map macros
|
||||
#define BEGIN_DDX_MAP(thisClass) \
|
||||
BOOL DoDataExchange(BOOL bSaveAndValidate = FALSE, UINT nCtlID = (UINT)-1) \
|
||||
{ \
|
||||
bSaveAndValidate; \
|
||||
nCtlID;
|
||||
|
||||
#define DDX_TEXT(nID, var) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
{ \
|
||||
if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#define DDX_TEXT_LEN(nID, var, len) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
{ \
|
||||
if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate, TRUE, len)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#define DDX_INT(nID, var) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
{ \
|
||||
if(!DDX_Int(nID, var, TRUE, bSaveAndValidate)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#define DDX_INT_RANGE(nID, var, min, max) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
{ \
|
||||
if(!DDX_Int(nID, var, TRUE, bSaveAndValidate, TRUE, min, max)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#define DDX_UINT(nID, var) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
{ \
|
||||
if(!DDX_Int(nID, var, FALSE, bSaveAndValidate)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#define DDX_UINT_RANGE(nID, var, min, max) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
{ \
|
||||
if(!DDX_Int(nID, var, FALSE, bSaveAndValidate, TRUE, min, max)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#ifdef _ATL_USE_DDX_FLOAT
|
||||
#define DDX_FLOAT(nID, var) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
{ \
|
||||
if(!DDX_Float(nID, var, bSaveAndValidate)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#define DDX_FLOAT_RANGE(nID, var, min, max) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
{ \
|
||||
if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max)) \
|
||||
return FALSE; \
|
||||
}
|
||||
#define DDX_FLOAT_P(nID, var, precision) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
{ \
|
||||
if(!DDX_Float(nID, var, bSaveAndValidate, FALSE, 0, 0, precision)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#define DDX_FLOAT_P_RANGE(nID, var, min, max, precision) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
{ \
|
||||
if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max, precision)) \
|
||||
return FALSE; \
|
||||
}
|
||||
#endif // _ATL_USE_DDX_FLOAT
|
||||
|
||||
#define DDX_CONTROL(nID, obj) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
DDX_Control(nID, obj, bSaveAndValidate);
|
||||
|
||||
#define DDX_CONTROL_HANDLE(nID, obj) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
DDX_Control_Handle(nID, obj, bSaveAndValidate);
|
||||
|
||||
#define DDX_CHECK(nID, var) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
DDX_Check(nID, var, bSaveAndValidate);
|
||||
|
||||
#define DDX_RADIO(nID, var) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
DDX_Radio(nID, var, bSaveAndValidate);
|
||||
|
||||
#define END_DDX_MAP() \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
// DDX support for Tab, Combo, ListBox and ListView selection index
|
||||
// Note: Specialized versions require atlctrls.h to be included first
|
||||
#if (_MSC_VER >= 1300)
|
||||
|
||||
#define DDX_INDEX(CtrlClass, nID, var) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
DDX_Index<CtrlClass>(nID, var, bSaveAndValidate);
|
||||
|
||||
#ifdef __ATLCTRLS_H__
|
||||
#define DDX_TAB_INDEX(nID, var) DDX_INDEX(WTL::CTabCtrl, nID, var)
|
||||
#ifndef WIN32_PLATFORM_WFSP // No COMBOBOX on SmartPhones
|
||||
#define DDX_COMBO_INDEX(nID, var) DDX_INDEX(WTL::CComboBox, nID, var)
|
||||
#endif
|
||||
#define DDX_LISTBOX_INDEX(nID, var) DDX_INDEX(WTL::CListBox, nID, var)
|
||||
#define DDX_LISTVIEW_INDEX(nID, var) DDX_INDEX(WTL::CListViewCtrl, nID, var)
|
||||
#endif // __ATLCTRLS_H__
|
||||
|
||||
#endif // (_MSC_VER >= 1300)
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// CWinDataExchange - provides support for DDX
|
||||
|
||||
template <class T>
|
||||
class CWinDataExchange
|
||||
{
|
||||
public:
|
||||
// Data exchange method - override in your derived class
|
||||
BOOL DoDataExchange(BOOL /*bSaveAndValidate*/ = FALSE, UINT /*nCtlID*/ = (UINT)-1)
|
||||
{
|
||||
// this one should never be called, override it in
|
||||
// your derived class by implementing DDX map
|
||||
ATLASSERT(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Helpers for validation error reporting
|
||||
enum _XDataType
|
||||
{
|
||||
ddxDataNull = 0,
|
||||
ddxDataText = 1,
|
||||
ddxDataInt = 2,
|
||||
ddxDataFloat = 3,
|
||||
ddxDataDouble = 4
|
||||
};
|
||||
|
||||
struct _XTextData
|
||||
{
|
||||
int nLength;
|
||||
int nMaxLength;
|
||||
};
|
||||
|
||||
struct _XIntData
|
||||
{
|
||||
long nVal;
|
||||
long nMin;
|
||||
long nMax;
|
||||
};
|
||||
|
||||
struct _XFloatData
|
||||
{
|
||||
double nVal;
|
||||
double nMin;
|
||||
double nMax;
|
||||
};
|
||||
|
||||
struct _XData
|
||||
{
|
||||
_XDataType nDataType;
|
||||
union
|
||||
{
|
||||
_XTextData textData;
|
||||
_XIntData intData;
|
||||
_XFloatData floatData;
|
||||
};
|
||||
};
|
||||
|
||||
// Text exchange
|
||||
BOOL DDX_Text(UINT nID, LPTSTR lpstrText, int cbSize, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
HWND hWndCtrl = pT->GetDlgItem(nID);
|
||||
int nRetLen = ::GetWindowText(hWndCtrl, lpstrText, cbSize / sizeof(TCHAR));
|
||||
if(nRetLen < ::GetWindowTextLength(hWndCtrl))
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength);
|
||||
bSuccess = pT->SetDlgItemText(nID, lpstrText);
|
||||
}
|
||||
|
||||
if(!bSuccess)
|
||||
{
|
||||
pT->OnDataExchangeError(nID, bSave);
|
||||
}
|
||||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nLength > 0);
|
||||
if(lstrlen(lpstrText) > nLength)
|
||||
{
|
||||
_XData data = { ddxDataText };
|
||||
data.textData.nLength = lstrlen(lpstrText);
|
||||
data.textData.nMaxLength = nLength;
|
||||
pT->OnDataValidateError(nID, bSave, data);
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
BOOL DDX_Text(UINT nID, BSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
bSuccess = pT->GetDlgItemText(nID, bstrText);
|
||||
}
|
||||
else
|
||||
{
|
||||
USES_CONVERSION;
|
||||
LPTSTR lpstrText = OLE2T(bstrText);
|
||||
ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength);
|
||||
bSuccess = pT->SetDlgItemText(nID, lpstrText);
|
||||
}
|
||||
|
||||
if(!bSuccess)
|
||||
{
|
||||
pT->OnDataExchangeError(nID, bSave);
|
||||
}
|
||||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nLength > 0);
|
||||
if((int)::SysStringLen(bstrText) > nLength)
|
||||
{
|
||||
_XData data = { ddxDataText };
|
||||
data.textData.nLength = (int)::SysStringLen(bstrText);
|
||||
data.textData.nMaxLength = nLength;
|
||||
pT->OnDataValidateError(nID, bSave, data);
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
BOOL DDX_Text(UINT nID, ATL::CComBSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
bSuccess = pT->GetDlgItemText(nID, (BSTR&)bstrText);
|
||||
}
|
||||
else
|
||||
{
|
||||
USES_CONVERSION;
|
||||
LPTSTR lpstrText = OLE2T(bstrText);
|
||||
ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength);
|
||||
bSuccess = pT->SetDlgItemText(nID, lpstrText);
|
||||
}
|
||||
|
||||
if(!bSuccess)
|
||||
{
|
||||
pT->OnDataExchangeError(nID, bSave);
|
||||
}
|
||||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nLength > 0);
|
||||
if((int)bstrText.Length() > nLength)
|
||||
{
|
||||
_XData data = { ddxDataText };
|
||||
data.textData.nLength = (int)bstrText.Length();
|
||||
data.textData.nMaxLength = nLength;
|
||||
pT->OnDataValidateError(nID, bSave, data);
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
|
||||
BOOL DDX_Text(UINT nID, _CSTRING_NS::CString& strText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
HWND hWndCtrl = pT->GetDlgItem(nID);
|
||||
int nLen = ::GetWindowTextLength(hWndCtrl);
|
||||
int nRetLen = -1;
|
||||
LPTSTR lpstr = strText.GetBufferSetLength(nLen);
|
||||
if(lpstr != NULL)
|
||||
{
|
||||
nRetLen = ::GetWindowText(hWndCtrl, lpstr, nLen + 1);
|
||||
strText.ReleaseBuffer();
|
||||
}
|
||||
if(nRetLen < nLen)
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bSuccess = pT->SetDlgItemText(nID, strText);
|
||||
}
|
||||
|
||||
if(!bSuccess)
|
||||
{
|
||||
pT->OnDataExchangeError(nID, bSave);
|
||||
}
|
||||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nLength > 0);
|
||||
if(strText.GetLength() > nLength)
|
||||
{
|
||||
_XData data = { ddxDataText };
|
||||
data.textData.nLength = strText.GetLength();
|
||||
data.textData.nMaxLength = nLength;
|
||||
pT->OnDataValidateError(nID, bSave, data);
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
|
||||
|
||||
// Numeric exchange
|
||||
template <class Type>
|
||||
BOOL DDX_Int(UINT nID, Type& nVal, BOOL bSigned, BOOL bSave, BOOL bValidate = FALSE, Type nMin = 0, Type nMax = 0)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
nVal = (Type)pT->GetDlgItemInt(nID, &bSuccess, bSigned);
|
||||
}
|
||||
else
|
||||
{
|
||||
ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax);
|
||||
bSuccess = pT->SetDlgItemInt(nID, nVal, bSigned);
|
||||
}
|
||||
|
||||
if(!bSuccess)
|
||||
{
|
||||
pT->OnDataExchangeError(nID, bSave);
|
||||
}
|
||||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nMin != nMax);
|
||||
if(nVal < nMin || nVal > nMax)
|
||||
{
|
||||
_XData data = { ddxDataInt };
|
||||
data.intData.nVal = (long)nVal;
|
||||
data.intData.nMin = (long)nMin;
|
||||
data.intData.nMax = (long)nMax;
|
||||
pT->OnDataValidateError(nID, bSave, data);
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
// Float exchange
|
||||
#ifdef _ATL_USE_DDX_FLOAT
|
||||
static BOOL _AtlSimpleFloatParse(LPCTSTR lpszText, double& d)
|
||||
{
|
||||
ATLASSERT(lpszText != NULL);
|
||||
while (*lpszText == _T(' ') || *lpszText == _T('\t'))
|
||||
lpszText++;
|
||||
|
||||
TCHAR chFirst = lpszText[0];
|
||||
d = _tcstod(lpszText, (LPTSTR*)&lpszText);
|
||||
if (d == 0.0 && chFirst != _T('0'))
|
||||
return FALSE; // could not convert
|
||||
while (*lpszText == _T(' ') || *lpszText == _T('\t'))
|
||||
lpszText++;
|
||||
|
||||
if (*lpszText != _T('\0'))
|
||||
return FALSE; // not terminated properly
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL DDX_Float(UINT nID, float& nVal, BOOL bSave, BOOL bValidate = FALSE, float nMin = 0.F, float nMax = 0.F, int nPrecision = FLT_DIG)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
const int cchBuff = 32;
|
||||
TCHAR szBuff[cchBuff] = { 0 };
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
pT->GetDlgItemText(nID, szBuff, cchBuff);
|
||||
double d = 0;
|
||||
if(_AtlSimpleFloatParse(szBuff, d))
|
||||
nVal = (float)d;
|
||||
else
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax);
|
||||
SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal);
|
||||
bSuccess = pT->SetDlgItemText(nID, szBuff);
|
||||
}
|
||||
|
||||
if(!bSuccess)
|
||||
{
|
||||
pT->OnDataExchangeError(nID, bSave);
|
||||
}
|
||||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nMin != nMax);
|
||||
if(nVal < nMin || nVal > nMax)
|
||||
{
|
||||
_XData data = { ddxDataFloat };
|
||||
data.floatData.nVal = (double)nVal;
|
||||
data.floatData.nMin = (double)nMin;
|
||||
data.floatData.nMax = (double)nMax;
|
||||
pT->OnDataValidateError(nID, bSave, data);
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
BOOL DDX_Float(UINT nID, double& nVal, BOOL bSave, BOOL bValidate = FALSE, double nMin = 0., double nMax = 0., int nPrecision = DBL_DIG)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
const int cchBuff = 32;
|
||||
TCHAR szBuff[cchBuff] = { 0 };
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
pT->GetDlgItemText(nID, szBuff, cchBuff);
|
||||
double d = 0;
|
||||
if(_AtlSimpleFloatParse(szBuff, d))
|
||||
nVal = d;
|
||||
else
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax);
|
||||
SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal);
|
||||
bSuccess = pT->SetDlgItemText(nID, szBuff);
|
||||
}
|
||||
|
||||
if(!bSuccess)
|
||||
{
|
||||
pT->OnDataExchangeError(nID, bSave);
|
||||
}
|
||||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nMin != nMax);
|
||||
if(nVal < nMin || nVal > nMax)
|
||||
{
|
||||
_XData data = { ddxDataFloat };
|
||||
data.floatData.nVal = nVal;
|
||||
data.floatData.nMin = nMin;
|
||||
data.floatData.nMax = nMax;
|
||||
pT->OnDataValidateError(nID, bSave, data);
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
#endif // _ATL_USE_DDX_FLOAT
|
||||
|
||||
// Full control subclassing (for CWindowImpl derived controls)
|
||||
template <class TControl>
|
||||
void DDX_Control(UINT nID, TControl& ctrl, BOOL bSave)
|
||||
{
|
||||
if(!bSave && ctrl.m_hWnd == NULL)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
ctrl.SubclassWindow(pT->GetDlgItem(nID));
|
||||
}
|
||||
}
|
||||
|
||||
// Simple control attaching (for HWND wrapper controls)
|
||||
template <class TControl>
|
||||
void DDX_Control_Handle(UINT nID, TControl& ctrl, BOOL bSave)
|
||||
{
|
||||
if(!bSave && ctrl.m_hWnd == NULL)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
ctrl = pT->GetDlgItem(nID);
|
||||
}
|
||||
}
|
||||
|
||||
// Control state
|
||||
void DDX_Check(UINT nID, int& nValue, BOOL bSave)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
HWND hWndCtrl = pT->GetDlgItem(nID);
|
||||
if(bSave)
|
||||
{
|
||||
nValue = (int)::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L);
|
||||
ATLASSERT(nValue >= 0 && nValue <= 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(nValue < 0 || nValue > 2)
|
||||
{
|
||||
ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - dialog data checkbox value (%d) out of range.\n"), nValue);
|
||||
nValue = 0; // default to off
|
||||
}
|
||||
::SendMessage(hWndCtrl, BM_SETCHECK, nValue, 0L);
|
||||
}
|
||||
}
|
||||
|
||||
// variant that supports bool (checked/not-checked, no intermediate state)
|
||||
void DDX_Check(UINT nID, bool& bCheck, BOOL bSave)
|
||||
{
|
||||
int nValue = bCheck ? 1 : 0;
|
||||
DDX_Check(nID, nValue, bSave);
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
if(nValue == 2)
|
||||
ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - checkbox state (%d) out of supported range.\n"), nValue);
|
||||
bCheck = (nValue == 1);
|
||||
}
|
||||
}
|
||||
|
||||
void DDX_Radio(UINT nID, int& nValue, BOOL bSave)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
HWND hWndCtrl = pT->GetDlgItem(nID);
|
||||
ATLASSERT(hWndCtrl != NULL);
|
||||
|
||||
// must be first in a group of auto radio buttons
|
||||
ATLASSERT(::GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP);
|
||||
ATLASSERT(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON);
|
||||
|
||||
if(bSave)
|
||||
nValue = -1; // value if none found
|
||||
|
||||
// walk all children in group
|
||||
int nButton = 0;
|
||||
do
|
||||
{
|
||||
if(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON)
|
||||
{
|
||||
// control in group is a radio button
|
||||
if(bSave)
|
||||
{
|
||||
if(::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L) != 0)
|
||||
{
|
||||
ATLASSERT(nValue == -1); // only set once
|
||||
nValue = nButton;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// select button
|
||||
::SendMessage(hWndCtrl, BM_SETCHECK, (nButton == nValue), 0L);
|
||||
}
|
||||
nButton++;
|
||||
}
|
||||
else
|
||||
{
|
||||
ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - skipping non-radio button in group.\n"));
|
||||
}
|
||||
hWndCtrl = ::GetWindow(hWndCtrl, GW_HWNDNEXT);
|
||||
}
|
||||
while (hWndCtrl != NULL && !(GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP));
|
||||
}
|
||||
|
||||
// DDX support for Tab, Combo, ListBox and ListView selection index
|
||||
#if (_MSC_VER >= 1300)
|
||||
template <class TCtrl>
|
||||
INT _getSel(TCtrl& tCtrl)
|
||||
{
|
||||
return tCtrl.GetCurSel();
|
||||
}
|
||||
|
||||
template <class TCtrl>
|
||||
void _setSel(TCtrl& tCtrl, INT iSel)
|
||||
{
|
||||
if(iSel < 0)
|
||||
tCtrl.SetCurSel(-1);
|
||||
else
|
||||
tCtrl.SetCurSel(iSel);
|
||||
}
|
||||
|
||||
#ifdef __ATLCTRLS_H__
|
||||
// ListViewCtrl specialization
|
||||
template <>
|
||||
INT _getSel(WTL::CListViewCtrl& tCtrl)
|
||||
{
|
||||
return tCtrl.GetSelectedIndex();
|
||||
}
|
||||
|
||||
template <>
|
||||
void _setSel(WTL::CListViewCtrl& tCtrl, INT iSel)
|
||||
{
|
||||
if(iSel < 0)
|
||||
tCtrl.SelectItem(-1);
|
||||
else
|
||||
tCtrl.SelectItem(iSel);
|
||||
}
|
||||
#endif // __ATLCTRLS_H__
|
||||
|
||||
template <class TCtrl>
|
||||
void DDX_Index(UINT nID, INT& nVal, BOOL bSave)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
TCtrl ctrl(pT->GetDlgItem(nID));
|
||||
|
||||
if(bSave)
|
||||
nVal = _getSel(ctrl);
|
||||
else
|
||||
_setSel(ctrl, nVal);
|
||||
}
|
||||
#endif // (_MSC_VER >= 1300)
|
||||
|
||||
// Overrideables
|
||||
void OnDataExchangeError(UINT nCtrlID, BOOL /*bSave*/)
|
||||
{
|
||||
// Override to display an error message
|
||||
::MessageBeep((UINT)-1);
|
||||
T* pT = static_cast<T*>(this);
|
||||
::SetFocus(pT->GetDlgItem(nCtrlID));
|
||||
}
|
||||
|
||||
void OnDataValidateError(UINT nCtrlID, BOOL /*bSave*/, _XData& /*data*/)
|
||||
{
|
||||
// Override to display an error message
|
||||
::MessageBeep((UINT)-1);
|
||||
T* pT = static_cast<T*>(this);
|
||||
::SetFocus(pT->GetDlgItem(nCtrlID));
|
||||
}
|
||||
};
|
||||
|
||||
}; // namespace WTL
|
||||
|
||||
#endif // __ATLDDX_H__
|
||||
6510
src/Setup/wtl90/atldlgs.h
Normal file
6510
src/Setup/wtl90/atldlgs.h
Normal file
File diff suppressed because it is too large
Load Diff
508
src/Setup/wtl90/atldwm.h
Normal file
508
src/Setup/wtl90/atldwm.h
Normal file
@@ -0,0 +1,508 @@
|
||||
// Windows Template Library - WTL version 9.0
|
||||
// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
|
||||
//
|
||||
// This file is a part of the Windows Template Library.
|
||||
// The use and distribution terms for this software are covered by the
|
||||
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
|
||||
// which can be found in the file CPL.TXT at the root of this distribution.
|
||||
// By using this software in any fashion, you are agreeing to be bound by
|
||||
// the terms of this license. You must not remove this notice, or
|
||||
// any other, from this software.
|
||||
|
||||
#ifndef __ATLDWM_H__
|
||||
#define __ATLDWM_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#error atldwm.h is not supported on Windows CE
|
||||
#endif
|
||||
|
||||
#ifndef __ATLAPP_H__
|
||||
#error atldwm.h requires atlapp.h to be included first
|
||||
#endif
|
||||
|
||||
#ifndef __ATLWIN_H__
|
||||
#error atldwm.h requires atlwin.h to be included first
|
||||
#endif
|
||||
|
||||
#if (_WIN32_WINNT < 0x0600)
|
||||
#error atldwm.h requires _WIN32_WINNT >= 0x0600
|
||||
#endif
|
||||
|
||||
#ifndef _DWMAPI_H_
|
||||
#include <dwmapi.h>
|
||||
#endif
|
||||
#pragma comment(lib, "dwmapi.lib")
|
||||
|
||||
// Note: To create an application that also runs on older versions of Windows,
|
||||
// use delay load of dwmapi.dll and ensure that no calls to the DWM API are
|
||||
// Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib,
|
||||
// and add dwmapi.dll in the Linker.Input.Delay Loaded DLLs section of the
|
||||
// project properties.
|
||||
#if (_MSC_VER < 1300) && !defined(_WTL_NO_DWMAPI_DELAYLOAD)
|
||||
#pragma comment(lib, "delayimp.lib")
|
||||
#pragma comment(linker, "/delayload:dwmapi.dll")
|
||||
#endif // (_MSC_VER < 1300) && !defined(_WTL_NO_DWMAPI_DELAYLOAD)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Classes in this file:
|
||||
//
|
||||
// CDwm
|
||||
// CDwmImpl<T, TBase>
|
||||
// CDwmWindowT<TBase> - CDwmWindow
|
||||
// CDwmThumbnailT<t_bManaged, TBase>
|
||||
// CDwmThumbnail
|
||||
// CDwmThumbnailHandle
|
||||
// CAeroControlImpl
|
||||
|
||||
|
||||
namespace WTL
|
||||
{
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// CDwm - wrapper for DWM handle
|
||||
|
||||
class CDwm
|
||||
{
|
||||
public:
|
||||
// Data members
|
||||
static int m_nIsDwmSupported;
|
||||
|
||||
// Constructor
|
||||
CDwm()
|
||||
{
|
||||
IsDwmSupported();
|
||||
}
|
||||
|
||||
// Dwm support helper
|
||||
static bool IsDwmSupported()
|
||||
{
|
||||
if(m_nIsDwmSupported == -1)
|
||||
{
|
||||
CStaticDataInitCriticalSectionLock lock;
|
||||
if(FAILED(lock.Lock()))
|
||||
{
|
||||
ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CDwm::IsDwmSupported.\n"));
|
||||
ATLASSERT(FALSE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(m_nIsDwmSupported == -1)
|
||||
{
|
||||
HMODULE hDwmDLL = ::LoadLibrary(_T("dwmapi.dll"));
|
||||
m_nIsDwmSupported = (hDwmDLL != NULL) ? 1 : 0;
|
||||
if(hDwmDLL != NULL)
|
||||
::FreeLibrary(hDwmDLL);
|
||||
}
|
||||
|
||||
lock.Unlock();
|
||||
}
|
||||
|
||||
ATLASSERT(m_nIsDwmSupported != -1);
|
||||
return (m_nIsDwmSupported == 1);
|
||||
}
|
||||
|
||||
// Operations
|
||||
BOOL DwmIsCompositionEnabled() const
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return FALSE;
|
||||
|
||||
BOOL bRes = FALSE;
|
||||
return (SUCCEEDED(::DwmIsCompositionEnabled(&bRes)) && bRes) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
BOOL DwmEnableComposition(UINT fEnable)
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return FALSE;
|
||||
|
||||
return SUCCEEDED(::DwmEnableComposition(fEnable)) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
BOOL DwmEnableMMCSS(BOOL fEnableMMCSS)
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return FALSE;
|
||||
|
||||
return SUCCEEDED(::DwmEnableMMCSS(fEnableMMCSS)) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
HRESULT DwmGetColorizationColor(DWORD* pcrColorization, BOOL* pfOpaqueBlend)
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
return ::DwmGetColorizationColor(pcrColorization, pfOpaqueBlend);
|
||||
}
|
||||
|
||||
HRESULT DwmFlush()
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
return ::DwmFlush();
|
||||
}
|
||||
};
|
||||
|
||||
__declspec(selectany) int CDwm::m_nIsDwmSupported = -1;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// CDwmImpl - DWM window support
|
||||
|
||||
template <class T, class TBase = CDwm>
|
||||
class CDwmImpl : public TBase
|
||||
{
|
||||
public:
|
||||
HRESULT DwmEnableBlurBehindWindow(const DWM_BLURBEHIND* pBB)
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmEnableBlurBehindWindow(pT->m_hWnd, pBB);
|
||||
}
|
||||
|
||||
HRESULT DwmExtendFrameIntoClientArea(const MARGINS* pMargins)
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmExtendFrameIntoClientArea(pT->m_hWnd, pMargins);
|
||||
}
|
||||
|
||||
HRESULT DwmExtendFrameIntoEntireClientArea()
|
||||
{
|
||||
MARGINS margins = { -1 };
|
||||
return DwmExtendFrameIntoClientArea(&margins);
|
||||
}
|
||||
|
||||
HRESULT DwmGetCompositionTimingInfo(DWM_TIMING_INFO* pTimingInfo)
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmGetCompositionTimingInfo(pT->m_hWnd, pTimingInfo);
|
||||
}
|
||||
|
||||
HRESULT DwmGetWindowAttribute(DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute)
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmGetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute);
|
||||
}
|
||||
|
||||
HRESULT DwmModifyPreviousDxFrameDuration(INT cRefreshes, BOOL fRelative)
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmModifyPreviousDxFrameDuration(pT->m_hWnd, cRefreshes, fRelative);
|
||||
}
|
||||
|
||||
HRESULT DwmSetDxFrameDuration(INT cRefreshes)
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmSetDxFrameDuration(pT->m_hWnd, cRefreshes);
|
||||
}
|
||||
|
||||
HRESULT DwmSetPresentParameters(DWM_PRESENT_PARAMETERS* pPresentParams)
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmSetPresentParameters(pT->m_hWnd, pPresentParams);
|
||||
}
|
||||
|
||||
HRESULT DwmSetWindowAttribute(DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute)
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmSetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute);
|
||||
}
|
||||
|
||||
HRESULT DwmAttachMilContent()
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmAttachMilContent(pT->m_hWnd);
|
||||
}
|
||||
|
||||
HRESULT DwmDetachMilContent()
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmDetachMilContent(pT->m_hWnd);
|
||||
}
|
||||
};
|
||||
|
||||
template <class TBase>
|
||||
class CDwmWindowT : public TBase, public CDwmImpl<CDwmWindowT< TBase > >
|
||||
{
|
||||
public:
|
||||
CDwmWindowT(HWND hWnd = NULL) : TBase(hWnd)
|
||||
{ }
|
||||
|
||||
CDwmWindowT< TBase >& operator =(HWND hWnd)
|
||||
{
|
||||
m_hWnd = hWnd;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
typedef CDwmWindowT<ATL::CWindow> CDwmWindow;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// CDwmThumbnail - provides DWM thumbnail support
|
||||
|
||||
template <bool t_bManaged, class TBase = CDwm>
|
||||
class CDwmThumbnailT : public TBase
|
||||
{
|
||||
public:
|
||||
// Data members
|
||||
HTHUMBNAIL m_hThumbnail;
|
||||
|
||||
// Constructor
|
||||
CDwmThumbnailT(HTHUMBNAIL hThumbnail = NULL) : m_hThumbnail(hThumbnail)
|
||||
{ }
|
||||
|
||||
~CDwmThumbnailT()
|
||||
{
|
||||
if(t_bManaged && (m_hThumbnail != NULL))
|
||||
Unregister();
|
||||
}
|
||||
|
||||
// Operations
|
||||
CDwmThumbnailT<t_bManaged, TBase>& operator =(HTHUMBNAIL hThumbnail)
|
||||
{
|
||||
Attach(hThumbnail);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Attach(HTHUMBNAIL hThumbnailNew)
|
||||
{
|
||||
if(t_bManaged && m_hThumbnail != NULL && m_hThumbnail != hThumbnailNew)
|
||||
Unregister();
|
||||
m_hThumbnail = hThumbnailNew;
|
||||
}
|
||||
|
||||
HTHUMBNAIL Detach()
|
||||
{
|
||||
HTHUMBNAIL hThumbnail = m_hThumbnail;
|
||||
m_hThumbnail = NULL;
|
||||
return hThumbnail;
|
||||
}
|
||||
|
||||
HRESULT Register(HWND hwndDestination, HWND hwndSource)
|
||||
{
|
||||
ATLASSERT(::IsWindow(hwndDestination));
|
||||
ATLASSERT(::IsWindow(hwndSource));
|
||||
ATLASSERT(m_hThumbnail==NULL);
|
||||
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
return ::DwmRegisterThumbnail(hwndDestination, hwndSource, &m_hThumbnail);
|
||||
}
|
||||
|
||||
HRESULT Unregister()
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
if(m_hThumbnail == NULL)
|
||||
return S_FALSE;
|
||||
|
||||
HRESULT Hr = ::DwmUnregisterThumbnail(m_hThumbnail);
|
||||
if(SUCCEEDED(Hr))
|
||||
m_hThumbnail = NULL;
|
||||
|
||||
return Hr;
|
||||
}
|
||||
|
||||
operator HTHUMBNAIL() const { return m_hThumbnail; }
|
||||
|
||||
bool IsNull() const { return (m_hThumbnail == NULL); }
|
||||
|
||||
HRESULT UpdateProperties(const DWM_THUMBNAIL_PROPERTIES* ptnProperties)
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
ATLASSERT(m_hThumbnail != NULL);
|
||||
return ::DwmUpdateThumbnailProperties(m_hThumbnail, ptnProperties);
|
||||
}
|
||||
|
||||
// Attributes
|
||||
HRESULT QuerySourceSize(PSIZE pSize)
|
||||
{
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
ATLASSERT(m_hThumbnail != NULL);
|
||||
return ::DwmQueryThumbnailSourceSize(m_hThumbnail, pSize);
|
||||
}
|
||||
};
|
||||
|
||||
typedef CDwmThumbnailT<true, CDwm> CDwmThumbnail;
|
||||
typedef CDwmThumbnailT<false, CDwm> CDwmThumbnailHandle;
|
||||
|
||||
|
||||
#ifdef __ATLTHEME_H__
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// CAeroControlImpl - Base class for controls on Glass
|
||||
|
||||
template <class T, class TBase = ATL::CWindow, class TWinTraits = ATL::CControlWinTraits>
|
||||
class CAeroControlImpl : public CThemeImpl<T>,
|
||||
public CBufferedPaintImpl<T>,
|
||||
public ATL::CWindowImpl<T, TBase, TWinTraits>
|
||||
{
|
||||
public:
|
||||
typedef CThemeImpl<T> _themeClass;
|
||||
typedef CBufferedPaintImpl<T> _baseClass;
|
||||
typedef ATL::CWindowImpl<T, TBase, TWinTraits> _windowClass;
|
||||
|
||||
CAeroControlImpl()
|
||||
{
|
||||
m_PaintParams.dwFlags = BPPF_ERASE;
|
||||
}
|
||||
|
||||
static LPCWSTR GetThemeName()
|
||||
{
|
||||
#ifdef _UNICODE
|
||||
return TBase::GetWndClassName();
|
||||
#else
|
||||
ATLASSERT(!_T("Return UNICODE string of window classname / theme class"));
|
||||
return NULL;
|
||||
#endif // _UNICODE
|
||||
}
|
||||
|
||||
// Message map and handlers
|
||||
BEGIN_MSG_MAP(CAeroControlImpl)
|
||||
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
||||
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
|
||||
CHAIN_MSG_MAP(_themeClass)
|
||||
CHAIN_MSG_MAP(_baseClass)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
pT->Init();
|
||||
|
||||
bHandled = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT OnActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
||||
{
|
||||
if(IsThemingSupported())
|
||||
Invalidate(FALSE);
|
||||
|
||||
bHandled = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Operations
|
||||
BOOL SubclassWindow(HWND hWnd)
|
||||
{
|
||||
ATLASSERT(m_hWnd == NULL);
|
||||
ATLASSERT(::IsWindow(hWnd));
|
||||
BOOL bRet = _windowClass::SubclassWindow(hWnd);
|
||||
if(bRet)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
pT->Init();
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
// Implementation
|
||||
LRESULT DefWindowProc()
|
||||
{
|
||||
const ATL::_ATL_MSG* pMsg = m_pCurrentMsg;
|
||||
LRESULT lRes = 0;
|
||||
if(pMsg != NULL)
|
||||
lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam);
|
||||
|
||||
return lRes;
|
||||
}
|
||||
|
||||
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
LRESULT lRes = 0;
|
||||
if(::DwmDefWindowProc(pT->m_hWnd, uMsg, wParam, lParam, &lRes) != FALSE)
|
||||
return lRes;
|
||||
|
||||
return _windowClass::DefWindowProc(uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
void DoBufferedPaint(HDC hDC, RECT& rcPaint)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
HDC hDCPaint = NULL;
|
||||
RECT rcClient = { 0 };
|
||||
GetClientRect(&rcClient);
|
||||
m_BufferedPaint.Begin(hDC, &rcClient, m_dwFormat, &m_PaintParams, &hDCPaint);
|
||||
ATLASSERT(hDCPaint != NULL);
|
||||
pT->DoAeroPaint(hDCPaint, rcClient, rcPaint);
|
||||
m_BufferedPaint.End();
|
||||
}
|
||||
|
||||
void DoPaint(HDC /*hdc*/, RECT& /*rcClient*/)
|
||||
{
|
||||
DefWindowProc();
|
||||
}
|
||||
|
||||
// Overridables
|
||||
void Init()
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
pT; // avoid level 4 warning
|
||||
SetThemeClassList(pT->GetThemeName());
|
||||
if(m_lpstrThemeClassList != NULL)
|
||||
OpenThemeData();
|
||||
}
|
||||
|
||||
void DoAeroPaint(HDC hDC, RECT& /*rcClient*/, RECT& rcPaint)
|
||||
{
|
||||
DefWindowProc(WM_PAINT, (WPARAM) hDC, 0L);
|
||||
m_BufferedPaint.MakeOpaque(&rcPaint);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __ATLTHEME_H__
|
||||
|
||||
}; // namespace WTL
|
||||
|
||||
#endif // __ATLDWM_H__
|
||||
1036
src/Setup/wtl90/atlfind.h
Normal file
1036
src/Setup/wtl90/atlfind.h
Normal file
File diff suppressed because it is too large
Load Diff
3690
src/Setup/wtl90/atlframe.h
Normal file
3690
src/Setup/wtl90/atlframe.h
Normal file
File diff suppressed because it is too large
Load Diff
3892
src/Setup/wtl90/atlgdi.h
Normal file
3892
src/Setup/wtl90/atlgdi.h
Normal file
File diff suppressed because it is too large
Load Diff
3763
src/Setup/wtl90/atlmisc.h
Normal file
3763
src/Setup/wtl90/atlmisc.h
Normal file
File diff suppressed because it is too large
Load Diff
1109
src/Setup/wtl90/atlprint.h
Normal file
1109
src/Setup/wtl90/atlprint.h
Normal file
File diff suppressed because it is too large
Load Diff
268
src/Setup/wtl90/atlres.h
Normal file
268
src/Setup/wtl90/atlres.h
Normal file
@@ -0,0 +1,268 @@
|
||||
// Windows Template Library - WTL version 9.0
|
||||
// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
|
||||
//
|
||||
// This file is a part of the Windows Template Library.
|
||||
// The use and distribution terms for this software are covered by the
|
||||
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
|
||||
// which can be found in the file CPL.TXT at the root of this distribution.
|
||||
// By using this software in any fashion, you are agreeing to be bound by
|
||||
// the terms of this license. You must not remove this notice, or
|
||||
// any other, from this software.
|
||||
|
||||
#ifndef __ATLRES_H__
|
||||
#define __ATLRES_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32_WCE) && !defined(__ATLRESCE_H__)
|
||||
#error Use atlresCE.h instead of atlres.h for Windows CE
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RC_INVOKED
|
||||
#ifndef _INC_WINDOWS
|
||||
|
||||
#define _INC_WINDOWS
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#define VS_VERSION_INFO 1
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#ifndef WINVER
|
||||
#define WINVER 0x0400 // default to Windows Version 4.0
|
||||
#endif // !WINVER
|
||||
|
||||
#include <winresrc.h>
|
||||
|
||||
// operation messages sent to DLGINIT
|
||||
#define LB_ADDSTRING (WM_USER+1)
|
||||
#define CB_ADDSTRING (WM_USER+3)
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#ifdef IDC_STATIC
|
||||
#undef IDC_STATIC
|
||||
#endif // IDC_STATIC
|
||||
#define IDC_STATIC (-1)
|
||||
|
||||
#endif // !_INC_WINDOWS
|
||||
#endif // RC_INVOKED
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// ATL resource types
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
#define RT_DLGINIT MAKEINTRESOURCE(240)
|
||||
#define RT_TOOLBAR MAKEINTRESOURCE(241)
|
||||
#endif // RC_INVOKED
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Standard window components
|
||||
|
||||
#define ID_SEPARATOR 0 // special separator value
|
||||
#define ID_DEFAULT_PANE 0 // default status bar pane
|
||||
|
||||
#ifndef RC_INVOKED // code only
|
||||
// standard control bars (IDW = window ID)
|
||||
#define ATL_IDW_TOOLBAR 0xE800 // main Toolbar for window
|
||||
#define ATL_IDW_STATUS_BAR 0xE801 // Status bar window
|
||||
#define ATL_IDW_COMMAND_BAR 0xE802 // Command bar window
|
||||
|
||||
// parts of a frame window
|
||||
#define ATL_IDW_CLIENT 0xE900
|
||||
#define ATL_IDW_PANE_FIRST 0xE900 // first pane (256 max)
|
||||
#define ATL_IDW_PANE_LAST 0xE9FF
|
||||
#define ATL_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max)
|
||||
#define ATL_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max)
|
||||
|
||||
#define ATL_IDW_SIZE_BOX 0xEA20 // size box for splitters
|
||||
#define ATL_IDW_PANE_SAVE 0xEA21 // to shift ATL_IDW_PANE_FIRST
|
||||
|
||||
// bands for a rebar
|
||||
#define ATL_IDW_BAND_FIRST 0xEB00
|
||||
#define ATL_IDW_BAND_LAST 0xEBFF
|
||||
#endif // !RC_INVOKED
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Standard Commands
|
||||
|
||||
// File commands
|
||||
#define ID_FILE_NEW 0xE100
|
||||
#define ID_FILE_OPEN 0xE101
|
||||
#define ID_FILE_CLOSE 0xE102
|
||||
#define ID_FILE_SAVE 0xE103
|
||||
#define ID_FILE_SAVE_AS 0xE104
|
||||
#define ID_FILE_PAGE_SETUP 0xE105
|
||||
#define ID_FILE_PRINT_SETUP 0xE106
|
||||
#define ID_FILE_PRINT 0xE107
|
||||
#define ID_FILE_PRINT_DIRECT 0xE108
|
||||
#define ID_FILE_PRINT_PREVIEW 0xE109
|
||||
#define ID_FILE_UPDATE 0xE10A
|
||||
#define ID_FILE_SAVE_COPY_AS 0xE10B
|
||||
#define ID_FILE_SEND_MAIL 0xE10C
|
||||
|
||||
#define ID_FILE_MRU_FIRST 0xE110
|
||||
#define ID_FILE_MRU_FILE1 0xE110 // range - 16 max
|
||||
#define ID_FILE_MRU_FILE2 0xE111
|
||||
#define ID_FILE_MRU_FILE3 0xE112
|
||||
#define ID_FILE_MRU_FILE4 0xE113
|
||||
#define ID_FILE_MRU_FILE5 0xE114
|
||||
#define ID_FILE_MRU_FILE6 0xE115
|
||||
#define ID_FILE_MRU_FILE7 0xE116
|
||||
#define ID_FILE_MRU_FILE8 0xE117
|
||||
#define ID_FILE_MRU_FILE9 0xE118
|
||||
#define ID_FILE_MRU_FILE10 0xE119
|
||||
#define ID_FILE_MRU_FILE11 0xE11A
|
||||
#define ID_FILE_MRU_FILE12 0xE11B
|
||||
#define ID_FILE_MRU_FILE13 0xE11C
|
||||
#define ID_FILE_MRU_FILE14 0xE11D
|
||||
#define ID_FILE_MRU_FILE15 0xE11E
|
||||
#define ID_FILE_MRU_FILE16 0xE11F
|
||||
#define ID_FILE_MRU_LAST 0xE11F
|
||||
|
||||
// Edit commands
|
||||
#define ID_EDIT_CLEAR 0xE120
|
||||
#define ID_EDIT_CLEAR_ALL 0xE121
|
||||
#define ID_EDIT_COPY 0xE122
|
||||
#define ID_EDIT_CUT 0xE123
|
||||
#define ID_EDIT_FIND 0xE124
|
||||
#define ID_EDIT_PASTE 0xE125
|
||||
#define ID_EDIT_PASTE_LINK 0xE126
|
||||
#define ID_EDIT_PASTE_SPECIAL 0xE127
|
||||
#define ID_EDIT_REPEAT 0xE128
|
||||
#define ID_EDIT_REPLACE 0xE129
|
||||
#define ID_EDIT_SELECT_ALL 0xE12A
|
||||
#define ID_EDIT_UNDO 0xE12B
|
||||
#define ID_EDIT_REDO 0xE12C
|
||||
#define ID_EDIT_DELETE ID_EDIT_CLEAR
|
||||
#define ID_EDIT_FIND_NEXT ID_EDIT_REPEAT
|
||||
#define ID_EDIT_FIND_PREVIOUS 0xE12D
|
||||
|
||||
// Window commands
|
||||
#define ID_WINDOW_NEW 0xE130
|
||||
#define ID_WINDOW_ARRANGE 0xE131
|
||||
#define ID_WINDOW_CASCADE 0xE132
|
||||
#define ID_WINDOW_TILE_HORZ 0xE133
|
||||
#define ID_WINDOW_TILE_VERT 0xE134
|
||||
#define ID_WINDOW_SPLIT 0xE135
|
||||
#ifndef RC_INVOKED // code only
|
||||
#define ATL_IDM_WINDOW_FIRST 0xE130
|
||||
#define ATL_IDM_WINDOW_LAST 0xE13F
|
||||
#define ATL_IDM_FIRST_MDICHILD 0xFF00 // window list starts here
|
||||
#define ATL_IDM_LAST_MDICHILD 0xFFFD
|
||||
#endif // !RC_INVOKED
|
||||
// TabView
|
||||
#define ID_WINDOW_TABFIRST 0xFF00 // = ATL_IDM_FIRST_MDICHILD
|
||||
#define ID_WINDOW_TABLAST 0xFFFD
|
||||
#define ID_WINDOW_SHOWTABLIST 0xFFFE
|
||||
|
||||
// Help and App commands
|
||||
#define ID_APP_ABOUT 0xE140
|
||||
#define ID_APP_EXIT 0xE141
|
||||
#define ID_HELP_INDEX 0xE142
|
||||
#define ID_HELP_FINDER 0xE143
|
||||
#define ID_HELP_USING 0xE144
|
||||
#define ID_CONTEXT_HELP 0xE145 // shift-F1
|
||||
// special commands for processing help
|
||||
#define ID_HELP 0xE146 // first attempt for F1
|
||||
#define ID_DEFAULT_HELP 0xE147 // last attempt
|
||||
|
||||
// Misc
|
||||
#define ID_NEXT_PANE 0xE150
|
||||
#define ID_PREV_PANE 0xE151
|
||||
#define ID_PANE_CLOSE 0xE152
|
||||
#define ID_PANE_NEXT ID_NEXT_PANE
|
||||
#define ID_PANE_PREVIOUS ID_PREV_PANE
|
||||
|
||||
// Format
|
||||
#define ID_FORMAT_FONT 0xE160
|
||||
|
||||
// Scroll
|
||||
#define ID_SCROLL_UP 0xE170
|
||||
#define ID_SCROLL_DOWN 0xE171
|
||||
#define ID_SCROLL_PAGE_UP 0xE172
|
||||
#define ID_SCROLL_PAGE_DOWN 0xE173
|
||||
#define ID_SCROLL_TOP 0xE174
|
||||
#define ID_SCROLL_BOTTOM 0xE175
|
||||
#define ID_SCROLL_LEFT 0xE176
|
||||
#define ID_SCROLL_RIGHT 0xE177
|
||||
#define ID_SCROLL_PAGE_LEFT 0xE178
|
||||
#define ID_SCROLL_PAGE_RIGHT 0xE179
|
||||
#define ID_SCROLL_ALL_LEFT 0xE17A
|
||||
#define ID_SCROLL_ALL_RIGHT 0xE17B
|
||||
|
||||
// OLE commands
|
||||
#define ID_OLE_INSERT_NEW 0xE200
|
||||
#define ID_OLE_EDIT_LINKS 0xE201
|
||||
#define ID_OLE_EDIT_CONVERT 0xE202
|
||||
#define ID_OLE_EDIT_CHANGE_ICON 0xE203
|
||||
#define ID_OLE_EDIT_PROPERTIES 0xE204
|
||||
#define ID_OLE_VERB_FIRST 0xE210 // range - 16 max
|
||||
#ifndef RC_INVOKED // code only
|
||||
#define ID_OLE_VERB_LAST 0xE21F
|
||||
#endif // !RC_INVOKED
|
||||
|
||||
// View commands (same number used as IDW used for toolbar and status bar)
|
||||
#define ID_VIEW_TOOLBAR 0xE800
|
||||
#define ID_VIEW_STATUS_BAR 0xE801
|
||||
#define ID_VIEW_REFRESH 0xE803
|
||||
#define ID_VIEW_RIBBON 0xE804
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Standard control IDs
|
||||
|
||||
#ifdef IDC_STATIC
|
||||
#undef IDC_STATIC
|
||||
#endif // IDC_STATIC
|
||||
#define IDC_STATIC (-1) // all static controls
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Standard string error/warnings
|
||||
|
||||
// idle status bar message
|
||||
#define ATL_IDS_IDLEMESSAGE 0xE001
|
||||
|
||||
#ifndef RC_INVOKED // code only
|
||||
#define ATL_IDS_SCFIRST 0xEF00
|
||||
#endif // !RC_INVOKED
|
||||
|
||||
#define ATL_IDS_SCSIZE 0xEF00
|
||||
#define ATL_IDS_SCMOVE 0xEF01
|
||||
#define ATL_IDS_SCMINIMIZE 0xEF02
|
||||
#define ATL_IDS_SCMAXIMIZE 0xEF03
|
||||
#define ATL_IDS_SCNEXTWINDOW 0xEF04
|
||||
#define ATL_IDS_SCPREVWINDOW 0xEF05
|
||||
#define ATL_IDS_SCCLOSE 0xEF06
|
||||
#define ATL_IDS_SCRESTORE 0xEF12
|
||||
#define ATL_IDS_SCTASKLIST 0xEF13
|
||||
|
||||
#define ATL_IDS_MDICHILD 0xEF1F
|
||||
#define ATL_IDS_MRU_FILE 0xEFDA
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Misc. control IDs
|
||||
|
||||
// Property Sheet control id's (determined with Spy++)
|
||||
#define ID_APPLY_NOW 0x3021
|
||||
#define ID_WIZBACK 0x3023
|
||||
#define ID_WIZNEXT 0x3024
|
||||
#define ID_WIZFINISH 0x3025
|
||||
#define ATL_IDC_TAB_CONTROL 0x3020
|
||||
|
||||
#endif // __ATLRES_H__
|
||||
93
src/Setup/wtl90/atlresce.h
Normal file
93
src/Setup/wtl90/atlresce.h
Normal file
@@ -0,0 +1,93 @@
|
||||
// Windows Template Library - WTL version 9.0
|
||||
// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
|
||||
//
|
||||
// This file is a part of the Windows Template Library.
|
||||
// The use and distribution terms for this software are covered by the
|
||||
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
|
||||
// which can be found in the file CPL.TXT at the root of this distribution.
|
||||
// By using this software in any fashion, you are agreeing to be bound by
|
||||
// the terms of this license. You must not remove this notice, or
|
||||
// any other, from this software.
|
||||
|
||||
#ifndef __ATLRESCE_H__
|
||||
#define __ATLRESCE_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#error atlresCE.h is only for Windows CE
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RC_INVOKED
|
||||
#ifndef _INC_WINDOWS
|
||||
|
||||
#define VS_VERSION_INFO 1
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#ifndef WINVER
|
||||
#define WINVER 0x0400 // default to Windows Version 4.0
|
||||
#endif // !WINVER
|
||||
|
||||
#if !defined(WCEOLE_ENABLE_DIALOGEX)
|
||||
#define DIALOGEX DIALOG DISCARDABLE
|
||||
#endif
|
||||
|
||||
#include <commctrl.h>
|
||||
#define SHMENUBAR RCDATA
|
||||
|
||||
#if defined(SHELLSDK_MODULES_AYGSHELL)
|
||||
#include <aygshell.h>
|
||||
#else
|
||||
#define NOMENU 0xFFFF
|
||||
#define IDS_SHNEW 1
|
||||
#define IDM_SHAREDNEW 10
|
||||
#define IDM_SHAREDNEWDEFAULT 11
|
||||
#endif
|
||||
#ifndef I_IMAGENONE
|
||||
#define I_IMAGENONE (-2)
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#endif // !_INC_WINDOWS
|
||||
#endif // RC_INVOKED
|
||||
|
||||
#include "atlres.h"
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
// Visual Studio dialog editor bug fix
|
||||
#ifndef DS_FIXEDSYS
|
||||
#define DS_FIXEDSYS 0
|
||||
#endif
|
||||
|
||||
#define IDC_INFOSTATIC 0xFFFE // == IDC_STATIC -1
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Smartphone and PPC 2005 Resource IDs
|
||||
|
||||
// Command and associated string resource IDs
|
||||
#define ID_MENU_OK 0xE790
|
||||
#define ID_MENU_CANCEL 0xE791
|
||||
#define ID_MENU 0xE792
|
||||
#define ID_ACTION 0xE793
|
||||
#define ID_VIEW_FULLSCREEN 0xE802
|
||||
|
||||
// MenuBar resource IDs
|
||||
#define ATL_IDM_MENU_DONE 0xE701
|
||||
#define ATL_IDM_MENU_CANCEL 0xE702
|
||||
#define ATL_IDM_MENU_DONECANCEL 0xE703
|
||||
|
||||
// Default device MenuBar control ID and MenuBar resource ID
|
||||
#define ATL_IDW_MENU_BAR 0xE802
|
||||
|
||||
// SmartPhone spinned controls ID offset for CSpinCtrl
|
||||
#define ATL_IDW_SPIN_ID 9999
|
||||
|
||||
#endif // __ATLRESCE_H__
|
||||
3457
src/Setup/wtl90/atlribbon.h
Normal file
3457
src/Setup/wtl90/atlribbon.h
Normal file
File diff suppressed because it is too large
Load Diff
2169
src/Setup/wtl90/atlscrl.h
Normal file
2169
src/Setup/wtl90/atlscrl.h
Normal file
File diff suppressed because it is too large
Load Diff
1126
src/Setup/wtl90/atlsplit.h
Normal file
1126
src/Setup/wtl90/atlsplit.h
Normal file
File diff suppressed because it is too large
Load Diff
1262
src/Setup/wtl90/atltheme.h
Normal file
1262
src/Setup/wtl90/atltheme.h
Normal file
File diff suppressed because it is too large
Load Diff
1390
src/Setup/wtl90/atluser.h
Normal file
1390
src/Setup/wtl90/atluser.h
Normal file
File diff suppressed because it is too large
Load Diff
2984
src/Setup/wtl90/atlwince.h
Normal file
2984
src/Setup/wtl90/atlwince.h
Normal file
File diff suppressed because it is too large
Load Diff
525
src/Setup/wtl90/atlwinx.h
Normal file
525
src/Setup/wtl90/atlwinx.h
Normal file
@@ -0,0 +1,525 @@
|
||||
// Windows Template Library - WTL version 9.0
|
||||
// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
|
||||
//
|
||||
// This file is a part of the Windows Template Library.
|
||||
// The use and distribution terms for this software are covered by the
|
||||
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
|
||||
// which can be found in the file CPL.TXT at the root of this distribution.
|
||||
// By using this software in any fashion, you are agreeing to be bound by
|
||||
// the terms of this license. You must not remove this notice, or
|
||||
// any other, from this software.
|
||||
|
||||
#ifndef __ATLWINX_H__
|
||||
#define __ATLWINX_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __ATLAPP_H__
|
||||
#error atlwinx.h requires atlapp.h to be included first
|
||||
#endif
|
||||
|
||||
#if (_ATL_VER >= 0x0700)
|
||||
#include <atlwin.h>
|
||||
#endif // (_ATL_VER >= 0x0700)
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Classes in this file:
|
||||
//
|
||||
// _U_RECT
|
||||
// _U_MENUorID
|
||||
// _U_STRINGorID
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Command Chaining Macros
|
||||
|
||||
#define CHAIN_COMMANDS(theChainClass) \
|
||||
if(uMsg == WM_COMMAND) \
|
||||
CHAIN_MSG_MAP(theChainClass)
|
||||
|
||||
#define CHAIN_COMMANDS_ALT(theChainClass, msgMapID) \
|
||||
if(uMsg == WM_COMMAND) \
|
||||
CHAIN_MSG_MAP_ALT(theChainClass, msgMapID)
|
||||
|
||||
#define CHAIN_COMMANDS_MEMBER(theChainMember) \
|
||||
if(uMsg == WM_COMMAND) \
|
||||
CHAIN_MSG_MAP_MEMBER(theChainMember)
|
||||
|
||||
#define CHAIN_COMMANDS_ALT_MEMBER(theChainMember, msgMapID) \
|
||||
if(uMsg == WM_COMMAND) \
|
||||
CHAIN_MSG_MAP_ALT_MEMBER(theChainMember, msgMapID)
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Macros for parent message map to selectively reflect control messages
|
||||
|
||||
// NOTE: ReflectNotifications is a member of ATL's CWindowImplRoot
|
||||
// (and overridden in 2 cases - CContainedWindowT and CAxHostWindow)
|
||||
// Since we can't modify ATL, we'll provide the needed additions
|
||||
// in a separate function (that is not a member of CWindowImplRoot)
|
||||
|
||||
namespace WTL
|
||||
{
|
||||
|
||||
inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled,
|
||||
UINT uMsgFilter = WM_NULL, UINT_PTR idFromFilter = 0, HWND hWndChildFilter = NULL)
|
||||
{
|
||||
if((uMsgFilter != WM_NULL) && (uMsgFilter != uMsg))
|
||||
{
|
||||
// The notification message doesn't match the filter.
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
HWND hWndChild = NULL;
|
||||
UINT_PTR idFrom = 0;
|
||||
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
if(lParam != NULL) // not from a menu
|
||||
{
|
||||
hWndChild = (HWND)lParam;
|
||||
idFrom = (UINT_PTR)LOWORD(wParam);
|
||||
}
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
hWndChild = ((LPNMHDR)lParam)->hwndFrom;
|
||||
idFrom = ((LPNMHDR)lParam)->idFrom;
|
||||
break;
|
||||
#ifndef _WIN32_WCE
|
||||
case WM_PARENTNOTIFY:
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case WM_CREATE:
|
||||
case WM_DESTROY:
|
||||
hWndChild = (HWND)lParam;
|
||||
idFrom = (UINT_PTR)HIWORD(wParam);
|
||||
break;
|
||||
default:
|
||||
hWndChild = ::GetDlgItem(hWndParent, HIWORD(wParam));
|
||||
idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif // !_WIN32_WCE
|
||||
case WM_DRAWITEM:
|
||||
if(wParam) // not from a menu
|
||||
{
|
||||
hWndChild = ((LPDRAWITEMSTRUCT)lParam)->hwndItem;
|
||||
idFrom = (UINT_PTR)wParam;
|
||||
}
|
||||
break;
|
||||
case WM_MEASUREITEM:
|
||||
if(wParam) // not from a menu
|
||||
{
|
||||
hWndChild = ::GetDlgItem(hWndParent, ((LPMEASUREITEMSTRUCT)lParam)->CtlID);
|
||||
idFrom = (UINT_PTR)wParam;
|
||||
}
|
||||
break;
|
||||
case WM_COMPAREITEM:
|
||||
if(wParam) // not from a menu
|
||||
{
|
||||
hWndChild = ((LPCOMPAREITEMSTRUCT)lParam)->hwndItem;
|
||||
idFrom = (UINT_PTR)wParam;
|
||||
}
|
||||
break;
|
||||
case WM_DELETEITEM:
|
||||
if(wParam) // not from a menu
|
||||
{
|
||||
hWndChild = ((LPDELETEITEMSTRUCT)lParam)->hwndItem;
|
||||
idFrom = (UINT_PTR)wParam;
|
||||
}
|
||||
break;
|
||||
case WM_VKEYTOITEM:
|
||||
case WM_CHARTOITEM:
|
||||
case WM_HSCROLL:
|
||||
case WM_VSCROLL:
|
||||
hWndChild = (HWND)lParam;
|
||||
idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild);
|
||||
break;
|
||||
case WM_CTLCOLORBTN:
|
||||
case WM_CTLCOLORDLG:
|
||||
case WM_CTLCOLOREDIT:
|
||||
case WM_CTLCOLORLISTBOX:
|
||||
case WM_CTLCOLORMSGBOX:
|
||||
case WM_CTLCOLORSCROLLBAR:
|
||||
case WM_CTLCOLORSTATIC:
|
||||
hWndChild = (HWND)lParam;
|
||||
idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if((hWndChild == NULL) ||
|
||||
((hWndChildFilter != NULL) && (hWndChildFilter != hWndChild)))
|
||||
{
|
||||
// Either hWndChild isn't valid, or
|
||||
// hWndChild doesn't match the filter.
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if((idFromFilter != 0) && (idFromFilter != idFrom))
|
||||
{
|
||||
// The dialog control id doesn't match the filter.
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
ATLASSERT(::IsWindow(hWndChild));
|
||||
LRESULT lResult = ::SendMessage(hWndChild, OCM__BASE + uMsg, wParam, lParam);
|
||||
if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC))
|
||||
{
|
||||
// Try to prevent problems with WM_CTLCOLOR* messages when
|
||||
// the message wasn't really handled
|
||||
bHandled = FALSE;
|
||||
}
|
||||
|
||||
return lResult;
|
||||
}
|
||||
|
||||
}; // namespace WTL
|
||||
|
||||
// Try to prevent problems with WM_CTLCOLOR* messages when
|
||||
// the message wasn't really handled
|
||||
#define REFLECT_NOTIFICATIONS_EX() \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) \
|
||||
bHandled = FALSE; \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFICATIONS_MSG_FILTERED(uMsgFilter) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, NULL); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFICATIONS_ID_FILTERED(idFromFilter) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, idFromFilter, NULL); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFICATIONS_HWND_FILTERED(hWndChildFilter) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, 0, hWndChildFilter); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFICATIONS_MSG_ID_FILTERED(uMsgFilter, idFromFilter) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, idFromFilter, NULL); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFICATIONS_MSG_HWND_FILTERED(uMsgFilter, hWndChildFilter) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, hWndChildFilter); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_COMMAND(id, code) \
|
||||
if(uMsg == WM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_COMMAND_ID(id) \
|
||||
if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_COMMAND_CODE(code) \
|
||||
if(uMsg == WM_COMMAND && code == HIWORD(wParam)) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_COMMAND_RANGE(idFirst, idLast) \
|
||||
if(uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_COMMAND_RANGE_CODE(idFirst, idLast, code) \
|
||||
if(uMsg == WM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFY(id, cd) \
|
||||
if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFY_ID(id) \
|
||||
if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFY_CODE(cd) \
|
||||
if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFY_RANGE(idFirst, idLast) \
|
||||
if(uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFY_RANGE_CODE(idFirst, idLast, cd) \
|
||||
if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Reflected message handler macros for message maps (for ATL 3.0)
|
||||
|
||||
#if (_ATL_VER < 0x0700)
|
||||
|
||||
#define REFLECTED_COMMAND_HANDLER(id, code, func) \
|
||||
if(uMsg == OCM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECTED_COMMAND_ID_HANDLER(id, func) \
|
||||
if(uMsg == OCM_COMMAND && id == LOWORD(wParam)) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECTED_COMMAND_CODE_HANDLER(code, func) \
|
||||
if(uMsg == OCM_COMMAND && code == HIWORD(wParam)) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECTED_COMMAND_RANGE_HANDLER(idFirst, idLast, func) \
|
||||
if(uMsg == OCM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECTED_COMMAND_RANGE_CODE_HANDLER(idFirst, idLast, code, func) \
|
||||
if(uMsg == OCM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECTED_NOTIFY_HANDLER(id, cd, func) \
|
||||
if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECTED_NOTIFY_ID_HANDLER(id, func) \
|
||||
if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECTED_NOTIFY_CODE_HANDLER(cd, func) \
|
||||
if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECTED_NOTIFY_RANGE_HANDLER(idFirst, idLast, func) \
|
||||
if(uMsg == OCM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECTED_NOTIFY_RANGE_CODE_HANDLER(idFirst, idLast, cd, func) \
|
||||
if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#endif // (_ATL_VER < 0x0700)
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Dual argument helper classes (for ATL 3.0)
|
||||
|
||||
#if (_ATL_VER < 0x0700)
|
||||
|
||||
namespace ATL
|
||||
{
|
||||
|
||||
class _U_RECT
|
||||
{
|
||||
public:
|
||||
_U_RECT(LPRECT lpRect) : m_lpRect(lpRect)
|
||||
{ }
|
||||
_U_RECT(RECT& rc) : m_lpRect(&rc)
|
||||
{ }
|
||||
LPRECT m_lpRect;
|
||||
};
|
||||
|
||||
class _U_MENUorID
|
||||
{
|
||||
public:
|
||||
_U_MENUorID(HMENU hMenu) : m_hMenu(hMenu)
|
||||
{ }
|
||||
_U_MENUorID(UINT nID) : m_hMenu((HMENU)LongToHandle(nID))
|
||||
{ }
|
||||
HMENU m_hMenu;
|
||||
};
|
||||
|
||||
class _U_STRINGorID
|
||||
{
|
||||
public:
|
||||
_U_STRINGorID(LPCTSTR lpString) : m_lpstr(lpString)
|
||||
{ }
|
||||
_U_STRINGorID(UINT nID) : m_lpstr(MAKEINTRESOURCE(nID))
|
||||
{ }
|
||||
LPCTSTR m_lpstr;
|
||||
};
|
||||
|
||||
}; // namespace ATL
|
||||
|
||||
#endif // (_ATL_VER < 0x0700)
|
||||
|
||||
|
||||
namespace WTL
|
||||
{
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Forward notifications support for message maps (for ATL 3.0)
|
||||
|
||||
#if (_ATL_VER < 0x0700)
|
||||
|
||||
// forward notifications support
|
||||
#define FORWARD_NOTIFICATIONS() \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = WTL::Atl3ForwardNotifications(m_hWnd, uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
static LRESULT Atl3ForwardNotifications(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
LRESULT lResult = 0;
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
case WM_NOTIFY:
|
||||
#ifndef _WIN32_WCE
|
||||
case WM_PARENTNOTIFY:
|
||||
#endif // !_WIN32_WCE
|
||||
case WM_DRAWITEM:
|
||||
case WM_MEASUREITEM:
|
||||
case WM_COMPAREITEM:
|
||||
case WM_DELETEITEM:
|
||||
case WM_VKEYTOITEM:
|
||||
case WM_CHARTOITEM:
|
||||
case WM_HSCROLL:
|
||||
case WM_VSCROLL:
|
||||
case WM_CTLCOLORBTN:
|
||||
case WM_CTLCOLORDLG:
|
||||
case WM_CTLCOLOREDIT:
|
||||
case WM_CTLCOLORLISTBOX:
|
||||
case WM_CTLCOLORMSGBOX:
|
||||
case WM_CTLCOLORSCROLLBAR:
|
||||
case WM_CTLCOLORSTATIC:
|
||||
lResult = ::SendMessage(::GetParent(hWnd), uMsg, wParam, lParam);
|
||||
break;
|
||||
default:
|
||||
bHandled = FALSE;
|
||||
break;
|
||||
}
|
||||
return lResult;
|
||||
}
|
||||
|
||||
#endif // (_ATL_VER < 0x0700)
|
||||
|
||||
}; // namespace WTL
|
||||
|
||||
#endif // __ATLWINX_H__
|
||||
Reference in New Issue
Block a user