Function for directly loading JPG from res files

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.