Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
29304 Discussions

Custom Icon at the upper-left corner of a window (Fortran 11.1.054)

Olivier_M_1
Beginner
701 Views
Dear,

I see my custom Icon next to the name of my program but when the application is running, I neither see it in the upper-left corner of the main program window nor in the other windows.

What is the Fortran statement to use the Identifier coresponding to a custom Icon, for example IDI_iconappname, to show the Icon in an upper-left window of a program?

Sincerly Yours,
Olivier
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
701 Views

For display in Explorer and shell, Windows automatically scans your .exe for icons and picks up the first one (by numeric order of icon ID).

To display the icon in the window's top-left corner, you have to use the Windows API functions:

[fortran]use DFWIN
include "resource.fd"
...
integer(HANDLE):: hIcon
integer(HANDLE):: hWnd
...
hIcon = LoadIcon(GetModuleHandle(0), IDI_MYICON)
ret = SendMessage(hWnd, WM_SETICON, ICON_SMALL, hIcon)
[/fortran]
where IDI_MYICON is the identifier of the icon as you typed it in resource editor, and hWnd is handle of your main application window. If your application is QuickWin one, you can retrieve that handle using GETHWNDQQ(QWIN$FRAMEWINDOW).

0 Kudos
Reply