Initialized

- AdvMessageBox dient zum Erzeugen einer eigenen MessageBox.
   Der MessageBox kann ein eigenes Icon übergeben werden.
   Die Anzahl der Buttons kann zwischen 1 und 4 geändert werden.
   Die Standard-Buttons lassen sich benutzerdefiniert beschriften
This commit is contained in:
Hoeglinger Eugen 2022-05-19 16:36:54 +02:00
commit 5e8f669cc7
65 changed files with 2478 additions and 0 deletions

BIN
.vs/AdvMessageBox/v17/.suo Normal file

Binary file not shown.

30
AdvMessageBox.sln Normal file
View File

@ -0,0 +1,30 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32421.90
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdvMessageBox", "AdvMessageBox\AdvMessageBox.csproj", "{959B45CA-B413-4177-8523-340837A6CE10}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_AdvMessageBox", "Test_AdvMessageBox\Test_AdvMessageBox.csproj", "{3916AD4C-EBFE-4EB3-B9FA-1DAE51F2BF92}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{959B45CA-B413-4177-8523-340837A6CE10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{959B45CA-B413-4177-8523-340837A6CE10}.Debug|Any CPU.Build.0 = Debug|Any CPU
{959B45CA-B413-4177-8523-340837A6CE10}.Release|Any CPU.ActiveCfg = Release|Any CPU
{959B45CA-B413-4177-8523-340837A6CE10}.Release|Any CPU.Build.0 = Release|Any CPU
{3916AD4C-EBFE-4EB3-B9FA-1DAE51F2BF92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3916AD4C-EBFE-4EB3-B9FA-1DAE51F2BF92}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3916AD4C-EBFE-4EB3-B9FA-1DAE51F2BF92}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3916AD4C-EBFE-4EB3-B9FA-1DAE51F2BF92}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {07474286-329C-49D7-892B-F6B6FEC44E86}
EndGlobalSection
EndGlobal

BIN
AdvMessageBox.suo Normal file

Binary file not shown.

View File

