码迷,mamicode.com
首页 >  
搜索关键字:dllimport    ( 445个结果
c# winform启动浏览器,实现自动登录
首先,申明两个API /// /// 设置 cookie /// /// /// /// /// [DllImport("wininet.dll", CharSet = Cha...
分类:Windows程序   时间:2015-09-16 14:15:11    阅读次数:208
[转]C#调用C++类(以COM组件的形式)
如果想用C#调用C/C++写的函数,可以先将C/C++的函数写成dll文件,由C#用DllImport的方式来调用,但是这种方法无法调用C++写的类,如果想调用C++类,可以先把C++类封装成COM组件,再由C#来调用。方法如下(以VS2008英文版为例说明)一、新建一个Visual C++项目,类...
分类:编程语言   时间:2015-09-07 00:31:57    阅读次数:184
使用WinAPI全局热键注册和全局模拟按键
一、全局热键注册1、先引用DLL[System.Runtime.InteropServices.DllImport("user32.dll")] //导入WinAPIpublic static extern bool RegisterHotKey( //设置热键IntPtr hWnd, // 窗口句...
分类:Windows程序   时间:2015-08-28 10:58:04    阅读次数:208
WinForm中播放声音
using System.Runtime.InteropServices;[DllImport("winmm.dll")] public static extern bool PlaySound(string pszSound, int hmod, int fdwSound); public con...
分类:Windows程序   时间:2015-08-26 17:19:31    阅读次数:146
C#实现无标题栏窗体的拖动
标题栏区域封装在Panel容器内(推荐方案),则编写该Panel的MouseDown事件处理函数。[c-sharp] view plaincopyprint?[DllImport("user32.dll",CharSet=CharSet.Unicode)]publicstaticexternIntP...
分类:Windows程序   时间:2015-08-26 17:19:07    阅读次数:159
C# 中动态调用C++动态链接
之前的文章中讲述过从DLL中导出变量,其中包括了静态加载和动态加载。C#调用C++动态链接库同样分为静态加载和动态加载。fellen的博客“WPF中使用MFC动态链接库(dll)函数”中讲述的是如何C#静态加载DLL,即需要将C++代码编译生成的Dll放在C#程序的Bin目录下,并在引入函数的位置加入[DllImport(“xxx.dll”)] 。由于Dll路径的限制,使用的不是很方便,C#中我们经...
分类:编程语言   时间:2015-08-26 12:05:09    阅读次数:211
调用Config.ini类
private static string sPath = @Directory.GetCurrentDirectory() + "\\config.ini"; [DllImport("kernel32")] private static extern long Wri...
分类:其他好文   时间:2015-08-25 18:21:33    阅读次数:132
C#模拟PrtScn实现截屏
有了之前的基础知识了解,现在开始实现PrtScn和Alt+PrtScn。首先新建一个WPF应用程序,命名为PrintscreenAndAltPrintScreen导入keybd_event方法: 需要为DllImport添加using System.Runtime.InteropServices;[DllImport("user32.dll")] static extern void keybd_...
分类:Windows程序   时间:2015-08-20 17:01:52    阅读次数:142
【C#】窗体动画效果
通过调用API可以实现C#窗体的动画效果,主要调用user32.dll的行数AnimateWindow1、函数申明[System.Runtime.InteropServices.DllImport("user32")] private static extern bool AnimateWindow...
分类:Windows程序   时间:2015-08-19 10:39:33    阅读次数:166
C# 编程音量控制
API控制音量很简单,就是两个方法:[DllImport("Winmm.dll")]private static extern int waveOutSetVolume(int hwo, System.UInt32 pdwVolume))//设置音量[DllImport("Winmm.dll")] ...
分类:Windows程序   时间:2015-08-15 18:14:20    阅读次数:260
445条   上一页 1 ... 25 26 27 28 29 ... 45 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!