소스 검색

added new Addin DittoUtil

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@461 595ec19a-5cb4-439b-94a8-42fb3063c22c
sabrogden 16 년 전
부모
커밋
00df5a4c49

+ 110 - 0
Addins/DittoUtil/DialogResizer.cpp

@@ -0,0 +1,110 @@
+// DialogResizer.cpp: implementation of the CDialogResizer class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "DialogResizer.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+
+CDialogResizer::CDialogResizer()
+{
+
+}
+
+CDialogResizer::~CDialogResizer()
+{
+
+}
+
+void CDialogResizer::SetParent(HWND hWndParent)
+{
+	m_hWndParent = hWndParent;
+	CRect cr;
+	GetClientRect(m_hWndParent, cr);
+
+	m_DlgSize.cx = cr.Width();
+	m_DlgSize.cy = cr.Height();
+}
+
+void CDialogResizer::AddControl(int nControlID, int nFlags)
+{
+	HWND hWnd = GetDlgItem(m_hWndParent, nControlID);
+	if(hWnd)
+		AddControl(hWnd, nFlags);
+}
+
+void CDialogResizer::AddControl(HWND hWnd, int nFlags)
+{
+	CDR_Data data;
+	data.m_hWnd = hWnd;
+	data.m_nFlags = nFlags;
+
+
+	m_Controls.Add(data);
+}
+
+void CDialogResizer::MoveControls(CSize csNewSize)
+{
+	int nDeltaX = csNewSize.cx - m_DlgSize.cx;
+	int nDeltaY = csNewSize.cy - m_DlgSize.cy;
+
+	if(nDeltaX == 0 && nDeltaY == 0)
+		return;
+
+	m_DlgSize = csNewSize;
+
+	int nCount = (int)m_Controls.GetSize();
+	CRect rc;
+	CRect rcParent;
+
+	GetClientRect(m_hWndParent, rcParent);
+
+	for(int i = 0; i < nCount; i++)
+	{
+		CDR_Data data = m_Controls[i];
+
+		GetWindowRect(data.m_hWnd, rc);
+		MapWindowPoints(GetDesktopWindow(),  m_hWndParent, (LPPOINT)&rc, 2 );
+		
+		//
+		//	Adjust the window horizontally
+		if( data.m_nFlags & DR_MoveLeft )
+		{
+			rc.left += nDeltaX;
+			rc.right += nDeltaX;
+		}
+
+		//
+		//	Adjust the window vertically
+		if( data.m_nFlags & DR_MoveTop )
+		{
+			rc.top += nDeltaY;
+			rc.bottom += nDeltaY;
+		}
+
+		//
+		//	Size the window horizontally
+		if( data.m_nFlags & DR_SizeWidth )
+		{
+			rc.right += nDeltaX;
+		}
+
+		//	Size the window vertically
+		if( data.m_nFlags & DR_SizeHeight )
+		{
+			rc.bottom += nDeltaY;
+		}
+
+		::SetWindowPos(data.m_hWnd, NULL, rc.left, rc.top, rc.Width(), rc.Height(), SWP_NOACTIVATE | SWP_NOZORDER);
+	}
+}

+ 54 - 0
Addins/DittoUtil/DialogResizer.h

@@ -0,0 +1,54 @@
+// DialogResizer.h: interface for the CDialogResizer class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_DIALOGRESIZER_H__DA9AF3FF_C6CC_4D70_965A_4216A0EC9E75__INCLUDED_)
+#define AFX_DIALOGRESIZER_H__DA9AF3FF_C6CC_4D70_965A_4216A0EC9E75__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include <afxtempl.h>
+
+#define DR_MoveLeft			 1
+#define DR_MoveTop			 2
+#define DR_SizeWidth		 4
+#define DR_SizeHeight		 8
+
+class CDialogResizer  
+{
+public:
+	CDialogResizer();
+	virtual ~CDialogResizer();
+
+protected:
+	class CDR_Data
+	{
+	public:
+		CDR_Data()
+		{			
+			m_nFlags = 0;
+		}
+		HWND m_hWnd;
+		int m_nFlags;
+	};
+
+public:
+	void MoveControls(CSize csNewSize);
+
+	void AddControl(int nControlID, int nFlags);
+	void AddControl(HWND hWnd, int nFlags);
+
+	void SetParent(HWND hWndParent);
+
+protected:
+
+	CArray< CDR_Data, CDR_Data > m_Controls;
+	CSize m_DlgSize;
+	HWND m_hWndParent;
+
+protected:
+};
+
+#endif // !defined(AFX_DIALOGRESIZER_H__DA9AF3FF_C6CC_4D70_965A_4216A0EC9E75__INCLUDED_)

+ 73 - 0
Addins/DittoUtil/DittoUtil.cpp

