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

Alexander Gottwald
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.

--           ICQ: 126018723

Unsubscribe info:
Problem reports:

More information about the Cygwin-xfree mailing list