LucieLastic
Programmer
hi All
I have a TList containing the Handles of all the Forms open. I add to the list like this:
WindowList.Add(pointer(ViewForm.handle));
I destroy the windows later, like this:
for idx := WindowList.Count -1 downto 0 do
begin
// <-- would like to get the caption of the form here
DestroyWindow(HWnd(WindowList.Items[idx]));
res := GetLastError;
if res = 0
then showmessage('Can not destroy window')
else WindowList.delete(idx);
end;
I occassionally get the 'Can not destroy' coming up but I don't know which window it is. Is it possible to get the caption of the form before destroying it, eg something like:-
WndName := TForm(HWnd(WindowList.Items[idx])).Caption;
I don;t know how to use the HWnd reference with TForm.
Many thanks for any help.
lou
I have a TList containing the Handles of all the Forms open. I add to the list like this:
WindowList.Add(pointer(ViewForm.handle));
I destroy the windows later, like this:
for idx := WindowList.Count -1 downto 0 do
begin
// <-- would like to get the caption of the form here
DestroyWindow(HWnd(WindowList.Items[idx]));
res := GetLastError;
if res = 0
then showmessage('Can not destroy window')
else WindowList.delete(idx);
end;
I occassionally get the 'Can not destroy' coming up but I don't know which window it is. Is it possible to get the caption of the form before destroying it, eg something like:-
WndName := TForm(HWnd(WindowList.Items[idx])).Caption;
I don;t know how to use the HWnd reference with TForm.
Many thanks for any help.
lou