@@ -0,0 +1,73 @@
+// DittoUtil.cpp : Defines the initialization routines for the DLL.
+//
+
+#include "stdafx.h"
+#include "DittoUtil.h"
+#include "PasteImageAsHtmlImage.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+//
+//	Note!
+//
+//		If this DLL is dynamically linked against the MFC
+//		DLLs, any functions exported from this DLL which
+//		call into MFC must have the AFX_MANAGE_STATE macro
+//		added at the very beginning of the function.
+//
+//		For example:
+//
+//		extern "C" BOOL PASCAL EXPORT ExportedFunction()
+//		{
+//			AFX_MANAGE_STATE(AfxGetStaticModuleState());
+//			// normal function body here
+//		}
+//
+//		It is very important that this macro appear in each
+//		function, prior to any calls into MFC.  This means that
+//		it must appear as the first statement within the 
+//		function, even before any object variable declarations
+//		as their constructors may generate calls into the MFC
+//		DLL.
+//
+//		Please see MFC Technical Notes 33 and 58 for additional
+//		details.
+//
+
+// CDittoUtilApp
+
+BEGIN_MESSAGE_MAP(CDittoUtilApp, CWinApp)
+END_MESSAGE_MAP()
+
+
+// CDittoUtilApp construction
+
+CDittoUtilApp::CDittoUtilApp()
+{
+	// TODO: add construction code here,
+	// Place all significant initialization in InitInstance
+}
+
+
+// The one and only CDittoUtilApp object
+
+CDittoUtilApp theApp;
+
+
+// CDittoUtilApp initialization
+
+BOOL CDittoUtilApp::InitInstance()
+{
+	CWinApp::InitInstance();
+
+	return TRUE;
+}
+
+int CDittoUtilApp::ExitInstance()
+{
+	CPasteImageAsHtmlImage::CleanupPastedImages();
+
+	return CWinApp::ExitInstance();
+}

+ 6 - 0
Addins/DittoUtil/DittoUtil.def

@@ -0,0 +1,6 @@
+; DittoUtil.def : Declares the module parameters for the DLL.
+
+LIBRARY      "DittoUtil"
+
+EXPORTS
+    ; Explicit exports can go here

+ 28 - 0
Addins/DittoUtil/DittoUtil.h

@@ -0,0 +1,28 @@
+// DittoUtil.h : main header file for the DittoUtil DLL
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+	#error include 'stdafx.h' before including this file for PCH
+#endif
+
+#include "resource.h"		// main symbols
+
+
+// CDittoUtilApp
+// See DittoUtil.cpp for the implementation of this class
+//
+
+class CDittoUtilApp : public CWinApp
+{
+public:
+	CDittoUtilApp();
+
+// Overrides
+public:
+	virtual BOOL InitInstance();
+	virtual BOOL ExitInstance();
+
+	DECLARE_MESSAGE_MAP()
+};

+ 161 - 0
Addins/DittoUtil/DittoUtil.rc

@@ -0,0 +1,161 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE 
+BEGIN
+    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+    "#define _AFX_NO_OLE_RESOURCES\r\n"
+    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+    "\r\n"
+    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+    "LANGUAGE 9, 1\r\n"
+    "#pragma code_page(1252)\r\n"
+    "#include ""res\\DittoUtil.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
+    "#include ""afxres.rc""     // Standard components\r\n"
+    "#endif\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904e4"
+        BEGIN
+            VALUE "CompanyName", "TODO: <Company name>"
+            VALUE "FileDescription", "TODO: <File description>"
+            VALUE "FileVersion", "1.0.0.1"
+            VALUE "InternalName", "DittoUtil.dll"
+            VALUE "LegalCopyright", "TODO: (c) <Company name>.  All rights reserved."
+            VALUE "OriginalFilename", "DittoUtil.dll"
+            VALUE "ProductName", "TODO: <Product name>"
+            VALUE "ProductVersion", "1.0.0.1"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1252
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_DIALOG_SELECT_FORMAT DIALOGEX 0, 0, 353, 195
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | 
+    WS_THICKFRAME
+CAPTION "Dialog"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+    DEFPUSHBUTTON   "OK",IDOK,242,174,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,296,174,50,14
+    LISTBOX         IDC_LIST1,7,25,339,141,LBS_SORT | LBS_NOINTEGRALHEIGHT | 
+                    WS_VSCROLL | WS_TABSTOP
+    LTEXT           "Select the clip to paste the clip data as text",
+                    IDC_STATIC,9,8,335,15
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO 
+BEGIN
+    IDD_DIALOG_SELECT_FORMAT, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 346
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 188
+    END
+END
+#endif    // APSTUDIO_INVOKED
+
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#include "res\DittoUtil.rc2"  // non-Microsoft Visual C++ edited resources
+#include "afxres.rc"     // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+

+ 23 - 0
Addins/DittoUtil/DittoUtil.sln

