⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 api.cs

📁 利用C#实现的将Word文件转换为PDF的源代码。其中转换过程分为3步
💻 CS
字号:
/*
 * EBI-Software all rights reserved.
 * webmaster@ebi-software.de
 * This code is only for educational use.
 */

using System;
using System.Runtime;
using System.Drawing;
using System.Runtime.InteropServices;

namespace EBIsagt.Windows.API
{
	public class User32
	{
		[DllImport("User32.dll", CharSet=CharSet.Auto)]
		public static extern int SendMessage(IntPtr hWnd, int message, IntPtr wParam, IntPtr lParam);
	}
	
	public class Ole32
	{


		[DllImport("ole32.dll")] 
		public static extern int ProgIDFromCLSID( 
			ref Guid clsid, 
			out string lplpszProgID
			); 

		[DllImport("ole32.dll")]
		public static extern int CreateStreamOnHGlobal( 
			int hGlobalMemHandle,
			bool fDeleteOnRelease,
			out UCOMIStream pOutStm
			);

		[DllImport("ole32.dll")]
		public static extern int CoRevokeClassObject(int dwRegister);

		[ DllImport ( "Ole32.Dll" ) ]
		public static extern int CreateBindCtx ( int reserved, out UCOMIBindCtx
			bindCtx );

		[DllImport("ole32.dll")]
		public static extern int CoImpersonateClient () ;


		[DllImport("OLE32.DLL", CharSet=CharSet.Auto)]
		public static extern uint CoRevertToSelf();

		[DllImport("OLE32.DLL", CharSet=CharSet.Auto)] 
		public static extern uint CoSetProxyBlanket( 
			IntPtr pProxy,
			uint dwAuthnSvc,
			uint dwAuthzSvc,
			IntPtr pServerPrincName,
			uint dwAuthnLevel,
			uint dwImpLevel,
			IntPtr pAuthInfo,
			uint dwCapababilities);

		[DllImport("ole32.dll")]
		public static extern int OleDraw(IntPtr pUnk, int dwAspect, IntPtr hdcDraw, ref Rectangle lprcBounds);

		[DllImport("ole32.dll")]
		public static extern Int32 CoInitialize ([ MarshalAs( UnmanagedType.AsAny )] Object o);

		[DllImport("ole32.dll", EntryPoint="CoImpersonateClient")]
		public extern static int CoImpersonateClient1();

		[DllImport("ole32.dll", EntryPoint="CoImpersonateClient")]
		public extern static void CoImpersonateClient2();



	}

	public class Messages
	{
		public const int WM_USER = 0x0400;
		public const int EM_FORMATRANGE  = WM_USER + 57;
		public const int EM_GETOLEINTERFACE = WM_USER + 60;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -