Skip to content

Commit c7e3257

Browse files
author
Haroon Khan
committed
Add Project files for Visual Studio Automation
1 parent 26a2832 commit c7e3257

File tree

4 files changed

+160
-0
lines changed

4 files changed

+160
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
4+
namespace MessageFilterImpl
5+
{
6+
[ComImport]
7+
[Guid("00000016-0000-0000-C000-000000000046")]
8+
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
9+
public interface IOleMessageFilter
10+
{
11+
[PreserveSig]
12+
int HandleInComingCall(int dwCallType, IntPtr hTaskCaller,
13+
int dwTickCount, IntPtr lpInterfaceInfo);
14+
[PreserveSig]
15+
int RetryRejectedCall(IntPtr hTaskCallee, int dwTickCout, int dwRejectType);
16+
17+
[PreserveSig]
18+
int MessagePending(IntPtr hTaskCallee, int dwTickCount, int dwPendingType);
19+
}
20+
}

MessageFilterImpl/MessageFilter.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
4+
namespace MessageFilterImpl
5+
{
6+
public class MessageFilter : IOleMessageFilter
7+
{
8+
[DllImport("Ole32.dll")]
9+
private static extern int CoRegisterMessageFilter(IOleMessageFilter hTaskCallee, out IOleMessageFilter oldFilter);
10+
11+
12+
13+
#region IOleMessageFilter Members
14+
15+
int IOleMessageFilter.HandleInComingCall(int dwCallType, IntPtr hTaskCaller, int dwTickCount, IntPtr lpInterfaceInfo)
16+
{
17+
return 0;
18+
}
19+
20+
int IOleMessageFilter.RetryRejectedCall(IntPtr hTaskCallee, int dwTickCout, int dwRejectType)
21+
{
22+
if (dwRejectType==2){
23+
return 99;
24+
}
25+
return -1;
26+
}
27+
28+
int IOleMessageFilter.MessagePending(IntPtr hTaskCallee, int dwTickCount, int dwPendingType)
29+
{
30+
return 2;
31+
}
32+
33+
#endregion
34+
35+
36+
public static void Register()
37+
{
38+
var newFilter = new MessageFilter() as IOleMessageFilter;
39+
var oldFilter = null as IOleMessageFilter;
40+
CoRegisterMessageFilter(newFilter, out oldFilter);
41+
}
42+
43+
public static void Revoke()
44+
{
45+
var oldFilter = null as IOleMessageFilter;
46+
CoRegisterMessageFilter(null, out oldFilter);
47+
}
48+
}
49+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{39BDC5ED-9DD1-45B3-84DF-170806968898}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>MessageFilterImpl</RootNamespace>
12+
<AssemblyName>MessageFilterImpl</AssemblyName>
13+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>pdbonly</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release\</OutputPath>
29+
<DefineConstants>TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<Reference Include="System" />
35+
<Reference Include="System.Core" />
36+
<Reference Include="System.Xml.Linq" />
37+
<Reference Include="System.Data.DataSetExtensions" />
38+
<Reference Include="Microsoft.CSharp" />
39+
<Reference Include="System.Data" />
40+
<Reference Include="System.Xml" />
41+
</ItemGroup>
42+
<ItemGroup>
43+
<Compile Include="IOleMessageFilter.cs" />
44+
<Compile Include="MessageFilter.cs" />
45+
<Compile Include="Properties\AssemblyInfo.cs" />
46+
</ItemGroup>
47+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
48+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
49+
Other similar extension points exist, see Microsoft.Common.targets.
50+
<Target Name="BeforeBuild">
51+
</Target>
52+
<Target Name="AfterBuild">
53+
</Target>
54+
-->
55+
</Project>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("MessageFilterImpl")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("Microsoft")]
12+
[assembly: AssemblyProduct("MessageFilterImpl")]
13+
[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("a9c859cb-be21-40f3-af6f-02fbd110bfa4")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)