【叶帆开源区】VB动态加载纯DLL资源

叶帆
博客专家认证
业界专家认证
2005-03-16 09:24:03
【程序界面】--------------------------------
http://www.bjjr.com.cn/yefan/pic/dllres1.jpg
http://www.bjjr.com.cn/yefan/pic/dllres2.jpg

【源码下载】--------------------------------
http://blog.csdn.net/yefanqiu/
【叶帆源码】->[015]VB引用DLL资源

【源码介绍】--------------------------------
http://blog.csdn.net/yefanqiu/archive/2005/03/16/320640.aspx

【部分源码摘要】--------------------------------
'*************************************************************************
'**函 数 名:LoadRes
'**输 入:无
'**输 出:无
'**功能描述:资源加载
'**全局变量:
'**调用模块:
'**作 者:叶帆
'**日 期:2005-03-15 12:27:34
'**修 改 人:
'**日 期:
'**版 本:V1.0.0
'*************************************************************************
Private Sub LoadRes()
Dim hRes As Long
Dim strData As String
Dim hBmp As Long
Dim hIcon As Long
Dim bitBmp As BITMAPINFO

'加载DLL
hRes = LoadLibrary(Combo1.Text)

'字符串
strData = Space(255)
LoadString hRes, IDS_STRING1, strData, 255
Label1(0).Caption = Trim(strData)

strData = Space(255)
LoadString hRes, IDS_STRING2, strData, 255
Label1(1).Caption = Trim(strData)

strData = Space(255)
LoadString hRes, IDS_STRING3, strData, 255
Label1(2).Caption = Trim(strData)

'位图
hBmp = LoadBitmap(hRes, IDB_BITMAP1)
If GetObjectType(hBmp) = OBJ_BITMAP Then
GetObject hBmp, Len(bitBmp), bitBmp
DrawState Picture1(0).hDC, 0, ByVal 0, hBmp, 0, 0, 0, bitBmp.bmiHeader.biWidth, bitBmp.bmiHeader.biHeight, DST_BITMAP
End If

'图标
hIcon = LoadIcon(hRes, IDI_ICON1)
DrawIcon Picture1(1).hDC, 0, 0, hIcon

'释放资源
DeleteObject hBmp
DeleteObject hIcon

'释放DLL
FreeLibrary hRes
End Sub

...

【叶帆开源区】其它链接
XP界面窗体制作(可放缩、可缩小到托盘)
http://community.csdn.net/Expert/topic/3387/3387552.xml?temp=.416424
有意思的老人源码
http://community.csdn.net/Expert/topic/3376/3376547.xml?temp=.1939661
VB源码之友
http://community.csdn.net/Expert/topic/3365/3365079.xml?temp=7.926577E-02
定制公用对话框(如photoshop的文件打开对话框)
http://community.csdn.net/Expert/topic/3385/3385386.xml?temp=.2206842
绝对经典的扫雷源码(仿微软扫雷界面)--可以作弊呢!!!
http://community.csdn.net/Expert/topic/3380/3380429.xml?temp=.3048517
MSComm串口通信示例
http://community.csdn.net/Expert/topic/3387/3387736.xml?temp=.2366754
任意透明窗体--运用API实现特异窗体
http://community.csdn.net/Expert/topic/3389/3389796.xml?temp=.8869898




...全文
255 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
cool_man 2005-03-19
  • 打赏
  • 举报
回复
mark
laviewpbt 2005-03-19
  • 打赏
  • 举报
回复
xuexi
是是非非 2005-03-19
  • 打赏
  • 举报
回复
学习,呵呵
xmuyyd 2005-03-16
  • 打赏
  • 举报
回复
学习~~~
yangao 2005-03-16
  • 打赏
  • 举报
回复
好东东
huangjianyou 2005-03-16
  • 打赏
  • 举报
回复
^_^
daisy8675 2005-03-16
  • 打赏
  • 举报
回复
顶一把,叶帆的blog上面不少好东西,大家可以多看看
aiur2000 2005-03-16
  • 打赏
  • 举报
回复
呵呵,顶了
bacaihong 2005-03-16
  • 打赏
  • 举报
回复
多谢楼猪,学习学习再学习
ljhdi 2005-03-16
  • 打赏
  • 举报
回复
顶一下先
kmzs 2005-03-16
  • 打赏
  • 举报
回复
叶兄总有好东东
zyg0 2005-03-16
  • 打赏
  • 举报
回复
学习
guxizhw 2005-03-16
  • 打赏
  • 举报
回复
学习:)
yorkness 2005-03-16
  • 打赏
  • 举报
回复
看看去
yorkness 2005-03-16
  • 打赏
  • 举报
回复
看看去

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