最近需要做一个打印的功能,于是在网上找到了这么一个方法. [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public class DOCINFOA { [MarshalAs(UnmanagedType.LPStr)] public string pDocName; [MarshalAs(UnmanagedType.LPStr)] public string pOutputFile; [MarshalAs(Unmanag…
/*导入相关函数*/ #import "kernel32.dll" int CreateDirectoryW(string directoryName,int type); int CreateFileW(string Filename, int AccessMode, int ShareMode, int PassAsZero, int CreationMode, int FlagsAndAttributes, int AlsoPassAsZero); int WriteFile(i…
LoadLibrary HMODULE WINAPI LoadLibrary( _In_ LPCTSTR lpFileName ); Loads the specified module into the address space of the calling process. The specified module may cause other modules to be loaded. 用此函数来加载动态链接库到内存. LoadLibrary按照这样的方式来搜寻文件,先在应用程序所在…
在 Windows 的系统目录中,存在着很多的动态链接库文件(DLL 文件).这些 DLL 文件中包括了 Windows API 函数可执行程序. DLL 将各函数"导出",这样应用程序就可以找到 DLL 中的函数地址,当应用程序调用 Windows API 时,程序会运行到 DLL 中. API 函数主要存在于几个核心的动态连接库文件中. Kernel32.dll 是最重要的 DLL,Windows 系统最主要的系统服务 API 函数都存在于 Kernel32.dll 中. User…