it would be easier to use the
EnumWindows
function to enumerate all top level windows. and yes indeed you have to use an existing buffer to call
GetClassName
not a pointer.
struct _
{
unsigned long pid;
static int FAR PASCAL wenum(HWND h,long p)
{
unsigned long pid;
_* me = (_*)p;
if(::GetWindowThreadProcessId( h,&pid) && (me->pid==pid))
{
TCHAR c[0x100];
int l;
if(l=::GetClassName(h,c,sizeof(c)/sizeof(c[0])))
{
}
}
return 1;
}
} x = { idProcess };
EnumWindows(x.wenum,(long)&x);