PB通过GDI API获取图片的信息

这段代码展示了如何通过GDI+ API来获取图片的宽度和高度信息。首先进行GdiplusStartup初始化,然后获取设备环境句柄,创建绘图区域,并加载图片到内存中。接着,使用GdipDrawImageRect进行绘图操作,最后通过GdipGetImageWidth和GdipGetImageHeight获取图片的宽度和高度像素。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

------ 定义结构体
type GdiplusStartupInput from structure
 long  GdiplusVersion
 long  DebugEventCallback
 long  SuppressBackgroundThread
 long  SuppressExternalCodecs
end type

----- 定义API 函数
Private Function Long GdiplusStartup (ref Long Token, GdiplusStartupInput inputbuf, Long outputbuf) Library "gdiplus.dll"
SUBROUTINE GdiplusShutdown (Long Token)  Library "gdiplus.dll"
Private Function Long GdipLoadImageFromFile ( blob FileName, ref Long hImage)  Library "gdiplus.dll"
Private Function Long GdipDisposeImage(Long Image) Library "gdiplus.dll"
Private Function Long GdipGetImageWidth(Long Image, ref Long al_Width) Library "gdiplus.dll"
Private Function Long GdipGetImageHeight (Long Image, ref Long al_Height) Library "gdiplus.dll"
function  ulong  MultiByteToWideChar(UINT  CodePage,  ulong  dwFlags , ref string lpMultiByte
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值