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

progress bar and disabling other buttons

Intel_C_Intel
Employee
561 Views
hi,
i want to add a progress bar to my dialog application and disable other buttons as i push RUN button. i couldnt manage it to run simultaneously while the program calculates something. i checked the example written by Jugoslav Dujic, ThreadDlg. but i think it is quickwin application.since i am a beginner i couldnt translate it into dialog application.here is the code i wrote. what should i do?

lret = DlgSetSub(dlg, IDM_RUN, Run)

lret = DlgSet(Dlg,IDC_PROGRESS1,0,DLG_RANGEMIN)
lret = DlgSet(Dlg,IDC_PROGRESS1,100,DLG_RANGEMAX)
lret = DlgSet(Dlg,IDC_PROGRESS1,0)

lret = DlgModeless(dlg, nCmdShow)

end do
!******************************************************

SUBROUTINE Calculate( dlg )

.......

lret = DlgSet(dlg, IDOK, .false., DLG_ENABLE)
lret = DlgSet(dlg, IDM_EXIT, .false., DLG_ENABLE)
lret = DlgSet(dlg, IDCANCEL, .true., DLG_ENABLE)

do i=1, 1d+8
b = 15*b + 25*b**2 + b/114
end do
write (text, *) b
lret = DlgSet(dlg, IDC_EDIT, adjustl(text))
....
END SUBROUTINE Calculation

!***********************************************

SUBROUTINE Run( dlg, id, callbacktype )

.....
if (callbacktype == dlg_clicked) then
lret = DlgSet(Dlg, IDC_PROGRESS, 0)
call Work( dlg )
lret = DlgSet(dlg, IDOK, .true., DLG_ENABLE)
lret = DlgSet(dlg, IDM_EXIT, .true., DLG_ENABLE)
lret = DlgSet(dlg, IDCANCEL, .false., DLG_ENABLE)

end if

END SUBROUTINE RunWork

0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
561 Views
Why can't you translate it? ThreadDlg is a console application and uses none of QuickWin routines (except a WRITE(*,*) used just for test). Just replace PROGRAM statement with WinMain(...) and recompile as Windows application:
!PROGRAM ThreadDlg
INTEGER FUNCTION WinMain(hI, hPI, lpsC, nShow)
!DEC$ATTRIBUTES STDCALL, ALIAS: "_WinMain@16":: WinMain
INTEGER::         hI, hPI, lpsC, nShow
.
Your code, as posted, contains a lot of syntax errors so I'd refrain from comments at the moment.

Jugoslav


0 Kudos
Reply