I'm trying to figure out a smart way to handle multiple lister instances so that i can have more than one lister window open at the same time...the following code works if lister is opened one time...when opening more than one, the errors come when closing those lister windows again. It simply crashes. I thought of using some sort of TList to store window handles and only destroy the right one in ListClose, but can't figure out how to do it, so a little help would be great! Maybe someone have some good examples on how to handle multiple lister windows ??
extern "C" void __export WINAPI ListCloseWindow(HWND ListWin)
{
TWinControl *pWinControl = FindControl(ListWin);
if (pWinControl->ClassNameIs("TForm1"))
{
// this is my form
delete (TForm1*)pWinControl;
}
}
procedure ListCloseWindow(ListWin: THandle); stdcall;
var
pWinControl: TWinControl;
begin
pWinControl := FindControl(ListWin);
if pWinControl.ClassNameIs('TfrmMain') then
pWinControl.Free;
end;