@@ -0,0 +1,23 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DittoUtil", "DittoUtil.vcproj", "{CF8F6379-5340-4494-8E59-2807ADF37B95}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfiguration) = preSolution
+		Debug = Debug
+		Release = Release
+	EndGlobalSection
+	GlobalSection(ProjectDependencies) = postSolution
+	EndGlobalSection
+	GlobalSection(ProjectConfiguration) = postSolution
+		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Debug.ActiveCfg = Debug|Win32
+		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Debug.Build.0 = Debug|Win32
+		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Release.ActiveCfg = Release|Win32
+		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Release.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+	EndGlobalSection
+	GlobalSection(ExtensibilityAddIns) = postSolution
+	EndGlobalSection
+EndGlobal

+ 223 - 0
Addins/DittoUtil/DittoUtil.vcproj

@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="DittoUtil"
+	ProjectGUID="{CF8F6379-5340-4494-8E59-2807ADF37B95}"
+	Keyword="MFCDLLProj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="2"
+			UseOfMFC="2"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;UNICODE"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				TreatWChar_tAsBuiltInType="TRUE"
+				UsePrecompiledHeader="3"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/DittoUtil.dll"
+				LinkIncremental="2"
+				ModuleDefinitionFile=".\DittoUtil.def"
+				GenerateDebugInformation="TRUE"
+				SubSystem="2"
+				ImportLibrary="$(OutDir)/DittoUtil.lib"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="FALSE"/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="copy $(OutDir)\*.dll ..\..\Debug\Addins"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="2"
+			UseOfMFC="2"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;UNICODE"
+				RuntimeLibrary="2"
+				TreatWChar_tAsBuiltInType="TRUE"
+				UsePrecompiledHeader="3"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/DittoUtil.dll"
+				LinkIncremental="1"
+				ModuleDefinitionFile=".\DittoUtil.def"
+				GenerateDebugInformation="TRUE"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				ImportLibrary="$(OutDir)/DittoUtil.lib"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="FALSE"/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="copy $(OutDir)\*.dll ..\..\Release\Addins"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+			<File
+				RelativePath=".\DialogResizer.cpp">
+			</File>
+			<File
+				RelativePath=".\DittoUtil.cpp">
+			</File>
+			<File
+				RelativePath=".\DittoUtil.def">
+			</File>
+			<File
+				RelativePath=".\Exports.cpp">
+			</File>
+			<File
+				RelativePath=".\PasteAnyAsText.cpp">
+			</File>
+			<File
+				RelativePath=".\PasteImageAsHtmlImage.cpp">
+			</File>
+			<File
+				RelativePath=".\SelectPasteFormat.cpp">
+			</File>
+			<File
+				RelativePath=".\stdafx.cpp">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\TextConvert.cpp">
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+			<File
+				RelativePath=".\DialogResizer.h">
+			</File>
+			<File
+				RelativePath=".\DittoUtil.h">
+			</File>
+			<File
+				RelativePath=".\Exports.h">
+			</File>
+			<File
+				RelativePath=".\PasteAnyAsText.h">
+			</File>
+			<File
+				RelativePath=".\PasteImageAsHtmlImage.h">
+			</File>
+			<File
+				RelativePath=".\Resource.h">
+			</File>
+			<File
+				RelativePath=".\SelectPasteFormat.h">
+			</File>
+			<File
+				RelativePath=".\stdafx.h">
+			</File>
+			<File
+				RelativePath=".\TextConvert.h">
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+			<File
+				RelativePath=".\DittoUtil.rc">
+			</File>
+			<File
+				RelativePath=".\res\DittoUtil.rc2">
+			</File>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt">
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

+ 58 - 0
Addins/DittoUtil/Exports.cpp

@@ -0,0 +1,58 @@
+#include "StdAfx.h"
+#include ".\exports.h"
+#include "PasteAnyAsText.h"
+#include ".\pasteimageashtmlimage.h"
+
+
+bool DittoAddin(const CDittoInfo &DittoInfo, CDittoAddinInfo &info)
+{
+	if(DittoInfo.ValidateSize() == false || info.ValidateSize() == false)
+	{
+		CString csError;
+		csError.Format(_T("PasteAnyAsText Addin - Passed in structures are of different size, DittoInfo Passed: %d, Local: %d, DittoAddinInfo Passed: %d, Local: %d"), DittoInfo.m_nSizeOfThis, sizeof(CDittoInfo), info.m_nSizeOfThis, sizeof(CDittoAddinInfo));
+		OutputDebugString(csError);
+		return false;
+	}
+
+	info.m_Name = _T("Ditto Utils");
+	info.m_AddinVersion = 1;
+
+	return true;
+}
+
+bool SupportedFunctions(const CDittoInfo &DittoInfo, FunctionType type, std::vector<CFunction> &Functions)
+{
+	switch(type)
+	{
+	case eFuncType_PRE_PASTE:
+		{
+			CFunction func;
+			func.m_csFunction = _T("PasteAnyAsText");
+			func.m_csDisplayName = _T("Paste Any Clip As Text");
+			func.m_csDetailDescription = _T("Displays a list of clip formats allowing you to select one and paste the contents as text");
+
+			Functions.push_back(func);
+
+			CFunction func2;
+			func2.m_csFunction = _T("ConvertPathToHtmlImageTag");
+			func2.m_csDisplayName = _T("Past As html image link");
+			func2.m_csDetailDescription = _T("Converts a CF_DIB or CF_HDROP to a html format for pasting into outlook express");
+
+			Functions.push_back(func2);
+		}
+		break;
+	}
+	
+	return true;
+}
+
+bool PasteAnyAsText(const CDittoInfo &DittoInfo, IClip *pClip)
+{
+	return PasteAnyAsText::SelectClipToPasteAsText(DittoInfo, pClip);
+}
+
+bool ConvertPathToHtmlImageTag(const CDittoInfo &DittoInfo, IClip *pClip)
+{
+	CPasteImageAsHtmlImage convert;
+	return convert.ConvertPathToHtmlImageTag(DittoInfo, pClip);
+}

