!  LessonA34.f90 
!
!  FUNCTIONS:
!	LessonA34      - Entry point of console application.
!
!	Example of displaying 'Hello World' at execution time.
!

!****************************************************************************
!
!  PROGRAM: LessonA34
!
!  PURPOSE:  Entry point for 'Hello World' sample console application.
!
!****************************************************************************

	program LessonA34

	implicit none

	integer i

	interface
        integer function CreatePopupChartWndGlobal(hwnd, charttype, title, x, y, cx, cy)
          !DEC$ATTRIBUTES DLLIMPORT,ALIAS:'?CreatePopupChartWndGlobal@Classless@@YAPAUHWND__@@PAU2@HPADHHHH@Z'::CreatePopupChartWndGlobal
          !DEC$ATTRIBUTES VALUE::hwnd, charttype, title, x, y, cx, cy
		  integer hwnd, charttype, title, x, y, cx, cy
		end function CreatePopupChartWndGlobal

		integer function AddPoint2D(x, y, dataIndex, plotIndex)
          !DEC$ATTRIBUTES DLLIMPORT,ALIAS:'?AddPoint2D@Classless@@YAHNNHH@Z'::AddPoint2D
          !DEC$ATTRIBUTES VALUE::x, y, dataIndex, plotIndex
		  double precision x, y
		  integer dataIndex, plotIndex
		end function AddPoint2D

		subroutine SetTitle(title)
		  !DEC$ATTRIBUTES DLLIMPORT,ALIAS:'?SetTitle@Classless@@YAXPBD@Z'::SetTitle
		  !DEC$ATTRIBUTES VALUE::title
		  integer title
		end subroutine SetTitle

		subroutine ReDraw()
		  !DEC$ATTRIBUTES DLLIMPORT,ALIAS:'?ReDraw@Classless@@YAXXZ'::ReDraw
		end subroutine ReDraw

		integer function SimpleMsgLoop()
          !DEC$ATTRIBUTES DLLIMPORT,ALIAS:'?SimpleMsgLoop@NsCChart@@YAHXZ'::SimpleMsgLoop
		end function SimpleMsgLoop
    end interface 

	print *, 'Hello World'

	print *, "创建弹出窗口..."
	call CreatePopupChartWndGlobal(0, 0, LOC("窗口标题"C), 50, 50, 600, 450)

	print *, "设置标题"
	call SetTitle(LOC("Fortran标题"C))

	print *, "添加数据点..."
	do i = -10, 10, 1
	  call AddPoint2D(i, i*i*i, 0, 0);
	end do

	print *, "重绘..."
	call ReDraw()

	print *, "建立消息循环..."
	call SimpleMsgLoop()

	end program LessonA34

