Recent

Author Topic: BorDlg and BorDlg_grey not close from my app  (Read 2014 times)

nacsasoft

  • Newbie
  • Posts: 2
BorDlg and BorDlg_grey not close from my app
« on: March 28, 2019, 10:00:08 am »
Hi Lazarus Fans!

I have a problem. I'd like close a "Bordlg" and "BorDlg_Grey" type windows from my application. I use the FindWindow winapi function but I not recognize the window with name. I see these bordlg wins properties with winspy app (see https://drive.google.com/file/d/1mYSzI7P8GAezGt9vGpe06YY9hWjArGRl/view?usp=sharing image).
I don't send this windows with WM_CLOSE action because I don't get these windows HWND.
I tested my app with other app (notepad) and work correct!!

This is the code:
Code: Pascal  [Select][+][-]
  1. var
  2.   wHandle: THandle;
  3.  
  4. begin
  5.  
  6.   wHandle := FindWindow(nil, PChar(edtProgramName.Text));
  7.  
  8.   if wHandle <> 0 then
  9.       PostMessage(wHandle, WM_CLOSE, 0, 0)
  10.   else
  11.       ShowMessage('Bezárás nem sikerült! (valszeg az ablak már nincs nyitva!!)');
  12.   exit;
  13.  
  14. end;
  15.  

Thank You for helps!!

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11446
  • FPC developer.
Re: BorDlg and BorDlg_grey not close from my app
« Reply #1 on: March 28, 2019, 12:10:24 pm »
"BorDLG" is listed as the class in your screenshot, not the window title. As per msdn, the first argument of findwindow is class, (which you set to nil), and the second is the title.

My guess is that what you see with "caption" is the title.

Good luck!

nacsasoft

  • Newbie
  • Posts: 2
Re: BorDlg and BorDlg_grey not close from my app
« Reply #2 on: March 28, 2019, 01:18:10 pm »
Hi marcov!

Thanks the quick response!!
I now test my app with next parameters:

Code: Pascal  [Select][+][-]
  1. wHandle := FindWindow('bordlg', PChar(edtProgramName.Text));
  2.  
  3.   if wHandle <> 0 then
  4.       PostMessage(wHandle, WM_CLOSE, 0, 0)
  5.   else
  6.       ShowMessage('Bezárás nem sikerült! (valszeg az ablak már nincs nyitva!!)');
  7.   exit;
  8.  

When edtProgramName.Text = window caption (on the image - '1 Zóna Fűtőszál') .
Not work....no close the bordlg window...

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11446
  • FPC developer.
Re: BorDlg and BorDlg_grey not close from my app
« Reply #3 on: March 28, 2019, 03:16:00 pm »
It doesn't seem to have a windowproc to handle closing. Anyway, my gdi is not that strong.

 

TinyPortal © 2005-2018