+ 13 - 0
Addins/DittoUtil/Exports.h

@@ -0,0 +1,13 @@
+#pragma once
+
+#include "..\..\Shared\DittoDefines.h"
+#include "..\..\Shared\IClip.h"
+#include <vector>
+
+extern "C" 
+{
+	bool __declspec(dllexport) DittoAddin(const CDittoInfo &DittoInfo, CDittoAddinInfo &info);
+	bool __declspec(dllexport) SupportedFunctions(const CDittoInfo &DittoInfo, FunctionType type, std::vector<CFunction> &Functions);
+	bool __declspec(dllexport) PasteAnyAsText(const CDittoInfo &DittoInfo, IClip *pClip);	
+	bool __declspec(dllexport) ConvertPathToHtmlImageTag(const CDittoInfo &DittoInfo, IClip *pClip);
+}

+ 53 - 0
Addins/DittoUtil/PasteAnyAsText.cpp

@@ -0,0 +1,53 @@
+#include "StdAfx.h"
+#include ".\pasteanyastext.h"
+#include "SelectPasteFormat.h"
+
+PasteAnyAsText::PasteAnyAsText(void)
+{
+}
+
+PasteAnyAsText::~PasteAnyAsText(void)
+{
+}
+
+bool PasteAnyAsText::SelectClipToPasteAsText(const CDittoInfo &DittoInfo, IClip *pClip)
+{
+	bool ret = false;
+	AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+	IClipFormats *pFormats = pClip->Clips();
+
+	CWnd* pWnd = CWnd::FromHandle(DittoInfo.m_hWndDitto);
+	CSelectPasteFormat dlg(pWnd, pFormats);
+
+	if(dlg.DoModal() == IDOK)
+	{
+		//Find the format that was selected, remove all then readd the data as type CF_TEXT
+		CLIPFORMAT format = dlg.SelectedFormat();
+		if(format > 0)
+		{
+			IClipFormat *pText = pFormats->FindFormatEx(format);
+			if(pText != NULL)
+			{
+				//We own the data, when we call DeleteAll tell it to not free the data
+				pText->AutoDeleteData(false);
+				HGLOBAL data = pText->Data();
+
+				//Remove all over formats and add the selected date back as CF_TEXT
+				pFormats->DeleteAll();
+
+				pFormats->AddNew(CF_TEXT, data);
+
+				IClipFormat *pText = pFormats->FindFormatEx(CF_TEXT);
+				if(pText != NULL)
+				{
+					pText->AutoDeleteData(true);
+				}
+
+				ret = true;
+			}
+		}
+	}
+
+	return ret;
+}

+ 13 - 0
Addins/DittoUtil/PasteAnyAsText.h

@@ -0,0 +1,13 @@
+#pragma once
+#include "..\..\Shared\DittoDefines.h"
+#include "..\..\Shared\IClip.h"
+
+
+class PasteAnyAsText
+{
+public:
+	PasteAnyAsText(void);
+	~PasteAnyAsText(void);
+
+	static bool SelectClipToPasteAsText(const CDittoInfo &DittoInfo, IClip *pClip);
+};

+ 179 - 0
Addins/DittoUtil/PasteImageAsHtmlImage.cpp

