1. Rick Domogalik
  2. PowerBuilder
  3. Thursday, 26 March 2020

I have a small stand alone application that is fired when a user adds a document to our database.  I want to make it so that the application always sits on top of any other window/program that the user has open on their computer and ideally, the user cannot click outside of the application until they fill in the info on the sheet and click ok, or cancel.  So in a nutshell, I want it to lock up the computer until the user deals with the window.

I have tried using SetForegroundWindow( HWND ) and this pops it to the top, but can easily be pushed to the back again with a click outside the program.

 

Anyone have some code to accomplish this?

 

Rick

Who is viewing this page
Chris Pollach @Appeon Accepted Answer Pending Moderation
1
Votes
Undo

Hi Rick;

   FWIW:  I have done this before by basically coding the Window's "Deactivate" event, issuing a POST SetFocus() and then a Yield() command. That had the effect of holding the user on my Window dialogue until they completed the processing task that I wanted them to. Then I would close the Window by setting an instance variable (ie "ib_ok_2_Close = TRUE) where the Deactivate event would then ignore the Deactivate event code.

HTH

Regards ... Chris

Comment
There are no comments made yet.
  1. Thursday, 26 March 2020
  2. PowerBuilder
  3. # 1
John Fauss Accepted Answer Pending Moderation
1
Votes
Undo

Greetings, Rick -

You are describing what Windows calls "application modal" behavior. The underlying issue is that this behavior is predicated on a single application, not multiple.

A PB window of type Response within a single PB application implements this behavior. By having this other "response-like" window in a separate application (process/thread), you're attempting to make Windows mimic application modal interaction, or synchronize behavior between two threads. This might be technically doable utilizing the Windows API, given enough time and Red Bull (or Mountain Dew) - but probably not feasible. Could you implement the functionality provided by the other application in a response window added to your PB app?

Regards, John

Comment
I agree with John.

ALSO: You risk coming in conflict with system security if your app takes precedence towards the user over all other functionality running on user's machine.

/Michael
  1. Michael Kramer
  2. Thursday, 26 March 2020
There are no comments made yet.
  1. Thursday, 26 March 2020
  2. PowerBuilder
  3. # 2
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.