Recent

Author Topic: Problem with hidding window  (Read 4434 times)

mac_mark

  • Newbie
  • Posts: 3
Problem with hidding window
« on: September 08, 2011, 11:59:29 am »
Hi.

I wrote dll with one form (in Delphi) and I use it in my Lazarus app. But there is a problem, when I open the window from dll (modal) and then open another windows application (or minimize mine) and then I want to get back to my Lazarus app (clicking on windows bar or by ALT+TAB) , the  modal window (from dll) is hidden under inactive main application window.

Can someone help me ?

Arbee

  • Full Member
  • ***
  • Posts: 223
Re: Problem with hidding window
« Reply #1 on: September 08, 2011, 12:34:50 pm »
It is not a solution, but in general it is not good practice to place any user interface components in a dll.  User interaction and (busines) processing should be clearly separated. 
Is it absolutely necessary to have the form in the dll?
1.0/2.6.0  XP SP3 & OS X 10.6.8

mac_mark

  • Newbie
  • Posts: 3
Re: Problem with hidding window
« Reply #2 on: September 08, 2011, 02:54:26 pm »
I agree it's not good  practice. Unfortunatelly in this case, it's necessary.

mac_mark

  • Newbie
  • Posts: 3
Re: Problem with hidding window
« Reply #3 on: September 15, 2011, 01:10:35 pm »
Can someone help me ?

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Problem with hidding window
« Reply #4 on: September 15, 2011, 01:18:40 pm »
What kind of problem is it? Does the operating system treat dll forms as different applications, app coded wrong or maybe even a bug?

Does it go hidden if you open same kind of form without dll? Could you make a simple application to test this?

lazguy

  • Jr. Member
  • **
  • Posts: 78
Re: Problem with hidding window
« Reply #5 on: September 15, 2011, 04:25:43 pm »
At the uses clause of your interface section put the unit windows

At the onPaint event of the inactive form that is hiding the active form put the following code:

Code: [Select]
procedure TForm1.FormPaint(Sender: TObject);
var
  WindowHandler : THandle;
begin
  WindowHandler := FindWindow(nil,'HereYouPutTheCaptionOfTheWindowYouWantToBringToForeground');
  if WindowHandler > 0 then
  begin
    SetForegroundWindow(WindowHandler);
  end;
end;


http://www.guilhermevasconcelos.com.br/en-US/

 

TinyPortal © 2005-2018