@@ -0,0 +1,179 @@
+#include "StdAfx.h"
+#include ".\pasteimageashtmlimage.h"
+#include "TextConvert.h"
+
+CString g_csDIBImagePath = _T("");
+int g_nDIBImageName = 1;
+
+CPasteImageAsHtmlImage::CPasteImageAsHtmlImage(void)
+{
+}
+
+CPasteImageAsHtmlImage::~CPasteImageAsHtmlImage(void)
+{
+}
+
+bool CPasteImageAsHtmlImage::ConvertPathToHtmlImageTag(const CDittoInfo &DittoInfo, IClip *pClip)
+{
+	bool bRet = false;
+	IClipFormats *pFormats = pClip->Clips();
+	if(pFormats)
+	{
+		if(g_csDIBImagePath.IsEmpty())
+		{
+			CreateLocalPath(true);
+		}
+
+		CString csIMG = _T("");
+
+		IClipFormat *pCF_DIB = pFormats->FindFormatEx(CF_DIB);
+		if(pCF_DIB != NULL)
+		{
+			CString csFile;
+			csFile.Format(_T("%s\\%d.bmp"), g_csDIBImagePath, g_nDIBImageName);
+			g_nDIBImageName++;
+
+
+			LPVOID pvData = GlobalLock(pCF_DIB->Data());
+			ULONG size = (ULONG)GlobalSize(pCF_DIB->Data());
+
+			if(WriteDataToFile(csFile, pvData, size))
+			{
+				GlobalUnlock(pCF_DIB->Data());
+
+				csIMG.Format(_T("<IMG src=\"file:///%s\">"), csFile);
+			}
+			else
+			{
+				GlobalUnlock(pCF_DIB->Data());
+			}
+		}
+		else
+		{
+			IClipFormat *pHDrop = pFormats->FindFormatEx(CF_HDROP);
+			if(pHDrop)
+			{
+				HDROP drop = (HDROP)GlobalLock((HDROP)pHDrop->Data());
+				int nNumFiles = DragQueryFile(drop, -1, NULL, 0);
+				TCHAR file[MAX_PATH];
+
+				for(int nFile = 0; nFile < nNumFiles; nFile++)
+				{
+					if(DragQueryFile(drop, nFile, file, sizeof(file)) > 0)
+					{
+						CString csOrigfile(file);
+						CString csFile(file);
+						csFile = csFile.MakeLower();
+
+						if(csFile.Find(_T(".bmp")) != -1 || 
+							csFile.Find(_T(".dib")) != -1 ||
+							csFile.Find(_T(".jpg")) != -1 ||
+							csFile.Find(_T(".jpeg")) != -1 ||
+							csFile.Find(_T(".jpe")) != -1 ||
+							csFile.Find(_T(".jfif")) != -1 ||
+							csFile.Find(_T(".gif")) != -1 ||
+							csFile.Find(_T(".tif")) != -1 ||
+							csFile.Find(_T(".tiff")) != -1 ||
+							csFile.Find(_T(".png")) != -1)
+						{
+							CString csFormat;
+							csFormat.Format(_T("<IMG src=\"file:///%s\">"), csOrigfile);
+							if(nFile < nNumFiles-1)
+							{
+								csFormat += _T("<br>");
+							}
+							csIMG += csFormat;
+						}
+					}
+				}
+
+				GlobalUnlock(pHDrop->Data());
+			}
+		}
+
+		if(csIMG.IsEmpty() == FALSE)
+		{
+			pFormats->DeleteAll();
+			CStringA utf8;
+			CTextConvert::ConvertToUTF8(csIMG, utf8);
+			pFormats->AddNew(DittoAddinHelpers::GetFormatID(_T("HTML Format")), DittoAddinHelpers::NewGlobalP(utf8.GetBuffer(), utf8.GetLength()));
+			bRet = true;
+		}
+	}
+
+	return bRet;
+}
+
+bool CPasteImageAsHtmlImage::WriteDataToFile(CString csPath, LPVOID data, ULONG size)
+{
+	bool bRet = false;
+	CFile file;
+	CFileException ex;
+	if(file.Open(csPath, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary, &ex))
+	{
+		BITMAPINFO *lpBI = (BITMAPINFO *)data;
+
+		int nPaletteEntries = 1 << lpBI->bmiHeader.biBitCount;
+		if(lpBI->bmiHeader.biBitCount > 8)
+			nPaletteEntries = 0;
+		else if( lpBI->bmiHeader.biClrUsed != 0 )
+			nPaletteEntries = lpBI->bmiHeader.biClrUsed;
+
+		BITMAPFILEHEADER BFH;
+		memset(&BFH, 0, sizeof( BITMAPFILEHEADER));
+		BFH.bfType = 'MB';
+		BFH.bfSize = sizeof(BITMAPFILEHEADER) + size;
+		BFH.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + nPaletteEntries * sizeof(RGBQUAD);
+
+		file.Write(&BFH, sizeof(BITMAPFILEHEADER));
+		file.Write(data, size);
+
+		file.Close();
+
+		bRet = true;
+	}
+	else
+	{
+		CString csError;
+		TCHAR exError[250];
+		ex.GetErrorMessage(exError, sizeof(exError));
+
+		csError.Format(_T("OutLookExpress Addin - Failed to write CF_DIB to file: %s, Error: %s"), csPath, exError);
+		OutputDebugString(csPath);
+	}
+
+	return bRet;
+}
+
+bool CPasteImageAsHtmlImage::CleanupPastedImages()
+{
+	bool bRet = false;
+	if(g_csDIBImagePath.IsEmpty())
+	{
+		CreateLocalPath(false);
+	}
+
+	CFileFind find;
+	BOOL bCont = find.FindFile(g_csDIBImagePath + _T("\\*"));
+
+	while(bCont)
+	{
+		bCont = find.FindNextFile();
+		DeleteFile(find.GetFilePath());
+	}
+	find.Close();
+
+	bRet = RemoveDirectory(g_csDIBImagePath) == TRUE;
+
+	return false;;
+}
+
+void CPasteImageAsHtmlImage::CreateLocalPath(bool bCreateDir)
+{
+	g_csDIBImagePath = _wgetenv(_T("TMP"));;
+	g_csDIBImagePath += _T("\\ditto");
+	if(bCreateDir)
+	{
+		CreateDirectory(g_csDIBImagePath, NULL);
+	}
+}

