VB: Functions for directly loading JPG files from res files
Create a new res file, and then put several JPG images.
.
'Save below as modres_load_jpg.mod
'*************************************** **********************************
'** Module name: modres_load_jpg
'** Note: All rights reserved for online design of danxin software 2007-2008 (c)
'** Creator: Dan Xin
'** Date: 21:42:55
'** Version: v1.0.0
'** Blog address: http://hi.baidu.com/starwork/
'** QQ number: 121877114
'** E-mail: cnstarwork@126.com
'*************************************** **********************************
Option explicit
Public Enum cboolean 'enum members are long data types
Cfalse = 0
Ctrue = 1
End Enum
Public const s_ OK = 0' indicates successful hresult
Public declare function createstreamonhglobal lib "OLE32 "_
(Byval hglobal as long ,_
Byval fdeleteonrelease as cboolean ,_
Ppstm as any) as long
Public declare function oleloadpicture lib "olepro32 "_
(Pstream as any ,_
Byval lsize as long ,_
Byval frunmode as cboolean ,_
Riid as guid ,_
Ppvobj as any) as long
Public type guid '16 bytes (128 bits)
Dwdata1 as long '4 bytes
Wdata2 as integer '2 bytes
Wdata3 as integer '2 bytes
Abdata4 (7) as byte '8 bytes, zero based
End type
Public declare function clsidfromstring lib "OLE32" (byval lpsz as any, pclsid as guid) as long
Public const siid_ipicture = "{7bf80980-bf32-101a-8bbb-00aa00300cab }"
Public const gmem_moveable = & H2
Public declare function globalalloc lib "Kernel32" (byval uflags as long, byval dwbytes as long) as long
Public declare function globallock lib "Kernel32" (byval hmem as long) as long
Public declare function globalunlock lib "Kernel32" (byval hmem as long) as long
Public declare function globalfree lib "Kernel32" (byval hmem as long) as long
Public declare sub movememory lib "Kernel32" alias "rtlmovememory" (pdest as any, psource as any, byval dwlength as long)
Download example:
Http://files.cnblogs.com/starwork/res_jpg_test.rar
All rights reserved by Dan Xin. For more information, see the source!