I was thinking a design like the following outline....
PHP Code:
bool inited = false;
int init()
{
.... // As before but all sl(..) calls moved to init2()
inited = false;
}
void init2()
{
if ( inited ) return;
... // All the sl(..) calls
inited = true;
}
int start()
{
init2();
...
}
In that way, the WindowFind() function would not be called from the init() function but from the start() function, at which time it actually works.