Re: RegisterClass problem

"Eman Fu" writes:

> Yes! I have encounterred such a problem, too. I noticed that the value passed to
> the field hInstance of the structure WNDCLASS, which is the parameter of 
> RegisterClass, is got by GetCurrentProcess() function. But as my experiments, 
> the value got from GetCurrentProcess() is not the same as the real instance 
> handle passed into WinMain(), thus failed the RegisterClass() call. I changed 
> the code to use the real instance handle, then everything got fixed. You can try
> it!
> 
> I also found that in several places there are such codes:
> 
>    if (some_pointer->some_field) {
>        //...operations on some_pointer->some_field...
>        ...
>    }
> 
> The codes caused GP Fault in Windows if some_pointer is NULL. I also added 
> checks on some_pointers to ensure they are not NULL. Hope my experience 
> will help you.

This is most useful information! The GP problem is well-known - also on Unix 
and should hopefully not be the case in too many places. If you have some 
patches that you would like to share - then hat would be very nice!

Thanks a lot!


-- 

Henrik Frystyk Nielsen, <frystyk@w3.org>
World-Wide Web Consortium, MIT/LCS NE43-356
545 Technology Square, Cambridge MA 02139, USA

Received on Tuesday, 23 January 1996 18:21:14 UTC