Autor Beitrag
Mike_C
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 207

Win XP
D7 Enterprise
BeitragVerfasst: Sa 22.03.03 13:30 
Hi!

Wenn ich mit ExtractIcon die Anzahl von Icons in einer DLL/EXE ermitteln will, bekomme ich als Fehlermeldung eine Subrange violation

Ich muss das doch so machen:

ausblenden Quelltext
1:
2:
3:
4:
var AnzIcon : integer;
...
AnzIcon := ExtractIcon(HInstance, 'Delphi32.exe',-1)
...

so wurde es jedenfalls MIMI gesagt (www.delphi-forum.de/...light=icon+dll+laden-> MIMI's Beitrag zu diesem Thema). Ob's gefunzt hat weiß ich nicht... Bei mir funzt es nicht.
Kann mir einer sagen warum?

EDIT: Ich verwende Delphi 7.0.
In dieser Version ist der letzte Parameter von ExtractIcon ein CARDINAL. Kann es sein, dass ein Cardinal bei NULL anfängt? Wenn ja, wie kann ich das umgehen?

_________________
Life is, what some people call a mystery. To me life's just a lesson, you're learning when you're through. So why do we try to understand?
Mike_C Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 207

Win XP
D7 Enterprise
BeitragVerfasst: Sa 22.03.03 14:28 
OK. Das Problem hat sich gelöst.

Lösung:
ausblenden Quelltext
1:
2:
3:
...
AnzIcons := ExtractIcon(HInstance, 'Delphi32.exe',Cardinal(-1));
...


Das Problem war tatsächlich, dass ein Cardinal bei NULL anfängt. Über den TypeCast kommen aber vernünftige Ergebnisse zurück...

_________________
Life is, what some people call a mystery. To me life's just a lesson, you're learning when you're through. So why do we try to understand?