Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Start-up window of a program

reidar
New User
427 Views

Can anyone tell how a start-up window can be arranged in a Windows program? The start up window shows different stuff and closes before the main window appears...

Any hints?

 

 

0 Kudos
8 Replies
Kevin_D_Intel
Employee
427 Views

I’m not experienced with creating Windows-based apps. There is this pdf, Using Intel(R) Visual Fortran to Create and Build Windows*-Based Applications, that may contain some helpful advice.

What type of Fortran project are you using?
Could you attach a complete project that demonstrates the behavior?

0 Kudos
reidar
New User
427 Views

Thank you for your interest!

My project I can not upload to this site for various reasons :-)  Maybe later I can release a simplified version..However I recommend the book shown below, besides the textbook "Programming Windows 95" by Charles Petzold. This book is written for C-programmers, however it explains a lot of listboxes etc that can be  implemented directly in CVF/IVF and works fine with Windows 10!

I think is would be good if also fortran programmers were able to build a decent user interface getting rid of the black console. Good luck!

http://store.elsevier.com/Compaq-Visual-Fortran/Norman-Lawrence/isbn-9780080488523/

0 Kudos
Steven_L_Intel1
Employee
427 Views

I am not sure what you mean by "startup window". The typical Fortran program is a console application, but it is not difficult to write a :"Windowing application" and we provide many examples of this, plus several predefined ones you can create in a new project. Also see https://software.intel.com/en-us/compiler_winapp_f

0 Kudos
reidar
New User
427 Views

By "start-up" window, for example MS Word displays a window during initializing showing a logo and then close before the main window appears..

0 Kudos
jimdempseyatthecove
Honored Contributor III
427 Views

A Window (example a Dialog box) can be created visible (normal) or hidden. At program start, you can create a modeless Dialog box to display your startup information, and it stays running until your main program (creating other windows with hidden) issues a close message to your startup window, and then makes visible the main window(s).

https://msdn.microsoft.com/en-us/library/aa984358(v=vs.71).aspx

An alternate way is for the "main" window to be the Startup splash window, which is visible, and which creates the child windows as processes with hidden attributes. When initialization completes, the main window hides itself, and notifies the child windows/processes to show themselves.

Someone else here may have a simple example.

Jim Dempsey

0 Kudos
jirina
New Contributor I
427 Views

What you are looking for is called splash screen and you can google how splash screen can be done; there are various approaches.

0 Kudos
Paul_Curtis
Valued Contributor I
427 Views

I create a splash screen as a modal dialog which appears on top of whatever else the program may have drawn on its main window.  A sample proc function for such a startup dialog is shown below.  In this sample code the dialog is configured with a progress bar which is periodically reset to docmuent an overall timeout period after which the splash screen automatically disappears.  The actual splash screen has a variety of other buttons and checkboxes allowing the user to set or override various main-program functions prior to the actual start of the main program.

INTEGER FUNCTION StartupProc (hwnd, msg, wParam, lParam) RESULT (res)
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_StartupProc@16' :: StartupProc
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'StartupProc' :: StartupProc
!DEC$ ENDIF
	USE comctl32
    IMPLICIT NONE
    SAVE
    
    INTEGER(HANDLE),  INTENT(IN)   :: hwnd
    INTEGER(UINT),    INTENT(IN)   :: msg
    INTEGER(fWPARAM), INTENT(IN)   :: wParam
    INTEGER(fLPARAM), INTENT(IN)   :: lParam
									
    INTEGER							:: rval
    INTEGER(HANDLE), SAVE			:: hwndControl, hwprogressbar
    INTEGER							:: controlId
    INTEGER							:: code

	!	total delay of max_periods x period_delay, value in milliseconds	
	INTEGER, SAVE					:: period_count
	INTEGER, PARAMETER				:: period_delay = 200, max_periods = 50
									
    res = DefaultDialogProc (hwnd, msg, wParam, lParam)

    SELECT CASE (msg)

    CASE (WM_INITDIALOG)
		CALL InitCC (ICC_PROGRESS_CLASS)
		
		period_count = 0
		rval = SetTimer (hwnd, 1, period_delay, NULL)	! delay in milliseconds
		
		hwprogressbar = GetDlgItem (hwnd, IDC_STARTUP_PB)
		rval = SendMessage (hwprogressbar, PBM_SETRANGE, 0, MakeLong(INT2(0), INT2(max_periods)))
		rval = SendMessage (hwprogressbar, PBM_SETPOS,   0, 0)
		rval = SendMessage (hwprogressbar, PBM_SETSTEP,  1, 0)
		
	CASE (WM_PAINT)
		!... inserts graphic content onto the splash window
		res = 1

    CASE (WM_COMMAND)
        code		= HIWORD(wParam)
        controlId	= LOWORD(wParam)
        hwndControl = lParam
        SELECT CASE (controlId)

		CASE (IDOK)
			CALL read_startup_controls (hwnd)
			res = 1

		CASE (IDCANCEL)
			rval = KillTimer (hwnd, 1)
			rval = EndDialog (hwnd, IDCANCEL)
			res = 1

        END SELECT

    CASE (WM_TIMER)
		period_count = period_count + 1
		IF (period_count < max_periods) THEN
			rval = SetTimer (hwnd, 1, period_delay, NULL)	! delay in milliseconds
			rval = SendMessage (hwprogressbar, PBM_STEPIT, 0, 0)
		ELSE	
			CALL read_startup_controls (hwnd)
		END IF
		res = 1

	CASE (WM_KEYDOWN)
		SELECT CASE (wParam)
		CASE (VK_SPACE)
			CALL read_startup_controls (hwnd)
		END SELECT
		res = 1

    CASE (WM_DESTROY)

    END SELECT
END FUNCTION StartupProc


SUBROUTINE read_startup_controls (hwnd)
	USE comctl32
	IMPLICIT NONE
	INTEGER(HANDLE), INTENT(IN)		:: hwnd
	INTEGER			        		:: rval

!  ... read the buttons/checkboxes for various items

	rval = KillTimer (hwnd, 1)
	rval = EndDialog (hwnd, IDOK)

END SUBROUTINE read_startup_controls

 

0 Kudos
reidar
New User
427 Views

Thank you all for teaching me and for interesting tips !

0 Kudos
Reply