+ 19 - 0
Addins/DittoUtil/PasteImageAsHtmlImage.h

@@ -0,0 +1,19 @@
+#pragma once
+
+#include "..\..\Shared\DittoDefines.h"
+#include "..\..\Shared\IClip.h"
+
+
+class CPasteImageAsHtmlImage
+{
+public:
+	CPasteImageAsHtmlImage(void);
+	~CPasteImageAsHtmlImage(void);
+
+	bool ConvertPathToHtmlImageTag(const CDittoInfo &DittoInfo, IClip *pClip);
+	static bool CleanupPastedImages();
+
+private:
+	bool WriteDataToFile(CString csPath, LPVOID data, ULONG size);	
+	static void CreateLocalPath(bool bCreateDir);
+};

+ 59 - 0
Addins/DittoUtil/ReadMe.txt

@@ -0,0 +1,59 @@
+========================================================================
+    MICROSOFT FOUNDATION CLASS LIBRARY : DittoUtil Project Overview
+========================================================================
+
+
+AppWizard has created this DittoUtil DLL for you.  This DLL not only
+demonstrates the basics of using the Microsoft Foundation classes but
+is also a starting point for writing your DLL.
+
+This file contains a summary of what you will find in each of the files that
+make up your DittoUtil DLL.
+
+DittoUtil.vcproj
+    This is the main project file for VC++ projects generated using an Application Wizard. 
+    It contains information about the version of Visual C++ that generated the file, and 
+    information about the platforms, configurations, and project features selected with the
+    Application Wizard.
+
+DittoUtil.h
+    This is the main header file for the DLL.  It declares the
+    CDittoUtilApp class.
+
+DittoUtil.cpp
+    This is the main DLL source file.  It contains the class CDittoUtilApp.
+DittoUtil.rc
+    This is a listing of all of the Microsoft Windows resources that the
+    program uses.  It includes the icons, bitmaps, and cursors that are stored
+    in the RES subdirectory.  This file can be directly edited in Microsoft
+    Visual C++.
+
+res\DittoUtil.rc2
+    This file contains resources that are not edited by Microsoft 
+    Visual C++.  You should place all resources not editable by
+    the resource editor in this file.
+
+DittoUtil.def
+    This file contains information about the DLL that must be
+    provided to run with Microsoft Windows.  It defines parameters
+    such as the name and description of the DLL.  It also exports
+    functions from the DLL.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+    These files are used to build a precompiled header (PCH) file
+    named DittoUtil.pch and a precompiled types file named StdAfx.obj.
+
+Resource.h
+    This is the standard header file, which defines new resource IDs.
+    Microsoft Visual C++ reads and updates this file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////

BIN
Addins/DittoUtil/Release/DittoUtil.dll


+ 80 - 0
Addins/DittoUtil/SelectPasteFormat.cpp

@@ -0,0 +1,80 @@
+// SelectPasteFormat.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "DittoUtil.h"
+#include "SelectPasteFormat.h"
+#include ".\selectpasteformat.h"
+
+
+// CSelectPasteFormat dialog
+
+IMPLEMENT_DYNAMIC(CSelectPasteFormat, CDialog)
+CSelectPasteFormat::CSelectPasteFormat(CWnd* pParent, IClipFormats *clipFormats)
+	: CDialog(CSelectPasteFormat::IDD, pParent)
+{
+	m_pClipFormats = clipFormats;
+	m_selectedFormat = 0;
+}
+
+CSelectPasteFormat::~CSelectPasteFormat()
+{
+}
+
+void CSelectPasteFormat::DoDataExchange(CDataExchange* pDX)
+{
+	CDialog::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_LIST1, m_Formats);
+}
+
+
+BEGIN_MESSAGE_MAP(CSelectPasteFormat, CDialog)
+	ON_LBN_DBLCLK(IDC_LIST1, OnLbnDblclkList1)
+	ON_WM_SIZE()
+END_MESSAGE_MAP()
+
+
+BOOL CSelectPasteFormat::OnInitDialog() 
+{
+	CDialog::OnInitDialog();
+
+	if(m_pClipFormats != NULL)
+	{
+		int count = m_pClipFormats->Size();
+		for(int i = 0; i < count; i++)
+		{
+			CString formatName = DittoAddinHelpers::GetFormatName(m_pClipFormats->GetAt(i)->Type());
+			int pos = m_Formats.AddString(formatName);
+			m_Formats.SetItemData(pos, m_pClipFormats->GetAt(i)->Type());
+		}
+	}
+
+	m_Resize.SetParent(m_hWnd);
+	m_Resize.AddControl(IDC_LIST1, DR_SizeHeight | DR_SizeWidth);
+	m_Resize.AddControl(IDOK, DR_MoveTop | DR_MoveLeft);
+	m_Resize.AddControl(IDCANCEL, DR_MoveTop | DR_MoveLeft);
+
+	return TRUE;
+}
+
+void CSelectPasteFormat::OnOK()
+{
+	int pos = m_Formats.GetCurSel();
+	if(pos >= 0 && pos < m_Formats.GetCount())
+	{
+		m_selectedFormat = (CLIPFORMAT)m_Formats.GetItemData(pos);
+	}
+
+	CDialog::OnOK();
+}
+
+void CSelectPasteFormat::OnLbnDblclkList1()
+{
+	OnOK();
+}
+
+void CSelectPasteFormat::OnSize(UINT nType, int cx, int cy) 
+{
+	CDialog::OnSize(nType, cx, cy);
+	m_Resize.MoveControls(CSize(cx, cy));
+}

