![]() |
MAINICON laden
Das Anwendungsicon legt Delphi mit der Ressourcen ID MAINICON in der Ressource ab. Wie komme ich jetzt an das Icon über die ID dran?
Delphi-Quellcode:
Wenn ich bei MAKEINTRESOUORCE 'MAINICON' angebe passiert nichts.
class procedure TAboutWnd.MsgBox(hParent: THandle; IconID: DWORD);
var MsgInfo : TMsgBoxParams; s: String; begin s := Format('%s - %s' + #13#10#13#10 + '%s' + #13#10 + '%s', [TAboutWnd.GetFileInfo(ParamStr(0), 'ProductName'), TAboutWnd.GetFileVersion(ParamStr(0)), COPYRIGHT, URI]); MsgInfo.cbSize := SizeOf(TMsgBoxParams); MsgInfo.hwndOwner := hParent; MsgInfo.hInstance := GetWindowLong(hParent, GWL_HINSTANCE); MsgInfo.lpszText := PChar(s); MsgInfo.lpszCaption := PChar(TAboutWnd.GetFileInfo(ParamStr(0), 'ProductName')); MsgInfo.dwStyle := MB_USERICON; MsgInfo.lpszIcon := MAKEINTRESOURCE(IconID); MessageBoxIndirect(MsgInfo); end; |
Re: MAINICON laden
Notfalls über TResourceStream in ein TIcon reinladen und dessen Handle verwenden.
ach nee, diese API will wohl die Resource :gruebel: |
Re: MAINICON laden
Am einfachsten geht es über
Delphi-Quellcode:
Application.Icon
|
Re: MAINICON laden
[quote="Luckie"]Das Anwendungsicon legt Delphi mit der Ressourcen ID MAINICON in der Ressource ab. Wie komme ich jetzt an das Icon über die ID dran?
[add] Zitat:
Delphi-Quellcode:
oder meinen die es so?
MsgInfo.hInstance := 0;
MsgInfo.dwStyle := MB_USERICON; MsgInfo.lpszIcon := MAKEINTRESOURCE(LoadIcon(GetWindowLong(hParent, GWL_HINSTANCE), IDI_APPLICATION));
Delphi-Quellcode:
MsgInfo.hInstance := 0;
MsgInfo.dwStyle := MB_USERICON; MsgInfo.lpszIcon := IDI_APPLICATION; |
Re: MAINICON laden
Beide Lösungen zeigen das Icon nicht an.
|
Re: MAINICON laden
Aus der Forms.pas:
Zitat:
|
Re: MAINICON laden
Ich brauche allerdings eine ID und kein Handle. Das ist das Problem.
|
Re: MAINICON laden
Dazu hab ich im Moment leider auch keine Idee.
|
Re: MAINICON laden
|
Re: MAINICON laden
Nein, ich will ja keine Ressource ändern.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:46 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz