Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I'm calling a modal dialog from a java application. But if I click out of that, dialog is minimizing which I don't want because it is a modal dialog box. I have tried by giving property WS_EX_TOPMOST but it is always showing dialog on top even if I switch to other applications.

I have two scenarios where I have to launch my dialog

1. From a MFC application which is working fine.
2.From a Java application which is not working as a modal dialog.


so can anyone give any sugestions how can I make my dialog as modal only even if I call from other application.

Thanks.

What I have tried:

C++
MysampleModalDailogObj->CreateModal(WS_EX_CONTROLPARENT, sl,
					WS_OVERLAPPED|WS_SYSMENU|WS_CAPTION|WS_BORDER|WS_POPUP|WS_THICKFRAME, 
					0,0,tempcx, tempcy, NULL, 0)
rtn = MysampleModalDailogObj->DoModal();
if(rtn == IDOK)
{}
else
{}
Posted
Updated 5-Feb-17 23:31pm
v3
Comments
Jochen Arndt 6-Feb-17 6:19am    
How do you call a MFC dialog from a Java application?
Do you execute the MFC application from your Java application?

Window modality refers only to windows within one process. If you launch another process from an application there is no way to make this process modal for the calling one. You can only set the child process to be always on top.
cppcoder1 6-Feb-17 6:24am    
Unfortunately I don't have code base for other application. So I don't have any idea how they are calling but calling. I have tried using style WS_EX_TOPMOST and SetWindowPos(&this->wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); to keep my dialog is on top always. But WS_EX_TOPMOST is making my dialog always on top even if I switch to other application. The second one is not working.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900