Mega Code Archive

 
Categories / Delphi / Forms
 

Using one of Windows` common icons as the icon for your form

Title: Using one of Windows` common icons as the icon for your form Question: How can I put one of those MessageBox icons on the titlebar of my form, *without* having to save a snapshot of the messagebox as an icon, and load it? Answer: Just code this for the OnCreate event of the form: {--snip--} procedure TForm1.FormCreate(Sender: TObject); begin Self.Icon.Handle := LoadIcon(0, IDI_WARNING); end; {--snip--} In this case, we are using that yellow triangle... The other available icons are: IDI_APPLICATION IDI_ASTERISK IDI_EXCLAMATION (= IDI_WARNING) IDI_HAND IDI_QUESTION IDI_WINLOGO