+ 36 - 0
Addins/DittoUtil/SelectPasteFormat.h

@@ -0,0 +1,36 @@
+#pragma once
+#include "afxwin.h"
+#include "resource.h"
+#include "Exports.h"
+#include "DialogResizer.h"
+
+// CSelectPasteFormat dialog
+
+class CSelectPasteFormat : public CDialog
+{
+	DECLARE_DYNAMIC(CSelectPasteFormat)
+
+public:
+	CSelectPasteFormat(CWnd* pParent, IClipFormats *clipFormats);   // standard constructor
+	virtual ~CSelectPasteFormat();
+
+	CLIPFORMAT SelectedFormat() const { return m_selectedFormat; }
+	void SelectedFormat(CLIPFORMAT val) { m_selectedFormat = val; }
+
+// Dialog Data
+	enum { IDD = IDD_DIALOG_SELECT_FORMAT };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
+	IClipFormats *m_pClipFormats;
+	CLIPFORMAT m_selectedFormat;
+	CDialogResizer m_Resize;
+	
+	DECLARE_MESSAGE_MAP()
+	CListBox m_Formats;
+	virtual BOOL OnInitDialog();
+	virtual void OnOK();
+public:
+	afx_msg void OnLbnDblclkList1();
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+};

+ 174 - 0
Addins/DittoUtil/TextConvert.cpp

