Skip to main content

We are using WPF with Visual COBOL in our software, and our software is setup where our screens display in tabs.  

I need to figure out a way to check to see if the user has a program open in one tab, and then tries to run that exact program from a call statement in another program. 

I want to display an error message letting them know that the program is already open on another tab.

Is there a way to do this? 

We are using WPF with Visual COBOL in our software, and our software is setup where our screens display in tabs.  

I need to figure out a way to check to see if the user has a program open in one tab, and then tries to run that exact program from a call statement in another program. 

I want to display an error message letting them know that the program is already open on another tab.

Is there a way to do this? 

Closing this  - I found a way to do this by using the GETINSTANCE command


We are using WPF with Visual COBOL in our software, and our software is setup where our screens display in tabs.  

I need to figure out a way to check to see if the user has a program open in one tab, and then tries to run that exact program from a call statement in another program. 

I want to display an error message letting them know that the program is already open on another tab.

Is there a way to do this? 

can you share your experience / code with getinstance?


can you share your experience / code with getinstance?

01 prgname pic x(20).
01 callername pic x(8).
01 thisinstance type MYPROGRAM.

procedure division using entrypoint as type String
prgtocall as type String
returning callokay as condition-value.

set callokay to false.
set thisinstance to GETINSTANCE().

e::ProgramOnTab(prgtocall)
invoke thisinstance::SelectProgramTab(prgtocall)
else
invoke GETINSTANCE()::SetProgramActive(prgtocall)
*> need to associate program with entry point
invoke GETINSTANCE()::ProgramAndEntryPoint::Add(prgtocall, entrypoint)
set callokay to true
end-if.

end method.