The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ragdog on February 15, 2007, 03:29:24 PM

Title: update icon to res
Post by: ragdog on February 15, 2007, 03:29:24 PM
hi

as I can merge a selected icon into my resource with this algo


.386   
.model flat,stdcall   
option casemap:none   
include    windows.inc
include    kernel32.inc
includelib kernel32.lib
.data   
    szTargetExe db 'test.exe',0
    szTargetFile db 'main.ico',0
    hMod dd 0
    hFile dd 0
    dwSize dd 0
   
.code
start:
    invoke CreateFile, ADDR szTargetFile, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0
    test eax,eax
    js _exit
    mov hFile,eax
    invoke GetFileSize, eax, 0
    mov dwSize,eax
    invoke CloseHandle, hFile

    invoke BeginUpdateResource, ADDR szTargetExe, 0
    or eax,eax
    jz _exit
    mov hMod,eax
    invoke UpdateResource, eax, RT_GROUP_ICON, 100, 0, addr szTargetFile, dwSize   
    invoke EndUpdateResource, hMod, 0

_exit:
    invoke ExitProcess, 0
   
end start

ragdog
Title: Re: update icon to res
Post by: ragdog on February 24, 2007, 03:39:21 PM
can none help me with this problem?

:'(
Title: Re: update icon to res
Post by: six_L on February 24, 2007, 03:50:36 PM
before ask the question, you have better to search the forum.
if everyone asks the same question, what's happen will be ? the information will be exploded.
http://www.masm32.com/board/index.php?topic=6168.msg46063#msg46063
Title: Re: update icon to res
Post by: ragdog on February 24, 2007, 04:10:34 PM
thanks

I would like not from a selected exe file! I want from a separate icon file *.ico
Title: Re: update icon to res
Post by: dsouza123 on February 24, 2007, 05:03:15 PM
Hope this helps, MichaelW's drive activity utility, it deals with switching between icons while a program is running.

http://www.masm32.com/board/index.php?topic=4163.msg31130#msg31130

It switches between icons to display disk activity, runs in the system tray.
Title: Re: update icon to res
Post by: ragdog on February 24, 2007, 08:45:25 PM
i have a small source found in c++ can your help to translate in masm?

thanks in forward

ragdog

[attachment deleted by admin]
Title: Re: update icon to res
Post by: Vortex on February 25, 2007, 08:47:07 AM
ragdog,

Here is a quick demo uptading the icon of an executable :

.386
.model flat, stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\macros\macros.asm

includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib


.data
include rsrc.inc
.data?
hUpdateRes dd ?
.code
start:
fn BeginUpdateResource,"Msgbox.exe",FALSE
mov hUpdateRes,eax
fn UpdateResource,eax,RT_ICON,1,1033,ADDR res_icon,02E8h
fn UpdateResource,hUpdateRes,RT_GROUP_ICON,100,1033,ADDR res_group_icon,014h
fn EndUpdateResource,hUpdateRes,FALSE
fn ExitProcess,NULL

END start

[attachment deleted by admin]
Title: Re: update icon to res
Post by: ragdog on February 25, 2007, 10:11:53 AM
thanks to all

this example have I already!
I would like c++ the example in masm32
if their there further could help me

ragdog
Title: Re: update icon to res
Post by: PBrennick on February 25, 2007, 04:16:14 PM
RagDog,
Actually, the example posted by Vortex does exactlyy what you requested. All you need to do is convert the .ico file to a data dump. I will, however take a peek at your C++ example.

Paul