I'm using this code to take the icon from an exe and replace the icon in another exe, but it doesn't work. Every time lpBuffer is empty after GlobalLock. the hIcon handle is retrieved by ExtractIcon();Code:HICON hIcon; LPBYTE lpBuffer; hIcon=dlg.GetIconHandle(); lpBuffer=(LPBYTE)::GlobalLock(hIcon); HANDLE hUpd=BeginUpdateResource("D:\\n.exe",0); UpdateResource((HMODULE)hUpd, RT_ICON,MAKEINTRESOURCE(1), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPBYTE)lpBuffer, GlobalSize(hIcon)); EndUpdateResource(hUpd, FALSE); GlobalUnlock(lpBuffer);
What am I doing wrong?
Please help!![]()