@ -0,0 +1,447 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace MsdnMag
{
// *****************************************************************
// Buttons combination
public enum MyMessageBoxButtons
{
OK = 0,
OKCancel = 1,
AbortRetryIgnore = 2,
YesNoCancel = 3,
YesNo = 4,
RetryCancel = 5,
YesNoAllCancel = 6 // NEW
}
// *****************************************************************
public class MessageBox
{
#region Version and Copyright
// Version and Copyright
static readonly string dllName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyTitleAttribute>().Title); //Den Programmnamen auslesen
//static readonly string dllName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen
static readonly string dllVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
static readonly object[] attributes = System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
static readonly string copyright = GenerateCopyright();
private static string CurrentYear()
{
DateTime dtn = DateTime.Now;
return dtn.Year.ToString();
}
private static string StartYear()
{
string startYear;
if (((AssemblyCopyrightAttribute)attributes[0]).Copyright.Contains("Copyright © "))
{
startYear = ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace("Copyright © ", "");
while (startYear.StartsWith(" "))
{
startYear = startYear.Remove(0, 1);
}
startYear = startYear.Remove(startYear.IndexOf(" "));
return startYear;
}
else
{
DateTime dtn = DateTime.Now;
return dtn.Year.ToString();
}
}
private static string GenerateCopyright()
{
string startYear = StartYear();
string currentYear = CurrentYear();
if (startYear == currentYear)
{
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
else
{
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace(startYear, String.Concat(startYear, "-", currentYear));
}
}
#endregion
#region DLL-Info
/// <summary>
/// Contains the name of the dll file.
/// </summary>
public static string DllName { private set; get; }
/// <summary>
/// Contains the version of the dll file.
/// </summary>
public static string DllVersion { private set; get; }
/// <summary>
/// Contains the copyright notice.
/// </summary>
public static string Copyright { private set; get; }
/// <summary>
/// Contains the name-, version- and copyright-information of the dll file.
/// </summary>
public static string[] DllInfo { private set; get; }
private static void SetDllInfo()
{
//Set name, version and copyright
DllName = dllName;
DllVersion = dllVersion;
Copyright = copyright;
}
#endregion
// *****************************************************************
// Properties
protected LocalCbtHook m_cbt;
protected IntPtr m_handle = IntPtr.Zero;
protected bool m_alreadySetup = false;
// *****************************************************************
/// <summary>
/// Provide name, version and copyright of the DLL
/// </summary>
static MessageBox()
{
SetDllInfo(); // Set name, version and copyright of the DLL
}
// *****************************************************************
public MessageBox()
{
SetDllInfo(); // Set name, version and copyright of the DLL
m_cbt = new LocalCbtHook();
m_cbt.WindowCreated += new LocalCbtHook.CbtEventHandler(WndCreated);
m_cbt.WindowDestroyed += new LocalCbtHook.CbtEventHandler(WndDestroyed);
m_cbt.WindowActivated += new LocalCbtHook.CbtEventHandler(WndActivated);
}
// *****************************************************************
// *****************************************************************
// PROPERTY IconFile
private string m_iconFile = "";
public string IconFile
{
get {return m_iconFile;}
set {m_iconFile=value; m_iconIndex=0;}
}
// *****************************************************************
// *****************************************************************
// PROPERTY YesAllNoCancel
public bool YesAllNoCancel = false;
private const int IDALL = 9; // same as IDHELP in the Win32 API
private const int MB_HELP = 0x00004000;
// *****************************************************************
// *****************************************************************
// PROPERTY IconIndex
private int m_iconIndex = 0;
public int IconIndex
{
get {return m_iconIndex;}
set {m_iconIndex=value;}
}
// *****************************************************************
// *****************************************************************
// Show
public DialogResult Show(string text, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
{
// If a custom icon is requested, ensure the window leaves room for
// the icon... Add a fake icon
if (IconFile.Length > 0 && icon == MessageBoxIcon.None)
icon = MessageBoxIcon.Information;
else
IconFile = "";
// Apply the changes needed if 4 buttons are required
if (YesAllNoCancel)
{
m_cbt.Install();
buttons = MessageBoxButtons.YesNoCancel;
// Must use MessageBox API because of the 4th button
int res = _MessageBox(GetActiveWindow(), text, title,
(int) (buttons + (int) icon + MB_HELP));
m_cbt.Uninstall();
return (DialogResult) res;
}
// Go the default way
m_cbt.Install();
DialogResult dr = System.Windows.Forms.MessageBox.Show(text, title, buttons, icon);
m_cbt.Uninstall();
return dr;
}
public DialogResult Show(string text, string title, MessageBoxButtons buttons)
{
return Show(text, title, buttons, MessageBoxIcon.None);
}
public DialogResult Show(string text, string title)
{
return Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.None);
}
public DialogResult Show(string text)
{
return Show(text, "", MessageBoxButtons.OK, MessageBoxIcon.None);
}
// *****************************************************************
// *****************************************************************
// WndCreated event handler
private void WndCreated(object sender, CbtEventArgs e)
{
if (e.IsDialogWindow)
{
m_alreadySetup = false;
Console.WriteLine("MessageBox created");
m_handle = e.Handle;
}
}
// *****************************************************************
// *****************************************************************
// WndDestroyed event handler
private void WndDestroyed(object sender, CbtEventArgs e)
{
if (e.Handle == m_handle)
{
m_alreadySetup = false;
m_handle = IntPtr.Zero;
}
}
// *****************************************************************
// *****************************************************************
// WndActivated event handler
private void WndActivated(object sender, CbtEventArgs e)
{
if (m_handle != e.Handle)
return;
// Not the first time
if (m_alreadySetup)
{
Console.WriteLine("(Already configured. Not the first time it is activated!)");
return;
}
else
m_alreadySetup = true;
//
// Modify the MessageBox window
//
Console.WriteLine("MessageBox activated");
// Replace the icon (0x0014 is the ID of the icon window)
if (m_iconFile.Length >0)
{
IntPtr hwndIcon = GetDlgItem(m_handle, 0x0014);
IntPtr hIcon = ExtractIcon(IntPtr.Zero, m_iconFile, m_iconIndex);
SendMessage(hwndIcon, STM_SETICON, hIcon, IntPtr.Zero);
}
// Get the static window with the text and the text
IntPtr hwndText = GetDlgItem(m_handle, 0xFFFF);
StringBuilder sb = new StringBuilder();
sb.Capacity = 256;
GetWindowText(hwndText, sb, 256);
string text = sb.ToString();
// Get the window position
RECT rc = new RECT();
GetWindowRect(hwndText, rc);
POINT pt = new POINT();
pt.x = rc.left;
pt.y = rc.top;
ScreenToClient(m_handle, pt);
// Create the alternate EDIT window
IntPtr m_edit = CreateWindowEx(0, "edit", "", ES_READONLY|ES_MULTILINE|WS_CHILD|WS_VISIBLE,
pt.x, pt.y, rc.right-rc.left, rc.bottom-rc.top,
m_handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
// Set font and text
IntPtr hFont = SendMessage(hwndText, WM_GETFONT, IntPtr.Zero, IntPtr.Zero);
SendMessage(m_edit, WM_SETFONT, hFont, new IntPtr(1));
SetWindowText(m_edit, text);
// Copy the displayed text to the clipboard
Clipboard.SetDataObject(text);
// Finalizing...
DestroyWindow(hwndText);
// Yes-All-No-Cancel setup
// Map the YES-NO-CANCEL-HELP sequence to YES-OK to All-NO-CANCEL
// The mapping has two steps: button text and button ID
// No need to change the Yes button
// Map button text
SetWindowText(GetDlgItem(m_handle,(int) DialogResult.No), "OK to All");
SetWindowText(GetDlgItem(m_handle,(int) DialogResult.Cancel), DialogResult.No.ToString());
SetWindowText(GetDlgItem(m_handle,IDALL), DialogResult.Cancel.ToString());
// Map button IDs
SetWindowLong(GetDlgItem(m_handle,(int) DialogResult.No), GWL_ID, (int)DialogResult.OK);
SetWindowLong(GetDlgItem(m_handle,(int) DialogResult.Cancel), GWL_ID, (int) DialogResult.No);
SetWindowLong(GetDlgItem(m_handle,IDALL), GWL_ID, (int) DialogResult.Cancel);
}
// *****************************************************************
#region Win32 Imports
private const int ES_READONLY = 0x00000800;
private const int ES_MULTILINE = 0x00000004;
private const int WS_VISIBLE = 0x10000000;
private const int WS_CHILD = 0x40000000;
private const int WM_SETFONT = 0x00000030;
private const int WM_GETFONT = 0x00000031;
private const int STM_SETICON = 0x00000170;
// ************************************************************************
// Win32: GetClassName
[DllImport("user32.dll")]
protected static extern int GetClassName(IntPtr hwnd,
StringBuilder lpClassName, int nMaxCount);
// ************************************************************************
// ************************************************************************
// Win32: GetDlgItem
[DllImport("user32.dll")]
protected static extern IntPtr GetDlgItem(IntPtr hwnd, int id);
// ************************************************************************
// ************************************************************************
// Win32: GetWindowText
[DllImport("user32.dll")]
protected static extern int GetWindowText(IntPtr hwnd,
StringBuilder lpString, int nMaxCount);
// ************************************************************************
// ************************************************************************
// Win32: SetWindowText
[DllImport("user32.dll")]
protected static extern bool SetWindowText(IntPtr hwnd, string text);
// ************************************************************************
// ************************************************************************
// Win32: GetWindowRect
[DllImport("user32.dll")]
protected static extern int GetWindowRect(IntPtr hwnd, RECT rc);
// ************************************************************************
// ************************************************************************
// Win32: ScreenToClient
[DllImport("user32.dll")]
protected static extern int ScreenToClient(IntPtr hwnd, POINT pt);
// ************************************************************************
// ************************************************************************
// Win32: SetWindowLong
protected const int GWL_ID = -12;
[DllImport("user32.dll")]
protected static extern int SetWindowLong(IntPtr hwnd,
int index, int newValue);
// ************************************************************************
// ************************************************************************
// Win32: ExtractIcon
[DllImport("shell32.dll")]
protected static extern IntPtr ExtractIcon(
IntPtr hInst, // instance handle
string lpszExeFileName, // file name
int nIconIndex // icon index
);
// ************************************************************************
// ************************************************************************
// Win32: DestroyWindow
[DllImport("user32.dll")]
protected static extern void DestroyWindow(IntPtr hwnd);
// ************************************************************************
// ************************************************************************
// Win32: MessageBox
[DllImport("user32.dll", EntryPoint="MessageBox")]
protected static extern int _MessageBox(IntPtr hwnd, string text, string caption,
int options);
// ************************************************************************
// ************************************************************************
// Win32: SendMessage
[DllImport("user32.dll")]
protected static extern IntPtr SendMessage(IntPtr hwnd,
int msg, IntPtr wParam, IntPtr lParam);
// ************************************************************************
// ************************************************************************
// Win32: GetActiveWindow
[DllImport("user32.dll")]
protected static extern IntPtr GetActiveWindow();
// ************************************************************************
// ************************************************************************
// Win32: CreateWindowEx
[DllImport("user32.dll")]
protected static extern IntPtr CreateWindowEx(
int dwExStyle, // extended window style
string lpClassName, // registered class name
string lpWindowName, // window name
int dwStyle, // window style
int x, // horizontal position of window
int y, // vertical position of window
int nWidth, // window width
int nHeight, // window height
IntPtr hWndParent, // handle to parent or owner window
IntPtr hMenu, // menu handle or child identifier
IntPtr hInstance, // handle to application instance
IntPtr lpParam // window-creation data
);
// ************************************************************************
// ************************************************************************
// POINT
[StructLayout(LayoutKind.Sequential)]
public class POINT
{
public int x;
public int y;
}
// ************************************************************************
// ************************************************************************
// RECT
[StructLayout(LayoutKind.Sequential)]
public class RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
// ************************************************************************
#endregion
}
}

View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>7.0.9466</ProductVersion>
<SchemaVersion>1.0</SchemaVersion>
<ProjectGuid>{959B45CA-B413-4177-8523-340837A6CE10}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon />
<AssemblyKeyContainerName />
<AssemblyName>hemessbox</AssemblyName>
<AssemblyOriginatorKeyFile />
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<RootNamespace />
<StartupObject />
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>0.0</OldToolsVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile />
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile />
<DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile />
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile />
<DebugSymbols>false</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>none</DebugType>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="CbtHook">
<Name>CbtHook</Name>
<HintPath>bin\Debug\CbtHook.dll</HintPath>
</Reference>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Drawing">
<Name>System.Drawing</Name>
</Reference>
<Reference Include="System.Windows.Forms">
<Name>System.Windows.Forms</Name>
</Reference>
<Reference Include="WindowsHook">
<Name>WindowsHook</Name>
<HintPath>bin\Debug\WindowsHook.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AdvMessageBox.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent />
<PostBuildEvent />
</PropertyGroup>
</Project>

View File

@ -0,0 +1,48 @@
<VisualStudioProject>
<CSHARP>
<Build>
<Settings ReferencePath = "D:\Articles\MSDN Magazine\Cutting Edge\Hooks in .NET\Source\Hooks\C#\CbtHook_CS\bin\Debug\;D:\Articles\MSDN Magazine\Cutting Edge\Hooks in .NET\Source\SelectableMsgBox\AdvMessageBox\bin\Debug\;C:\My Labs\SelectableMsgBox\AdvMessageBox\bin\Debug\" >
<Config
Name = "Debug"
EnableASPDebugging = "false"
EnableASPXDebugging = "false"
EnableUnmanagedDebugging = "false"
EnableSQLServerDebugging = "false"
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
StartArguments = ""
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
StartWithIE = "true"
/>
<Config
Name = "Release"
EnableASPDebugging = "false"
EnableASPXDebugging = "false"
EnableUnmanagedDebugging = "false"
EnableSQLServerDebugging = "false"
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
StartArguments = ""
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
StartWithIE = "true"
/>
</Settings>
</Build>
<OtherProjectSettings
CopyProjectDestinationFolder = ""
CopyProjectUncPath = ""
CopyProjectOption = "0"
ProjectView = "ProjectFiles"
ProjectTrust = "0"
/>
</CSHARP>
</VisualStudioProject>

View File

@ -0,0 +1,58 @@
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("AdvMessageBox")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdvMessageBox")]
[assembly: AssemblyCopyright("Copyright © 2022 by Eugen Höglinger")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]

View File

@ -0,0 +1 @@
ce30fe113cdaacdc7189391e114f85b7df907d34

View File

@ -0,0 +1,7 @@
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\AdvMessageBox\obj\Debug\AdvMessageBox.csproj.AssemblyReference.cache
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\AdvMessageBox\obj\Debug\AdvMessageBox.csproj.CoreCompileInputs.cache
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\AdvMessageBox\obj\Debug\AdvMessageBox.csproj.CopyComplete
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\AdvMessageBox\bin\Debug\hemessbox.dll
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\AdvMessageBox\bin\Debug\hemessbox.pdb
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\AdvMessageBox\obj\Debug\hemessbox.dll
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\AdvMessageBox\obj\Debug\hemessbox.pdb

Binary file not shown.

Binary file not shown.

27
Backup/AdvMessageBox.sln Normal file
View File

@ -0,0 +1,27 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdvMessageBox", "AdvMessageBox\AdvMessageBox.csproj", "{959B45CA-B413-4177-8523-340837A6CE10}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_AdvMessageBox", "Test_AdvMessageBox\Test_AdvMessageBox.csproj", "{A48DC289-14BB-47D2-BF34-DCC8598DCE23}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{959B45CA-B413-4177-8523-340837A6CE10}.Debug.ActiveCfg = Debug|.NET
{959B45CA-B413-4177-8523-340837A6CE10}.Debug.Build.0 = Debug|.NET
{959B45CA-B413-4177-8523-340837A6CE10}.Release.ActiveCfg = Release|.NET
{959B45CA-B413-4177-8523-340837A6CE10}.Release.Build.0 = Release|.NET
{A48DC289-14BB-47D2-BF34-DCC8598DCE23}.Debug.ActiveCfg = Debug|.NET
{A48DC289-14BB-47D2-BF34-DCC8598DCE23}.Debug.Build.0 = Debug|.NET
{A48DC289-14BB-47D2-BF34-DCC8598DCE23}.Release.ActiveCfg = Release|.NET
{A48DC289-14BB-47D2-BF34-DCC8598DCE23}.Release.Build.0 = Release|.NET
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,354 @@
using System;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace MsdnMag
{
// *****************************************************************
// Buttons combination
public enum MyMessageBoxButtons
{
OK = 0,
OKCancel = 1,
AbortRetryIgnore = 2,
YesNoCancel = 3,
YesNo = 4,
RetryCancel = 5,
YesNoAllCancel = 6 // NEW
}
// *****************************************************************
public class MessageBox
{
// *****************************************************************
// Properties
protected LocalCbtHook m_cbt;
protected IntPtr m_handle = IntPtr.Zero;
protected bool m_alreadySetup = false;
// *****************************************************************
// *****************************************************************
public MessageBox()
{
m_cbt = new LocalCbtHook();
m_cbt.WindowCreated += new LocalCbtHook.CbtEventHandler(WndCreated);
m_cbt.WindowDestroyed += new LocalCbtHook.CbtEventHandler(WndDestroyed);
m_cbt.WindowActivated += new LocalCbtHook.CbtEventHandler(WndActivated);
}
// *****************************************************************
// *****************************************************************
// PROPERTY IconFile
private string m_iconFile = "";
public string IconFile
{
get {return m_iconFile;}
set {m_iconFile=value; m_iconIndex=0;}
}
// *****************************************************************
// *****************************************************************
// PROPERTY YesAllNoCancel
public bool YesAllNoCancel = false;
private const int IDALL = 9; // same as IDHELP in the Win32 API
private const int MB_HELP = 0x00004000;
// *****************************************************************
// *****************************************************************
// PROPERTY IconIndex
private int m_iconIndex = 0;
public int IconIndex
{
get {return m_iconIndex;}
set {m_iconIndex=value;}
}
// *****************************************************************
// *****************************************************************
// Show
public DialogResult Show(string text, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
{
// If a custom icon is requested, ensure the window leaves room for
// the icon... Add a fake icon
if (IconFile.Length > 0 && icon == MessageBoxIcon.None)
icon = MessageBoxIcon.Information;
else
IconFile = "";
// Apply the changes needed if 4 buttons are required
if (YesAllNoCancel)
{
m_cbt.Install();
buttons = MessageBoxButtons.YesNoCancel;
// Must use MessageBox API because of the 4th button
int res = _MessageBox(GetActiveWindow(), text, title,
(int) (buttons + (int) icon + MB_HELP));
m_cbt.Uninstall();
return (DialogResult) res;
}
// Go the default way
m_cbt.Install();
DialogResult dr = System.Windows.Forms.MessageBox.Show(text, title, buttons, icon);
m_cbt.Uninstall();
return dr;
}
public DialogResult Show(string text, string title, MessageBoxButtons buttons)
{
return Show(text, title, buttons, MessageBoxIcon.None);
}
public DialogResult Show(string text, string title)
{
return Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.None);
}
public DialogResult Show(string text)
{
return Show(text, "", MessageBoxButtons.OK, MessageBoxIcon.None);
}
// *****************************************************************
// *****************************************************************
// WndCreated event handler
private void WndCreated(object sender, CbtEventArgs e)
{
if (e.IsDialogWindow)
{
m_alreadySetup = false;
Console.WriteLine("MessageBox created");
m_handle = e.Handle;
}
}
// *****************************************************************
// *****************************************************************
// WndDestroyed event handler
private void WndDestroyed(object sender, CbtEventArgs e)
{
if (e.Handle == m_handle)
{
m_alreadySetup = false;
m_handle = IntPtr.Zero;
}
}
// *****************************************************************
// *****************************************************************
// WndActivated event handler
private void WndActivated(object sender, CbtEventArgs e)
{
if (m_handle != e.Handle)
return;
// Not the first time
if (m_alreadySetup)
{
Console.WriteLine("(Already configured. Not the first time it is activated!)");
return;
}
else
m_alreadySetup = true;
//
// Modify the MessageBox window
//
Console.WriteLine("MessageBox activated");
// Replace the icon (0x0014 is the ID of the icon window)
if (m_iconFile.Length >0)
{
IntPtr hwndIcon = GetDlgItem(m_handle, 0x0014);
IntPtr hIcon = ExtractIcon(IntPtr.Zero, m_iconFile, m_iconIndex);
SendMessage(hwndIcon, STM_SETICON, hIcon, IntPtr.Zero);
}
// Get the static window with the text and the text
IntPtr hwndText = GetDlgItem(m_handle, 0xFFFF);
StringBuilder sb = new StringBuilder();
sb.Capacity = 256;
GetWindowText(hwndText, sb, 256);
string text = sb.ToString();
// Get the window position
RECT rc = new RECT();
GetWindowRect(hwndText, rc);
POINT pt = new POINT();
pt.x = rc.left;
pt.y = rc.top;
ScreenToClient(m_handle, pt);
// Create the alternate EDIT window
IntPtr m_edit = CreateWindowEx(0, "edit", "", ES_READONLY|ES_MULTILINE|WS_CHILD|WS_VISIBLE,
pt.x, pt.y, rc.right-rc.left, rc.bottom-rc.top,
m_handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
// Set font and text
IntPtr hFont = SendMessage(hwndText, WM_GETFONT, IntPtr.Zero, IntPtr.Zero);
SendMessage(m_edit, WM_SETFONT, hFont, new IntPtr(1));
SetWindowText(m_edit, text);
// Copy the displayed text to the clipboard
Clipboard.SetDataObject(text);
// Finalizing...
DestroyWindow(hwndText);
// Yes-All-No-Cancel setup
// Map the YES-NO-CANCEL-HELP sequence to YES-OK-NO-CANCEL
// The mapping has two steps: button text and button ID
// No need to change the Yes button
// Map button text
SetWindowText(GetDlgItem(m_handle,(int) DialogResult.No), "OK to All");
SetWindowText(GetDlgItem(m_handle,(int) DialogResult.Cancel), DialogResult.No.ToString());
SetWindowText(GetDlgItem(m_handle,IDALL), DialogResult.Cancel.ToString());
// Map button IDs
SetWindowLong(GetDlgItem(m_handle,(int) DialogResult.No), GWL_ID, (int)DialogResult.OK);
SetWindowLong(GetDlgItem(m_handle,(int) DialogResult.Cancel), GWL_ID, (int) DialogResult.No);
SetWindowLong(GetDlgItem(m_handle,IDALL), GWL_ID, (int) DialogResult.Cancel);
}
// *****************************************************************
#region Win32 Imports
private const int ES_READONLY = 0x00000800;
private const int ES_MULTILINE = 0x00000004;
private const int WS_VISIBLE = 0x10000000;
private const int WS_CHILD = 0x40000000;
private const int WM_SETFONT = 0x00000030;
private const int WM_GETFONT = 0x00000031;
private const int STM_SETICON = 0x00000170;
// ************************************************************************
// Win32: GetClassName
[DllImport("user32.dll")]
protected static extern int GetClassName(IntPtr hwnd,
StringBuilder lpClassName, int nMaxCount);
// ************************************************************************
// ************************************************************************
// Win32: GetDlgItem
[DllImport("user32.dll")]
protected static extern IntPtr GetDlgItem(IntPtr hwnd, int id);
// ************************************************************************
// ************************************************************************
// Win32: GetWindowText
[DllImport("user32.dll")]
protected static extern int GetWindowText(IntPtr hwnd,
StringBuilder lpString, int nMaxCount);
// ************************************************************************
// ************************************************************************
// Win32: SetWindowText
[DllImport("user32.dll")]
protected static extern bool SetWindowText(IntPtr hwnd, string text);
// ************************************************************************
// ************************************************************************
// Win32: GetWindowRect
[DllImport("user32.dll")]
protected static extern int GetWindowRect(IntPtr hwnd, RECT rc);
// ************************************************************************
// ************************************************************************
// Win32: ScreenToClient
[DllImport("user32.dll")]
protected static extern int ScreenToClient(IntPtr hwnd, POINT pt);
// ************************************************************************
// ************************************************************************
// Win32: SetWindowLong
protected const int GWL_ID = -12;
[DllImport("user32.dll")]
protected static extern int SetWindowLong(IntPtr hwnd,
int index, int newValue);
// ************************************************************************
// ************************************************************************
// Win32: ExtractIcon
[DllImport("shell32.dll")]
protected static extern IntPtr ExtractIcon(
IntPtr hInst, // instance handle
string lpszExeFileName, // file name
int nIconIndex // icon index
);
// ************************************************************************
// ************************************************************************
// Win32: DestroyWindow
[DllImport("user32.dll")]
protected static extern void DestroyWindow(IntPtr hwnd);
// ************************************************************************
// ************************************************************************
// Win32: MessageBox
[DllImport("user32.dll", EntryPoint="MessageBox")]
protected static extern int _MessageBox(IntPtr hwnd, string text, string caption,
int options);
// ************************************************************************
// ************************************************************************
// Win32: SendMessage
[DllImport("user32.dll")]
protected static extern IntPtr SendMessage(IntPtr hwnd,
int msg, IntPtr wParam, IntPtr lParam);
// ************************************************************************
// ************************************************************************
// Win32: GetActiveWindow
[DllImport("user32.dll")]
protected static extern IntPtr GetActiveWindow();
// ************************************************************************
// ************************************************************************
// Win32: CreateWindowEx
[DllImport("user32.dll")]
protected static extern IntPtr CreateWindowEx(
int dwExStyle, // extended window style
string lpClassName, // registered class name
string lpWindowName, // window name
int dwStyle, // window style
int x, // horizontal position of window
int y, // vertical position of window
int nWidth, // window width
int nHeight, // window height
IntPtr hWndParent, // handle to parent or owner window
IntPtr hMenu, // menu handle or child identifier
IntPtr hInstance, // handle to application instance
IntPtr lpParam // window-creation data
);
// ************************************************************************
// ************************************************************************
// POINT
[StructLayout(LayoutKind.Sequential)]
public class POINT
{
public int x;
public int y;
}
// ************************************************************************
// ************************************************************************
// RECT
[StructLayout(LayoutKind.Sequential)]
public class RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
// ************************************************************************
#endregion
}
}

View File

@ -0,0 +1,103 @@
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.0.9466"
SchemaVersion = "1.0"
ProjectGuid = "{959B45CA-B413-4177-8523-340837A6CE10}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "AdvMessageBox"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Library"
RootNamespace = ""
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "true"
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll"
/>
<Reference
Name = "System.Windows.Forms"
AssemblyName = "System.Windows.Forms"
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll"
/>
<Reference
Name = "CbtHook"
AssemblyName = "CbtHook"
HintPath = "bin\Debug\CbtHook.dll"
/>
<Reference
Name = "WindowsHook"
AssemblyName = "WindowsHook"
HintPath = "bin\Debug\WindowsHook.dll"
/>
<Reference
Name = "System.Drawing"
AssemblyName = "System.Drawing"
HintPath = "..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "AssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "AdvMessageBox.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>

View File

@ -0,0 +1,58 @@
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,58 @@
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]

View File

@ -0,0 +1,99 @@
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using MsdnMag;
namespace TestMsgBox
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button ButtonTest;
private System.Windows.Forms.Button btnYesAllNoCancel;
private MsdnMag.MessageBox msg;
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.ButtonTest = new System.Windows.Forms.Button();
this.btnYesAllNoCancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// ButtonTest
//
this.ButtonTest.Location = new System.Drawing.Point(16, 16);
this.ButtonTest.Name = "ButtonTest";
this.ButtonTest.Size = new System.Drawing.Size(312, 24);
this.ButtonTest.TabIndex = 0;
this.ButtonTest.Text = "Test MsdnMag.MessageBox";
this.ButtonTest.Click += new System.EventHandler(this.ButtonTest_Click);
//
// btnYesAllNoCancel
//
this.btnYesAllNoCancel.Location = new System.Drawing.Point(16, 48);
this.btnYesAllNoCancel.Name = "btnYesAllNoCancel";
this.btnYesAllNoCancel.Size = new System.Drawing.Size(312, 24);
this.btnYesAllNoCancel.TabIndex = 1;
this.btnYesAllNoCancel.Text = "Test Yes-All-No-Cancel";
this.btnYesAllNoCancel.Click += new System.EventHandler(this.btnYesAllNoCancel_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(344, 93);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.btnYesAllNoCancel,
this.ButtonTest});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "Form1";
this.Text = "Testing MessageBox";
this.ResumeLayout(false);
}
#endregion
public Form1()
{
InitializeComponent();
msg = new MsdnMag.MessageBox();
}
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void ButtonTest_Click(object sender, System.EventArgs e)
{
msg.IconFile = "shell32.dll";
msg.IconIndex = 41;
msg.YesAllNoCancel = false;
DialogResult dr = msg.Show("Hello, managed world!", "Cutting Edge",
MessageBoxButtons.OK);
Console.WriteLine(dr.ToString());
}
private void btnYesAllNoCancel_Click(object sender, System.EventArgs e)
{
msg.IconFile = "shell32.dll";
msg.IconIndex = 41;
msg.YesAllNoCancel = true;
DialogResult dr = msg.Show("Hello, managed world!", "Cutting Edge");
Console.WriteLine(dr.ToString());
}
}
}

