C#读取Win32标准DLL文件中的Bitmap(位图)
来源:互联网 发布:2016 网络新词 编辑:程序博客网 时间:2024/05/13 15:21
C#通过API函数,读取标准的Win32DLL 文件中的 Bitmap位图文件
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Text;
using System.IO;
using System.Drawing;
namespace LoadLibrary
{
public static class Program
{
[DllImport("kernel32.dll", EntryPoint = "LoadLibraryA")]
public static extern IntPtr LoadLibrary(string sLibName);
[DllImport("kernel32.dll", EntryPoint = "FreeLibrary")]
public static extern int FreeLibrary(IntPtr hLib);
[DllImport("User32.dll")]
public static extern IntPtr LoadBitmap(IntPtr hInstance, int uID);
[STAThread]
static void Main(string[] args)
{
IntPtr hDll = LoadLibrary("cards.dll");
if (hDll == IntPtr.Zero)
{
MessageBox.Show("Can't load library!");
return;
}
IntPtr hRes = LoadBitmap(hDll, 10);
Bitmap bmp = Bitmap.FromHbitmap(hRes);
FreeLibrary(hDll);
}
}
}
//运行环境 VS2008 (.NET)
//cards.dll 为Windows自带的扑克牌游戏扑克牌图案
- C#读取Win32标准DLL文件中的Bitmap(位图)
- C#读取Win32标准DLL文件中的字符串资源
- 位图文件(Bitmap)
- Bitmap位图文件读取、保存、屏幕截图
- Bitmap位图文件读取、保存、屏幕截图
- WINAPI 读取位图Bitmap
- C#读取DLL中的图片
- C#中的DLL文件
- 如何将OpenGL中的场景保存为Bitmap位图文件
- DIB位图(Bitmap)的读取和保存
- BITMAP位图文件保存方法
- 按比例压缩Bitmap位图文件
- 位图(bitmap)排序
- 位图(BitMap)索引
- BitMap(位图)排序
- 位图(BitMap)索引
- 位图(BitMap)索引
- 位图(BitMap)
- AutoCAD二次开发程序的自动安装处理
- QT学习笔记之零 Hello World
- 让firefox3.5也可以使用tab mix plus
- java classcastexception 哈希表中的对象只能是同一类型的
- CMarkUp使用简介
- C#读取Win32标准DLL文件中的Bitmap(位图)
- 传智播客学习笔记5.15&5.16
- 传智播客学习笔记5.17
- 传智播客学习笔记5.19
- 传智播客学习笔记5.20
- 迭代与递归
- CSS 单位
- CSS单位
- 鼠标滚轮程序以及CSS的zoom属性范例