int szFile;
BYTE *lpBuffer;
DWORD dwRead;
HANDLE hResource;
HANDLE hFile=CreateFile("E:\\aa.ico", GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_N ORMAL,NULL);
if (hFile==INVALID_HANDLE_VALUE)
return;
szFile=int(GetFileSize(hFile,NULL));
lpBuffer = new BYTE[szFile];
ReadFile(hFile,lpBuffer,sizeof(lpBuffer),&dwRead,N ULL);
hSrcExe = LoadLibraryEx("E:\\a.exe",NULL, LOAD_LIBRARY_AS_DATAFILE);
if(hSrcExe == NULL)
return;
hRes = FindResource(hSrcExe, MAKEINTRESOURCE(1), RT_ICON);
if (hRes == NULL)
return;
FreeLibrary(hSrcExe);
hResource = BeginUpdateResource("E:\\a.exe", FALSE);
if (hResource == NULL) return ;
result = UpdateResource(hResource,RT_ICON,MAKEINTRESOURCE(1 ),MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),(LPVOID)lpBuffer,sizeof(lpBuff er
if (result == FALSE) return ;
EndUpdateResource(hResource, FALSE);
CloseHandle(hFile);
delete[] lpBuffer;

it can replace the defaulte icon but can't display the aa.ico in the EXE file ,i don't know the reason
can you tell me what's wrong with above codes and give a complete code for this?
thanks!