View File

@ -0,0 +1,107 @@
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.0.9466"
SchemaVersion = "1.0"
ProjectGuid = "{A48DC289-14BB-47D2-BF34-DCC8598DCE23}"
>
<Build>
<Settings
ApplicationIcon = "App.ico"
AssemblyKeyContainerName = ""
AssemblyName = "Test_AdvMessageBox"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "WinExe"
RootNamespace = "Test_AdvMessageBox"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "true"
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll"
/>
<Reference
Name = "System.Drawing"
AssemblyName = "System.Drawing"
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll"
/>
<Reference
Name = "System.Windows.Forms"
AssemblyName = "System.Windows.Forms"
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll"
/>
<Reference
Name = "AdvMessageBox"
AssemblyName = "AdvMessageBox"
HintPath = "..\AdvMessageBox\bin\Debug\AdvMessageBox.dll"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "App.ico"
BuildAction = "Content"
/>
<File
RelPath = "AssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Test_AdvMessageBox.cs"
SubType = "Form"
BuildAction = "Compile"
/>
<File
RelPath = "Test_AdvMessageBox.resx"
DependentUpon = "Test_AdvMessageBox.cs"
BuildAction = "EmbeddedResource"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>

View File

@ -0,0 +1,48 @@
<VisualStudioProject>
<CSHARP>
<Build>
<Settings ReferencePath = "D:\Articles\MSDN Magazine\Cutting Edge\Hooks in .NET\Source\Hooks\C#\MsgBox\MsgBoxCbtHook\bin\Debug\;D:\Articles\MSDN Magazine\Cutting Edge\Hooks in .NET\Source\SelectableMsgBox\MsgBoxCbtHook\bin\Debug\;C:\My Labs\SelectableMsgBox\MsgBoxCbtHook\bin\Debug\;D:\Articles\MSDN Magazine\Cutting Edge\Selectable MessageBox\Source\SelectableMsgBox\MsgBoxCbtHook\bin\Debug\" >
<Config
Name = "Debug"
EnableASPDebugging = "false"
EnableASPXDebugging = "false"
EnableUnmanagedDebugging = "false"
EnableSQLServerDebugging = "false"
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
StartArguments = ""
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
StartWithIE = "false"
/>
<Config
Name = "Release"
EnableASPDebugging = "false"
EnableASPXDebugging = "false"
EnableUnmanagedDebugging = "false"
EnableSQLServerDebugging = "false"
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
StartArguments = ""
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
StartWithIE = "false"
/>
</Settings>
</Build>
<OtherProjectSettings
CopyProjectDestinationFolder = ""
CopyProjectUncPath = ""
CopyProjectOption = "0"
ProjectView = "ProjectFiles"
ProjectTrust = "0"
/>
</CSHARP>
</VisualStudioProject>

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="$this.Name">
<value>Form1</value>
</data>
</root>

