07-21-2009, 12:46 AM
Hello Gintaras:
Is it possible to update a resource like this?
Function dlg_gml
if I do this using resource hacker it works ok, but when i update the resource it doesn't work
Thank you
Regards.
Is it possible to update a resource like this?
Function dlg_gml
;\Dialog_Editor
function# hDlg message wParam lParam
__MemBmp-- mb
if(hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Button 0x54032000 0x0 82 22 48 14 "Button"
;END DIALOG
;DIALOG EDITOR: "" 0x203000A "" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,,int hFile = CreateFile("splash.bmp", GENERIC_READ,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0)
,,long file_size = GetFileSize(hFile, 0);
,,out "%i" file_size
,,int fmap=CreateFileMapping(hFile, 0, PAGE_READONLY, 0, 0,0)
,,byte* pb=MapViewOfFile(fmap, FILE_MAP_READ, 0, 0, 0)
,,lpstr theresfiles="file.exe"
,,int resap=BeginUpdateResource(theresfiles,0)
,,out "Begin update %i" resap
,,out "updating %i" UpdateResource(resap,+RT_BITMAP,+1,MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),pb,file_size)
,,out "end updating %i" EndUpdateResource(resap,0)
,,UnmapViewOfFile(pb);
,,CloseHandle(hFile);
,case IDOK
,case IDCANCEL
ret 1
if I do this using resource hacker it works ok, but when i update the resource it doesn't work
Thank you
Regards.