Thanks Paul, that will help.
I'm posting crude demo example for others to take a look too. Here are two functions, if you chose
i=SomeFaultyFunction()
then you'll get the error as i described it above which emulates that the code tried to open Window 2 with the warning that something was wrong. If you instead will take this function
i=SomeFaultyFunction2()
then you'll get Paul's workaround.
integer SomeFaultyFunction, SomeFaultyFunction2
external SomeFaultyFunction, SomeFaultyFunction2
i=winio@('%ww%ca[Window 1]&')
i=winio@(' Temperature %ta%rd%ff&',iT)
i=SomeFaultyFunction2()
i=winio@(' Density [g/cm3]%ta%rd%ff&',iD)
i=winio@('%ac[esc]','exit')
end
!........................................
integer function SomeFaultyFunction()
i=winio@('%ww%ca[Window 2]&')
i=winio@('%si! Error Occured during reading file aaaaa.dat %ff&')
i=winio@('%cn%bt[OK]%ac[esc]','exit')
SomeFaultyFunction=1
end function
!........................................
integer function SomeFaultyFunction2()
stdcall MessageBox 'MessageBoxA'(VAL,STRING,STRING,VAL):integer
integer,parameter::MB_ICONEXCLAMATION=Z'30'
i = MessageBox(0,'Failure message...','Caption',MB_ICONEXCLAMATION)
SomeFaultyFunction2=1
end function
As a related question, or suggestion -- wouldn't it be possible to implement in future CWP that it treats every call to %ww as signal to create the new window? Now %ww just gives some options and can be used many times. The need to open another window while first is not yet finished should be very common in complex GUIs and the warnings may need to contain a lot of information but it will be hard to do that with WinAPI calls. (Users which are unfamiliar with the code can do a hell of unimaginable stupid things and when you program you need to make huge amount of fool-proof workarounds and help messages to guide them). Such extension of CWP looks to me as very natural and logical approach, but i do not know how hard it will be to implement something like that