BIN
CuttingEdge0211.exe Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>

144
Test_AdvMessageBox/Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,144 @@
namespace Test_AdvMessageBox
{
partial class Form1
{
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Vom Windows Form-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
this.buttonTest2 = new System.Windows.Forms.Button();
this.groupBoxProgramInfo = new System.Windows.Forms.GroupBox();
this.labelProgramInfo = new System.Windows.Forms.Label();
this.groupBoxDLLInfo = new System.Windows.Forms.GroupBox();
this.labelDLLInfo = new System.Windows.Forms.Label();
this.buttonTest1 = new System.Windows.Forms.Button();
this.labelResult = new System.Windows.Forms.Label();
this.groupBoxProgramInfo.SuspendLayout();
this.groupBoxDLLInfo.SuspendLayout();
this.SuspendLayout();
//
// buttonTest2
//
this.buttonTest2.Location = new System.Drawing.Point(12, 287);
this.buttonTest2.Name = "buttonTest2";
this.buttonTest2.Size = new System.Drawing.Size(776, 23);
this.buttonTest2.TabIndex = 1;
this.buttonTest2.Text = "MessageBox with custommer icon and Yes-All-No-Cancel Buttons";
this.buttonTest2.UseVisualStyleBackColor = true;
this.buttonTest2.Click += new System.EventHandler(this.buttonTest2_Click);
//
// groupBoxProgramInfo
//
this.groupBoxProgramInfo.Controls.Add(this.labelProgramInfo);
this.groupBoxProgramInfo.Location = new System.Drawing.Point(12, 372);
this.groupBoxProgramInfo.Name = "groupBoxProgramInfo";
this.groupBoxProgramInfo.Size = new System.Drawing.Size(385, 66);
this.groupBoxProgramInfo.TabIndex = 11;
this.groupBoxProgramInfo.TabStop = false;
this.groupBoxProgramInfo.Text = "Programm Information";
//
// labelProgramInfo
//
this.labelProgramInfo.AutoSize = true;
this.labelProgramInfo.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.labelProgramInfo.Location = new System.Drawing.Point(7, 20);
this.labelProgramInfo.Name = "labelProgramInfo";
this.labelProgramInfo.Size = new System.Drawing.Size(16, 13);
this.labelProgramInfo.TabIndex = 0;
this.labelProgramInfo.Text = "...";
//
// groupBoxDLLInfo
//
this.groupBoxDLLInfo.Controls.Add(this.labelDLLInfo);
this.groupBoxDLLInfo.Location = new System.Drawing.Point(403, 372);
this.groupBoxDLLInfo.Name = "groupBoxDLLInfo";
this.groupBoxDLLInfo.Size = new System.Drawing.Size(385, 66);
this.groupBoxDLLInfo.TabIndex = 12;
this.groupBoxDLLInfo.TabStop = false;
this.groupBoxDLLInfo.Text = "DLL Information";
//
// labelDLLInfo
//
this.labelDLLInfo.AutoSize = true;
this.labelDLLInfo.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.labelDLLInfo.Location = new System.Drawing.Point(7, 20);
this.labelDLLInfo.Name = "labelDLLInfo";
this.labelDLLInfo.Size = new System.Drawing.Size(16, 13);
this.labelDLLInfo.TabIndex = 0;
this.labelDLLInfo.Text = "...";
//
// buttonTest1
//
this.buttonTest1.Location = new System.Drawing.Point(12, 258);
this.buttonTest1.Name = "buttonTest1";
this.buttonTest1.Size = new System.Drawing.Size(776, 23);
this.buttonTest1.TabIndex = 0;
this.buttonTest1.Text = "MessageBox with customer icon";
this.buttonTest1.UseVisualStyleBackColor = true;
this.buttonTest1.Click += new System.EventHandler(this.buttonTest1_Click);
//
// labelResult
//
this.labelResult.AutoSize = true;
this.labelResult.Location = new System.Drawing.Point(12, 13);
this.labelResult.Name = "labelResult";
this.labelResult.Size = new System.Drawing.Size(16, 13);
this.labelResult.TabIndex = 14;
this.labelResult.Text = "...";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.labelResult);
this.Controls.Add(this.buttonTest1);
this.Controls.Add(this.groupBoxProgramInfo);
this.Controls.Add(this.groupBoxDLLInfo);
this.Controls.Add(this.buttonTest2);
this.Name = "Form1";
this.Text = "Test_InfoBox";
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBoxProgramInfo.ResumeLayout(false);
this.groupBoxProgramInfo.PerformLayout();
this.groupBoxDLLInfo.ResumeLayout(false);
this.groupBoxDLLInfo.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button buttonTest2;
private System.Windows.Forms.GroupBox groupBoxProgramInfo;
private System.Windows.Forms.Label labelProgramInfo;
private System.Windows.Forms.GroupBox groupBoxDLLInfo;
private System.Windows.Forms.Label labelDLLInfo;
private System.Windows.Forms.Button buttonTest1;
private System.Windows.Forms.Label labelResult;
}
}