@@ -0,0 +1,174 @@
+#include "StdAfx.h"
+#include "TextConvert.h"
+
+static BYTE kUtf8Limits[5] = { 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
+
+CTextConvert::CTextConvert()
+{
+}
+
+CTextConvert::~CTextConvert()
+{
+}
+
+CStringW CTextConvert::MultiByteToUnicodeString(const CStringA &srcString)
+{
+	CStringW resultString;
+
+	if(!srcString.IsEmpty())
+	{
+		int numChars = MultiByteToWideChar(CP_ACP, 0, srcString, 
+						srcString.GetLength(), resultString.GetBuffer(srcString.GetLength()), 
+						srcString.GetLength() + 1);
+
+		resultString.ReleaseBuffer(numChars);
+	}
+	return resultString;
+}
+
+CStringA CTextConvert::UnicodeStringToMultiByte(const CStringW &srcString)
+{
+	CStringA resultString;
+	if(!srcString.IsEmpty())
+	{
+		int numRequiredBytes = srcString.GetLength() * sizeof(wchar_t);
+		int numChars = WideCharToMultiByte(CP_ACP, 0, srcString, 
+							srcString.GetLength(), resultString.GetBuffer(numRequiredBytes), 
+							numRequiredBytes + 1, NULL, NULL);
+
+		resultString.ReleaseBuffer(numChars);
+	}
+
+	return resultString;
+}
+
+CStringA CTextConvert::ConvertToChar(const CString &src)
+{
+#ifdef _UNICODE
+	return UnicodeStringToMultiByte(src);
+#else
+	return src;
+#endif
+}
+
+CStringW CTextConvert::ConvertToUnicode(const CString &src)
+{
+#ifdef _UNICODE
+	return src;
+#else
+	return MultiByteToUnicodeString(src);
+#endif
+}
+
+bool CTextConvert::ConvertFromUTF8(const CStringA &src, CString &dest)
+{
+#ifdef _UNICODE	
+	dest.Empty();
+	for(int i = 0; i < src.GetLength();)
+	{
+		BYTE c = (BYTE)src[i++];
+		if (c < 0x80)
+		{
+			dest += (wchar_t)c;
+			continue;
+		}
+		if(c < 0xC0)
+		{
+			dest = src;
+			return false;
+		}
+		int numAdds;
+		for (numAdds = 1; numAdds < 5; numAdds++)
+			if (c < kUtf8Limits[numAdds])
+				break;
+		
+		UINT value = (c - kUtf8Limits[numAdds - 1]);
+		do
+		{
+			if (i >= src.GetLength())
+			{
+				dest = src;
+				return false;
+			}
+			BYTE c2 = (BYTE)src[i++];
+			if (c2 < 0x80 || c2 >= 0xC0)
+			{
+				dest = src;
+				return false;
+			}
+			value <<= 6;
+			value |= (c2 - 0x80);
+			numAdds--;
+		}while(numAdds > 0);
+
+		if (value < 0x10000)
+		{
+			dest += (wchar_t)(value);
+		}
+		else
+		{
+			value -= 0x10000;
+			if (value >= 0x100000)
+			{
+				dest = src;
+				return false;
+			}
+			dest += (wchar_t)(0xD800 + (value >> 10));
+			dest += (wchar_t)(0xDC00 + (value & 0x3FF));
+		}
+	}
+#else
+	dest = src;
+#endif
+	return true; 
+}
+
+bool CTextConvert::ConvertToUTF8(const CString &src, CStringA &dest)
+{
+#ifdef _UNICODE
+	dest.Empty();
+	for(int i = 0; i < src.GetLength();)
+	{
+		UINT value = (UINT)src[i++];
+		if (value < 0x80)
+		{
+			dest += (char)value;
+			continue;
+		}
+		if (value >= 0xD800 && value < 0xE000)
+		{
+			if (value >= 0xDC00)
+			{
+				dest = src;
+				return false;
+			}
+			if (i >= src.GetLength())
+			{
+				dest = src;
+				return false;
+			}
+			UINT c2 = (UINT)src[i++];
+			if (c2 < 0xDC00 || c2 >= 0xE000)
+			{
+				dest = src;
+				return false;
+			}
+			value = ((value - 0xD800) << 10) | (c2 - 0xDC00);
+		}
+		int numAdds;
+		for (numAdds = 1; numAdds < 5; numAdds++)
+			if (value < (((UINT)1) << (numAdds * 5 + 6)))
+				break;
+		dest += (char)(kUtf8Limits[numAdds - 1] + (value >> (6 * numAdds)));
+		do
+		{
+			numAdds--;
+			dest += (char)(0x80 + ((value >> (6 * numAdds)) & 0x3F));
+		}
+		while(numAdds > 0);
+	}
+#else
+	dest = src;
+#endif
+	return true;
+}

+ 20 - 0
Addins/DittoUtil/TextConvert.h

@@ -0,0 +1,20 @@
+#pragma once
+
+class CTextConvert
+{
+public:
+
+	CTextConvert();
+	~CTextConvert();
+
+	static bool ConvertFromUTF8(const CStringA &src, CString &dest);
+	static bool ConvertToUTF8(const CString &src, CStringA &dest);
+
+	static CStringA UnicodeStringToMultiByte(const CStringW &srcString);
+	static CStringW MultiByteToUnicodeString(const CStringA &srcString);
+
+	static CStringA ConvertToChar(const CString &src);
+	static CStringW ConvertToUnicode(const CString &src);
+
+protected:
+};

+ 18 - 0
Addins/DittoUtil/resource.h

@@ -0,0 +1,18 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by DittoUtil.rc
+//
+#define IDC_LIST1                       1000
+#define IDC_CHECK_UNICODE               1001
+#define IDD_DIALOG_SELECT_FORMAT        2000
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        2001
+#define _APS_NEXT_COMMAND_VALUE         32771
+#define _APS_NEXT_CONTROL_VALUE         2000
+#define _APS_NEXT_SYMED_VALUE           2000
+#endif
+#endif

+ 7 - 0
Addins/DittoUtil/stdafx.cpp

@@ -0,0 +1,7 @@
+// stdafx.cpp : source file that includes just the standard includes
+// DittoUtil.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+

+ 52 - 0
Addins/DittoUtil/stdafx.h

@@ -0,0 +1,52 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN		// Exclude rarely-used stuff from Windows headers
+#endif
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER				// Allow use of features specific to Windows 95 and Windows NT 4 or later.
+#define WINVER 0x0400		// Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINNT		// Allow use of features specific to Windows NT 4 or later.
+#define _WIN32_WINNT 0x0400	// Change this to the appropriate value to target Windows 2000 or later.
+#endif						
+
+#ifndef _WIN32_WINDOWS		// Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE			// Allow use of features specific to IE 4.0 or later.
+#define _WIN32_IE 0x0400	// Change this to the appropriate value to target IE 5.0 or later.
+#endif
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS	// some CString constructors will be explicit
+
+#include <afxwin.h>         // MFC core and standard components
+#include <afxext.h>         // MFC extensions
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h>         // MFC OLE classes
+#include <afxodlgs.h>       // MFC OLE dialog classes
+#include <afxdisp.h>        // MFC Automation classes
+#endif // _AFX_NO_OLE_SUPPORT
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h>			// MFC ODBC database classes
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h>			// MFC DAO database classes
+#endif // _AFX_NO_DAO_SUPPORT
+
+#include <afxdtctl.h>		// MFC support for Internet Explorer 4 Common Controls
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>			// MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+