Click here to Skip to main content
15,889,693 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DLL and .Exe Pin
Saurabh.Garg17-Feb-10 17:10
Saurabh.Garg17-Feb-10 17:10 
QuestionHow to load a bitmap into a Toolbar from Resource Manager? Pin
Software200717-Feb-10 2:07
Software200717-Feb-10 2:07 
AnswerRe: How to load a bitmap into a Toolbar from Resource Manager? Pin
Eugen Podsypalnikov17-Feb-10 3:26
Eugen Podsypalnikov17-Feb-10 3:26 
QuestionCRITICAL SECTION AND MUTEX Pin
ramina sen17-Feb-10 0:58
ramina sen17-Feb-10 0:58 
AnswerRe: CRITICAL SECTION AND MUTEX Pin
Adam Roderick J17-Feb-10 1:13
Adam Roderick J17-Feb-10 1:13 
AnswerRe: CRITICAL SECTION AND MUTEX Pin
Roger Stoltz17-Feb-10 1:40
Roger Stoltz17-Feb-10 1:40 
AnswerRe: CRITICAL SECTION AND MUTEX Pin
Cool_Dev17-Feb-10 22:16
Cool_Dev17-Feb-10 22:16 
Questionproblem in updating the icon Pin
learningvisualc16-Feb-10 23:38
learningvisualc16-Feb-10 23:38 
Hi all,

i want to replace a exe default icon with any other icon. i have written this code to do this
HANDLE hFile;
DWORD dwFileSize,  dwBytesRead;
LPBYTE lpBuffer;
HANDLE hResource;
	
HRSRC hRes;         // handle/ptr. to res. info. in hExe 
HANDLE hUpdateRes;  // update resource handle 
char *lpResLock;    // pointer to resource data 
HRSRC hResLoad;     // handle to loaded resource 
BOOL result; 
HMODULE hSrcExe,hDestExe;
int iLoop;

hFile = CreateFile("E:\\icon.ico", 
		GENERIC_READ,
		FILE_SHARE_READ,
		NULL,
		OPEN_EXISTING,
		FILE_ATTRIBUTE_NORMAL,
		NULL);

if (INVALID_HANDLE_VALUE != hFile)
{
	dwFileSize = GetFileSize(hFile, NULL);
	lpBuffer = new BYTE[dwFileSize];
	int aa = ReadFile(hFile, lpBuffer, dwFileSize, &dwBytesRead, NULL);
	hResource = BeginUpdateResource("E:\\xyz.exe", FALSE);

	if (NULL != hResource)
	{
		if (UpdateResource(hResource,
				RT_ICON,
				MAKEINTRESOURCE(1),
				MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
				(LPVOID) lpBuffer,
				dwFileSize) != FALSE)
			{        
				EndUpdateResource(hResource, FALSE);
			}
	}
}

but its not updating the icon...

I am not getting where is the problem. Can anybody help me in this...

Thanks in advance
AnswerRe: problem in updating the icon Pin
Richard MacCutchan17-Feb-10 0:59
mveRichard MacCutchan17-Feb-10 0:59 
GeneralRe: problem in updating the icon Pin
learningvisualc17-Feb-10 1:34
learningvisualc17-Feb-10 1:34 
GeneralRe: problem in updating the icon Pin
Richard MacCutchan17-Feb-10 3:07
mveRichard MacCutchan17-Feb-10 3:07 
AnswerRe: problem in updating the icon Pin
HetzelGJ17-Feb-10 4:41
HetzelGJ17-Feb-10 4:41 
QuestionReading And Writing On The Same File Pin
jannathali16-Feb-10 21:24
jannathali16-Feb-10 21:24 
AnswerRe: Reading And Writing On The Same File Pin
«_Superman_»16-Feb-10 21:30
professional«_Superman_»16-Feb-10 21:30 
AnswerRe: Reading And Writing On The Same File Pin
KingsGambit16-Feb-10 21:50
KingsGambit16-Feb-10 21:50 
GeneralRe: Reading And Writing On The Same File Pin
vkpMark16-Feb-10 22:57
vkpMark16-Feb-10 22:57 
Questionremote sensing row image simulatetor Pin
a.jalaee16-Feb-10 20:07
a.jalaee16-Feb-10 20:07 
AnswerRe: remote sensing row image simulatetor Pin
KingsGambit16-Feb-10 21:09
KingsGambit16-Feb-10 21:09 
QuestionWhat is the value of Ctrl+Z in terms of CString? Pin
Le@rner16-Feb-10 19:43
Le@rner16-Feb-10 19:43 
AnswerRe: What is the value of Ctrl+Z in terms of CString? Pin
KingsGambit16-Feb-10 20:16
KingsGambit16-Feb-10 20:16 
GeneralRe: What is the value of Ctrl+Z in terms of CString? Pin
Le@rner16-Feb-10 20:17
Le@rner16-Feb-10 20:17 
GeneralRe: What is the value of Ctrl+Z in terms of CString? Pin
Mircea Puiu16-Feb-10 20:24
Mircea Puiu16-Feb-10 20:24 
GeneralRe: What is the value of Ctrl+Z in terms of CString? Pin
KingsGambit16-Feb-10 20:26
KingsGambit16-Feb-10 20:26 
GeneralRe: What is the value of Ctrl+Z in terms of CString? Pin
«_Superman_»16-Feb-10 21:31
professional«_Superman_»16-Feb-10 21:31 
GeneralRe: What is the value of Ctrl+Z in terms of CString? Pin
Le@rner16-Feb-10 22:13
Le@rner16-Feb-10 22:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.