Hmm, im still abit confused on how wndproc actually knows to route the messages to handleevent just by returning handleevent, because with a normal function if we returned a value that function would hold that value, like in this example:

int sum()

{
int a = 5 + 2;
return a;
}

x = sum();

Here, because we have returned int a to sum(), we can assign its returned value to a
variable, now, x is equal to 7.

So i cant see how wndproc knows to route all messages to handleevent.

Thanks for the replies