MagicFrisbee
Programmer
I have a user that is on Windows 7, 64-bit, and is running my 32-bit application written in Delphi 2010. I am using the ExtractIconEx shell command to extract the icons of programs out on a Netware server. For all other 64-bit clients (Vista and 7), this works as expected. On his machine, however, it actually locks the file and keeps the lock, long after the program has executed. For other users, this lock is acquired and released VERY quickly. I have tried many one- and two-line fixes, but I can't figure out what the problem is. Maybe it's something in my code, maybe it's something about his machine.
What I've tried: Accessing the .exe by IP address and by UNC path, testing GetSystemMetrics to make sure big icons are 32 x 32 and small icons are 16 x 16, made sure that the icons and icon handles ARE freed when they're supposed to.
Here's the code:
With the executables locked, we can't update them on the server. You know how it goes. Any suggestions or "try-this"es are appreciated.
"Roj"
GIS Programmer
City of Orem, UT
What I've tried: Accessing the .exe by IP address and by UNC path, testing GetSystemMetrics to make sure big icons are 32 x 32 and small icons are 16 x 16, made sure that the icons and icon handles ARE freed when they're supposed to.
Here's the code:
Code:
procedure TForm1.Button1Click(Sender: TObject);
var
FilePath: String;
HLargeIco, HSmallIco: HICON;
FLargeIcon, FSmallIcon: TIcon;
begin
FilePath := '\\<IPAddress>\Something.exe';
if ExtractIconEx( PChar(FilePath), 0, HLargeIco, HSmallIco, 1 ) = 2 then
begin
FLargeIcon := TIcon.Create;
FSmallIcon := TIcon.Create;
try
FLargeIcon.Handle := HLargeIco;
FSmallIcon.Handle := HSmallIco;
imgLargeIcon.Picture.Icon := FLargeIcon;
imgSmallIcon.Picture.Icon := FSmallIcon;
finally
FLargeIcon.Free;
FSmallIcon.Free;
end;
end
else
begin
DestroyIcon( HLargeIco );
DestroyIcon( HSmallIco );
end;
end;
With the executables locked, we can't update them on the server. You know how it goes. Any suggestions or "try-this"es are appreciated.
"Roj"
GIS Programmer
City of Orem, UT