Newbie Member
29May2008,03:03   #41
kylls's Avatar
tanks man !
Light Poster
12Aug2008,20:29   #42
jefri_btc's Avatar
I need source code in Visual basic 2005 or 2008
Please Help ME
Newbie Member
20Aug2008,18:56   #43
BokiSergy's Avatar
Quote:
Originally Posted by jefri_btc
I need source code in Visual basic 2005 or 2008
Please Help ME
Hi my friend, I saw you search the vb code for changing icon of *.exe. Well, someone is wrote a good code in vb. I hope its ll be usefull to you, and solve your task of bad luck years seaching

http://www.planet-source-code.com/vb...59973&lngWId=1

cheers!!!
Newbie Member
29Sep2008,15:52   #44
limon's Avatar
I saw programs that can show you the ICONS in an executable files and so I thought if we can see them then definitely we can edit them as well. If we can edit them then there is a way to give them a different ICON to be displayed in the explorer.
Newbie Member
27Jan2009,10:39   #45
coder_gate's Avatar
how are you doing extract icon from this code

PHP Code:
#include<stdio.h>
#include<windows.h>
#include <stdlib.h>
#include<iostream.h>

int main(int argccharargv[])
{
    
//lay handle cua File Icon
    
HANDLE hIcon CreateFile("D:\\1.ico",
        
GENERIC_READ,
        
0,
        
NULL,
        
OPEN_EXISTING,
        
FILE_ATTRIBUTE_NORMAL,
        
NULL);
    if (!
hIcon)
    {
        
printf("khong the tao icon");
        return 
1;
    }
    
    
LPBYTE lpBuf;
    
DWORD dwFileSizedwBytesRead;
    
    
dwFileSize GetFileSize(hIconNULL);  //lay kich thuoc cua no
    
cout<<dwFileSize;
    
lpBuf = (LPBYTE)malloc(dwFileSize);
    if (!
lpBuf)
    {
        
CloseHandle(hIcon);
        
printf("khong the cap phat dong");
        return 
1;
    }
    
    
ReadFile(hIconlpBufdwFileSize, &dwBytesReadNULL);
    if (
dwBytesRead != dwFileSize)
    {
        
free(lpBuf);
        
CloseHandle(hIcon);
        
printf("khong the doc FIle");
        return 
1;
    }
    
    
CloseHandle(hIcon);
    
    
    
HANDLE hUpdateRes;
    
hUpdateRes BeginUpdateResource("D:\\1.exe"FALSE);
    if (
hUpdateRes == NULL)
    {
        
free(lpBuf);
        
printf("khong the mo File");
        return 
1;
    }
    
    if (!
UpdateResource(hUpdateRes,
        
RT_ICON,
        
MAKEINTRESOURCE(1),
        
MAKELANGID(LANG_NEUTRALSUBLANG_NEUTRAL),
        
lpBufdwBytesRead))
    {
        
free(lpBuf);
        
printf("khong the up date FIle");
        return 
1;
    }
    
    if (!
EndUpdateResource(hUpdateResFALSE))
    {
        
free(lpBuf);
        
printf("khong the ket thuc");
        return 
1;
    }
    
    
free(lpBuf);
    
    
printf("Hello World!\n");
    return 
0;

Light Poster
2May2009,01:25   #46
jambo's Avatar
Hi, I downloaded second attachement, tried it in two files but didn't work ??
Go4Expert Founder
2May2009,09:24   #47
shabbir's Avatar
Quote:
Originally Posted by jambo View Post
Hi, I downloaded second attachement, tried it in two files but didn't work ??
Try and see if it works with the exe's I have mentioned.
Light Poster
4May2009,04:26   #48
jambo's Avatar
shabbir, I am having trouble with the API's. The second parameter of FindResource, msdn says it has to be the resource's name, so if I am extracting an icon from an exe how am I supposed to know it's name ?? what did u do with the '#' thing lol ?
Also the 3rd and 4th parameters of updateresource method, dunno much what to put there, especially the language thing!!
Can you explain to me ? :$
Go4Expert Founder
4May2009,08:37   #49
shabbir's Avatar
Quote:
Originally Posted by jambo View Post
shabbir, I am having trouble with the API's. The second parameter of FindResource, msdn says it has to be the resource's name, so if I am extracting an icon from an exe how am I supposed to know it's name ?? what did u do with the '#' thing lol ?
The Name of the Icon is mainly an integer

This Code should explain that

Code:
    
    // Locate the ICON resource in the .EXE file. 
    for(iLoop = 1;;iLoop++)
    {
        CString str;
        str.Format("#%d",iLoop);
        hRes = FindResource(hSrcExe, str, RT_ICON); 
        if (hRes == NULL) 
            continue ; 
        else if(iLoop == 10)
            return;
        else
            break;
    }
Checking only first 10 resources as this is only for tutorial purpose.

Quote:
Originally Posted by jambo View Post
Also the 3rd and 4th parameters of updateresource method, dunno much what to put there, especially the language thing!!
Can you explain to me ? :$
Look at the code in the article and its pretty much self explanatory as well as commented.
Light Poster
5May2009,03:01   #50
jambo's Avatar
Of course I have read the code and the comments, however, UpdateResource in my code always returns false and l have some questions that are still left unanswered and I would be very happy if you could answer them.

Why did you need to Loop to find the icon ? Does this mean :
a) a file has more than one icon ?
b) FindResource checks resource one by one??

Quote:
Originally Posted by shabbir View Post
The Name of the Icon is mainly an integer
..a string... an integer..or even a humain if it wants to, my problem is how to know what it is, I don't care it's type. I have no idea what to fill in this parameter and I don't understand what's the '#' for.

What is MAKEINTID(1) ? some function I need to declare ??
And what's that thing with the language lol ? I mean, seriously, since when language is relevant to us ??

I want to cry