GetDC(NULL), GetModuleHandle(NULL), etc.

Alexander Gottwald alexander.gottwald@s1999.tu-chemnitz.de
Sun Sep 4 11:52:00 GMT 2005


On Fri, 2 Sep 2005, Joe Krahn wrote:

> GetModuleHandle(NULL) is also in several places. Maybe it's OK, but why 
> not use the hInstance global?

Global variables are bad(TM). With GetModuleHandle(NULL) there is no need
to maintain a global hInstance. The other reason is there is no WinMain
which has the hInstance parameter. So you'd require to set the global
hInstance somewhere else and you have to make sure this occurs before 
the first reference to hInstance. GetModuleHandle(NULL) was used explicitly
to reduce complexity.

bye
	ago
-- 
 Alexander.Gottwald@s1999.tu-chemnitz.de 
 http://www.gotti.org           ICQ: 126018723

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/



More information about the Cygwin-xfree mailing list