找回密码
 加入
搜索
查看: 9121|回复: 26

[系统综合] 如何将要调用的图片、音乐资源整合进编译完成后的EXE里?

 火... [复制链接]
发表于 2013-1-18 12:58:29 | 显示全部楼层 |阅读模式
不要外挂图片和音乐了,能否编译时整合进EXE里?
求指教。
发表于 2013-1-18 13:02:00 | 显示全部楼层
我也是刚学会的,Fileinstall(),自己看看帮助吧
发表于 2013-1-18 13:29:46 | 显示全部楼层
fileinstall没用的,用的时候还得释放出来。
我也是希望au3能和其他语言那样,包含资源。
可以直接在内存里面调用!!!
 楼主| 发表于 2013-1-18 13:48:57 | 显示全部楼层
我也是刚学会的,Fileinstall(),自己看看帮助吧
dpale 发表于 2013-1-18 13:02



    这个函数已经经常用,太久没接触autoit居然给忘记了。

谢过!
发表于 2013-1-18 19:46:31 | 显示全部楼层
回复 1# 黑菜



论坛中有列子,自己搜索一下

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2013-1-18 21:34:04 | 显示全部楼层
回复 3# kxing


    如果资源文件很大怎么办,都要加到内存吗?
发表于 2013-1-19 00:54:02 | 显示全部楼层
回复 6# dpale


    很大还是压缩软件打包吧,au3释放大资源也是很郁闷的一件事情
发表于 2013-1-19 06:25:41 | 显示全部楼层
不错,谢谢分享
发表于 2013-1-19 19:46:43 | 显示全部楼层
回复 1# 黑菜
看看这个,能够做到你的要求,不过我还没有学会呢
http://www.autoitx.com/forum.php ... 4%E6%2B%BC%D3%D4%D8
发表于 2013-1-19 20:12:27 | 显示全部楼层
回复 5# guland


     这种方式就是FileInstall吧...
发表于 2013-1-19 22:22:20 | 显示全部楼层
回复 3# kxing

象下面这种?


#Include <GDIP.au3>
#Include <GUIConstantsEx.au3>
#include <Memory.au3>

_GDIPlus_Startup()
UserGui()
_GDIPlus_Shutdown()

Func UserGui()
        Local $hGui, $hImage, $hGraphics

        $hImage = _ImageFromMem(happyTC_gif())
        $iWidth = _GDIPlus_ImageGetWidth($hImage)
        $iHeight = _GDIPlus_ImageGetHeight($hImage)
        $hGui = GUICreate("ImageFromMem", $iWidth, $iHeight)
        GUISetState(@SW_SHOW, $hGUI)
        $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
        _GDIPlus_GraphicsDrawImage($hGraphics, $hImage, 0, 0)

        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        
        GUIDelete($hGui)
        _GDIPlus_ImageDispose($hImage)
        _GDIPlus_GraphicsDispose($hGraphics)
EndFunc


Func _ImageFromMem($bImage, $hHBITMAP = False)
        Local $aResult, $tMem
        Local Const $memBitmap = Binary($bImage)
    Local Const $len = BinaryLen($memBitmap) 
    Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE)
    Local Const $pData = _MemGlobalLock($hData) 
    
        $tMem = DllStructCreate("byte[" & $len & "]", $pData)
    DllStructSetData($tMem, 1, $memBitmap) 
    _MemGlobalUnlock($hData) 
    $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) 
    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $aResult[3], "int*", 0) 
    Return $aResult[2]
EndFunc