159
Test_AdvMessageBox/Form1.cs Normal file
View File

@ -0,0 +1,159 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MsdnMag;
namespace Test_AdvMessageBox
{
public partial class Form1 : Form
{
#region Version und Copyright
// Version und Copyright
string programName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen
string programVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
static object[] attributes = System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
string copyright = GenerateCopyright();
string icon = Application.StartupPath + "\\Info.bmp";
//Assembly Datum und Zeit
static DateTime value = AssemblyDateTime();
string date = value.ToShortDateString();
string time = value.ToLongTimeString();
private static DateTime AssemblyDateTime()
{
var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
var buildDateTime = new DateTime(2000, 1, 1).Add(new TimeSpan(TimeSpan.TicksPerDay * version.Build + TimeSpan.TicksPerSecond * 2 * version.Revision));
//Tage seit dem 1. Januar 2000 und Sekunden seit Mitternacht, (multiplizier mit 2 ergibt das Original)
return buildDateTime;
}
private static string CurrentYear()
{
DateTime dtn = DateTime.Now;
return dtn.Year.ToString();
}
private static string StartYear()
{
//string startYear = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
//return startYear.Remove(0, startYear.LastIndexOf(" ") + 1);
string startYear = "";
if (((AssemblyCopyrightAttribute)attributes[0]).Copyright.Contains("Copyright © "))
{
startYear = ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace("Copyright © ", "");
while (startYear.StartsWith(" "))
{
startYear = startYear.Remove(0, 1);
}
startYear = startYear.Remove(startYear.IndexOf(" "));
return startYear;
}
else
{
DateTime dtn = DateTime.Now;
return dtn.Year.ToString();
}
}
private static string GenerateCopyright()
{
string startYear = StartYear();
string currentYear = CurrentYear();
if (startYear == currentYear)
{
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
else
{
//return String.Concat(((AssemblyCopyrightAttribute)attributes[0]).Copyright, "-", currentYear);
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace(startYear, String.Concat(startYear, "-", currentYear));
}
}
#endregion
#region Programm-Info
/// <summary>
/// Contains the name of the program file
/// </summary>
public static string ProgramName { set; get; }
/// <summary>
/// Contains the version of the program file
/// </summary>
public static string ProgramVersion { set; get; }
/// <summary>
/// Contains the copyright notice
/// </summary>
public static string Copyright { set; get; }
private void SetProgramInfo()
{
//Name, Version und Copyright setzen
ProgramName = programName;
ProgramVersion = programVersion;
Copyright = copyright;
}
#endregion
public Form1()
{
SetProgramInfo();
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
ShowInformation(); //Programm- und DLL-Information anzeigen
}
private void ShowInformation()
{
labelProgramInfo.Text = String.Concat(ProgramName, "\n", ProgramVersion, "\n", Copyright); //Programm-Information anzeigen
// DLL-Information anzeigen
labelDLLInfo.Text = String.Concat(MsdnMag.MessageBox.DllName, "\n", MsdnMag.MessageBox.DllVersion, "\n", MsdnMag.MessageBox.Copyright);
}
MsdnMag.MessageBox msg = new MsdnMag.MessageBox();
private void buttonTest1_Click(object sender, EventArgs e)
{
//
// Diese Zeilen gehört in das Programm kopiert
//
msg.IconFile = "shell32.dll";
msg.IconIndex = 41;
msg.YesAllNoCancel = false;
DialogResult dr = msg.Show("Hello, managed world!", "Cutting Edge", MessageBoxButtons.OK);
labelResult.Text = dr.ToString();
//
//
}
private void buttonTest2_Click(object sender, EventArgs e)
{
//
// Diese Zeilen gehört in das Programm kopiert
//
msg.IconFile = "shell32.dll";
msg.IconIndex = 41;
msg.YesAllNoCancel = true;
DialogResult dr = msg.Show("Hello, managed world!", "Cutting Edge");
labelResult.Text = dr.ToString();
//
//
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Test_AdvMessageBox
{
internal static class Program
{
/// <summary>
/// Der Haupteinstiegspunkt für die Anwendung.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("Test_AdvMessageBox")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Test_AdvMessageBox")]
[assembly: AssemblyCopyright("Copyright © 2022 by Eugen Höglinger")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("3916ad4c-ebfe-4eb3-b9fa-1dae51f2bf92")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
namespace Test_AdvMessageBox.Properties
{
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if (object.ReferenceEquals(resourceMan, null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Test_AdvMessageBox.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test_AdvMessageBox.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3916AD4C-EBFE-4EB3-B9FA-1DAE51F2BF92}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Test_AdvMessageBox</RootNamespace>
<AssemblyName>Test_AdvMessageBox</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>false</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="hemessbox">
<HintPath>..\AdvMessageBox\bin\Debug\hemessbox.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]

View File

@ -0,0 +1 @@
9210c5222624b1f42d96fc58b7bec9daf4c0ab13

View File

@ -0,0 +1,16 @@
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\bin\Debug\Test_AdvMessageBox.exe.config
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\bin\Debug\Test_AdvMessageBox.exe
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\bin\Debug\Test_AdvMessageBox.pdb
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\bin\Debug\hemessbox.dll
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\bin\Debug\CbtHook.dll
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\bin\Debug\WindowsHook.dll
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\bin\Debug\hemessbox.pdb
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\obj\Debug\Test_AdvMessageBox.csproj.AssemblyReference.cache
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\obj\Debug\Test_AdvMessageBox.csproj.SuggestedBindingRedirects.cache
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\obj\Debug\Test_AdvMessageBox.Form1.resources
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\obj\Debug\Test_AdvMessageBox.Properties.Resources.resources
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\obj\Debug\Test_AdvMessageBox.csproj.GenerateResource.cache
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\obj\Debug\Test_AdvMessageBox.csproj.CoreCompileInputs.cache
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\obj\Debug\Test_AdvMessageBox.csproj.CopyComplete
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\obj\Debug\Test_AdvMessageBox.exe
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\AdvMessageBox.git\Test_AdvMessageBox\obj\Debug\Test_AdvMessageBox.pdb

Binary file not shown.

Binary file not shown.

BIN
UpgradeLog.htm Normal file

Binary file not shown.