最近需要做一个打印的功能,于是在网上找到了这么一个方法. [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public class DOCINFOA { [MarshalAs(UnmanagedType.LPStr)] public string pDocName; [MarshalAs(UnmanagedType.LPStr)] public string pOutputFile; [MarshalAs(Unmanag…
https://github.com/ansible/ansible/raw/devel/examples/scripts/ConfigureRemotingForAnsible.ps1 环境: 服务器端 python2.7 centos7 ansible        yum install ansible 被管理windows端 win-server2012需要powershell 3.0 +开启winrm服务 +开启防火墙规则+配置powershell策略为remotesigned   一…
先看一个简单的GET示例 #include <Windows.h> #include <winhttp.h> #include <stdio.h> int main() { HINTERNET sessionHandle = WinHttpOpen(L); if (sessionHandle) { HINTERNET connectionHandle = WinHttpConnect(sessionHandle, L); if (connectionHandle) {…
/*导入相关函数*/ #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…
一.调用Windows API. C#下调用Windows API方法如下: 1.引入命名空间:using System.Runtime.InteropServices; 2.引用需要使用的方法,格式:[DllImport("DLL文件")]方法的声明; [DllImport("user32.dll")]private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); [DllImport("…
用C#调用Windows API向指定窗口发送 一.调用Windows API. C#下调用Windows API方法如下: 1.引入命名空间:using System.Runtime.InteropServices; 2.引用需要使用的方法,格式:[DllImport("DLL文件")]方法的声明; [DllImport("user32.dll")]private static extern bool ShowWindow(IntPtr hWnd, int nCm…
一.调用Windows API. C#下调用Windows API方法如下: 1.引入命名空间:using System.Runtime.InteropServices; 2.引用需要使用的方法,格式:[DllImport("DLL文件")]方法的声明; [DllImport("user32.dll")]private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); [DllImport("…
文件拷贝程序 程序类型:Console 参数:源文件名   目的文件名 要求:1.只能使用Windows API函数(CreateFile/ReadFile/WriteFile/CloseHandle)完成 这个程序是借鉴网上的一位程序员的,根据我自己的需要进行了修改,但是网址我找不到了,现向他致敬.我修改后的代码如下(代码1): #include<stdio.h> #include<windows.h> #include "iostream" //#inclu…
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…