Func happyTC_gif()
        Local $FileBin=""
        $FileBin &="4749463839612D004600F700000000000101010202020303030404040505050606060707070808080909090A0A0A0B0B0B0C0C0C0D0D0D0E0E0E0F0F0F10101011111112121213131314141415151516161616171916191B1A1B1D1E1C1F231E20281F20"
        $FileBin &="2B20223122223A232140242045251F4A251F4D261E50261D52261C54261C57271A5C2919602A18632B18652B17682B166C2A1370281076270E7F240B872108941D06A11805B01303BF1002CF0C02DC0901E60701EF0401F60201FC0100FE0000FE0000FE"
        $FileBin &="0000FD0101FC0202FA0404F70707F40A0AF00D0DE71314DF1719D91A1CD51B1ECE1C21C81D23C31E25B82028AE202BA7212EA3212FA1212F9F212F9D212F9C202F9A202E99202E98202E961F2D951F2D93202D91212D90232E8F252F8D27308B2B32892E"
        $FileBin &="3487323686353983383D813C417D404577464B714C526A525A675660635966615B685F5E6B5D616D5B626F5A64715C66735C67745B6975596A765A6C785A6D795B6F7A5C707B5D727C5F737D60757E62767F657881687A84697C866A7D886B7F896E818B"
        $FileBin &="74868F7B8A937D8C95838F968791988B939A9194998F969B90969C90979D90979E90979F8F979F8F989F8F98A08F98A08F98A08F98A18E99A28E99A28D9AA38D9AA48D9BA48C9BA58D9CA58D9CA68E9DA78E9EA88F9FA9909FA990A0AA91A0AA91A1AB92"
        $FileBin &="A2AB94A3AC97A6AE9AA9B09EACB1A0ADB3A2AFB4A5B1B6A9B4B8ACB6BAB1B9BCB4BBBEB5BCBFB6BDC0BAC1C3C0C5C7C7CBCDCED2D2D5D7D7DADCDCE3E4E3EFEFEFF6F6F6FBFBFBFDFDFDFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFE"
        $FileBin &="FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFE"
        $FileBin &="FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFFFFFFFEFEFEFEFEFEFFFFFF21FF0B4E45545343415045322E300301000000"
        $FileBin &="21F90400000000002C000000002D0046000008FE00F9091C48B0A0C18308132A3C382B56AB56AB1E2E9C383156AA4380F8F0C99367CF1E40874C511C393016A43D7AF4FCF913A865CB3F1C41925C382B15A03C7F06152AD4A811A49F901A4D1AF4870D9F"
        $FileBin &="43331936DAC347A74FA05081362AC4270DA0A404630DCAC3E70F20418478461DDB28501B3658F9CD22D42750A14985060902F4F56DCFB19030156A9326E9AC467D0E612A65CA54A952A3466D222428D057424FA11642B36766299090081746C5D9D4A632"
        $FileBin &="71064D952BA810D04DA1069921194BD0A146A55015DE8CEAD0182865068D323C0A6E28D493FA6CED4B7154A043BB679B42B50A551E264EC6FCD9B45CF626387DFA847982E60F1A8AB35CFEC396BD7995A943679644D78369B9A93E639E4881F2A47E19BE"
        $FileBin &="13511DA74E9EB9A9334924A15E197FB46758193340A1A0824F98A1C7770B4192C71983C4261B73791C11E0125210580826906C22487C0BD26746201026340B7A4FBCA18966A6A49261124E90908106760C32C94F9CA0F144890D0E12471E0AC5C2C81950"
        $FileBin &="7C81061C8170B25B864B90A04106197CE0964FA1C0F1E382DC6D855642AB0062068350480107248724C1040968A0A2C9946DE808C9207B48B1E5135FD85188205F22648A1E7694F1C5186140E1841966B4F041066DD042CB941AE494871E7DD8B9201A81"
        $FileBin &="6032481B0AADC212517FC0E14417526A30650668A041650676E8C1075CFE962AF8866E7C709A502B2ABDA549A5A6B6712A95A66640C21B999632C91777A2A15B1EC425A49268A1C4312529B404B2AA0684DA5946209B94E22397CA8E12C7447FE8A15328"
        $FileBin &="6D50F9472B725C1BEB13DBF641DF8252CCBA498A093522474B859875AA0664B4D0821640724722BD6FC4B5DA446D0432095C83B49BC117DB6D59227D1633A8ECB814E561C76088B5DBC213DB5D6C3290792E3C9129988E824A2966103CEFC93443D1C507"
        $FileBin &="CD4E94471B851C16C818F3655CF3825968F1415268C80132516F203B7489451F8D55D28319464A1C4F13AD05096909F4011A9368A6C9C1343F9185A25D0F6406A6BFC111EBC94593214674FC9C7144DA1AA02146FE16422B9845165DB440061340F460B8"
        $FileBin &="E1428421D0194008A1B2414500C1043F637841C2E5036BA1B9E6829BD186198787DE0310471C2184E14E2004BAE185F730841254087C3909023BA14468680C21FAEE860F81AF4044F07E78E34310318410AD27D14A1B4A082F3A0E8F0B7484F3D4037188"
        $FileBin &="1C62B41EBAF686BB8050F386E3A084F1A7537F861D1F2C11FCE138B8007E0F38487D10E145702D10094E702FFA128598F10119EB0302D7CCA084027A6121D113081A8AC03B208CC17F1FF80013C297C0AEB1C109BB0382173E70820EB620784AA860DAA6"
        $FileBin &="273A2574F084189CC1EFD2B6B8DD09C10B0213D80B88003D161E8484A15382C05CE08216609009DB5F3A43118A700616AE2E744478410B78D8430616A174AD23820847B23ED6B9E0043060A20BF2B73B1C90818538ECC10C8E96452D32507B3868810DC3"
        $FileBin &="18038180A18C3C64010B5C60BA31DA901FE5331C1506020338B260205FBC6312B8973A3E6AF18E04A9E2E19440102FC0319088E487FE184910387A2F9202710215A81003C115C4914C9C22262BC9C4178C7222A0E4E12927F2C8552AE48D4C74A542E028"
        $FileBin &="CA55C2D2057F942542FAA84A5D1EE49690F425297B294C82DCB296ABE4652E8B3990339491999FCC623099E94C6242931FA0BC663361A0CD830404003B"
        Return Binary("0x" & $FileBin)
EndFunc

发表于 2013-1-20 18:48:40 | 显示全部楼层
回复 11# 邪恶海盗


    我不知道你从哪看出来是FileInstall的.......图片都给你上了 你还是没看懂 .........  恶读一下AU3帮助吧
发表于 2013-1-20 18:56:35 | 显示全部楼层
回复 11# 邪恶海盗


    资源和Fileinstall不是一回事,百度一下Resource hacker和exescope的使用说明~
发表于 2013-1-20 19:00:23 | 显示全部楼层
回复 13# guland


    话说我也从来没有玩过这个呢,请教一下,加了如下面的文件
#PRE_Res_File_Add=d:\music\序曲.mp3

请问,如何访问这个mp3呢?
发表于 2013-1-20 20:41:32 | 显示全部楼层
回复  guland


    话说我也从来没有玩过这个呢,请教一下,加了如下面的文件
#PRE_Res_File_Add=d:\ ...
happytc 发表于 2013-1-20 19:00



    我一般内置图片、图标之类,没有内置过mp3之类的文件。内置时至少应该有3个参数,如
#PRE_Res_File_Add=d:\music\序曲.mp3,$RT_RCDATA,XQ_Mp3
这里的$RT_RCDATA不知道是否适用,如果是Bmp图片的话就是$RT_BITMAP。。。
调用的话可以用到 _WinAPI_FindResource 之类的函数
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-24 09:49 , Processed in 0.100973 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表