BMK tweaks : win32 resource
BlitzMax Forums/BlitzMax Module Tweaks/BMK tweaks : win32 resource
| ||
0- backup your BMK.EXE file 1- create a new file: bmk_windres.bmx Function MakeRes$( src_path$) Local obj:TFile Local src:TFile If FileType(src_path)<>FILETYPE_FILE Return src=TFile.Create( src_path,Null ) Local src_ext$=ExtractExt( src_path ).ToLower() Local obj_path$ If Match( src_ext,"rc" ) Local p$=ExtractDir( src_path )+"/.bmx" Select FileType( p ) Case FILETYPE_NONE If Not CreateDir( p ) Throw "Unable to create temporary directory" Case FILETYPE_FILE Throw "Unable to create temporary directory" End Select obj_path$=p+"/"+StripDir( src_path ) obj_path:+opt_configmung+".o" If src.time>FileTime( obj_path ) Push CurrentDir() ChangeDir ExtractDir( src_path ) 'windres pathname does not contain some spaces Local src_path_fixed$=Replace(Replace(src_path,ExtractDir( src_path ),".")," ","_") Local obj_path_fixed$=Replace(Replace(obj_path,ExtractDir( src_path ),".")," ","_") CompileRes src_path_fixed,obj_path_fixed ChangeDir String(Pop()) EndIf EndIf Return obj_path EndFunction Function CompileRes( src$,obj$) DeleteFile obj Local cmd$ cmd="windres" src=CQuote(src) obj=CQuote(obj) cmd:+" -i "+src+" -o "+obj If Sys( cmd ) Throw "Build Error: failed to compile "+src EndIf End Function 2- modify the file: bmk_make.bmx line 1... Strict Import "bmk_modutil.bmx" ?win32 ' ------------ BMK TWEAK ----------------------------- Include "bmk_windres.bmx" ? ' ---------------------------------------------------------line 172... 'incbins For Local inc$=EachIn src_file.incbins Local time=FileTime( inc ) If time>src.time src.time=time ?win32 ' ------------ BMK TWEAK ----------------------------- Local inc_ext$=ExtractExt(inc).ToLower() If Match( inc_ext,"rc" ) ext_files.AddLast MakeRes(RealPath(inc)) EndIf ? ' --------------------------------------------------------- Next 3- compile bmk.bmx in non-gui mode 4- replace the previous BMK.EXE |
| ||
--------------- HOW TO USE --------------- 'BlitzMax Code incbin "mySaver.rc" content of mySaver.rc file : // Win32Resource file example (screensaver) 1 ICON "mySaver.ico" STRINGTABLE LANGUAGE 0x0000,0x0000 { 1, "my first saver 2.0" } |
| ||
Nice work, thanks for sharing! hopefully somthing like this will make it into brl's BMK... |
| ||
nice! btw, I was having problems with windres crashing when trying to include a manifest resource type, not sure if anyone else has succeeded in this department? |
| ||
Could you post your sample code ? version 2 : http://www.blitzbasic.com/Community/posts.php?topic=53505 |