The WinMain function has two parameters, hPrevInstance and hInstance, that are called “handles.” A handle is a unique integer that Windows uses to identify an object created or used by an application. Windows uses a wide variety of handles, identifying objects such as application instances, windows, menus, controls, allocated memory, output devices, files, GDI pens and brushes, to name a few.
Most handles are index values for internal tables. Windows uses handle indexes to access the information stored in the table. Typically, your application has access only to the handle, and not to the data. When you need to examine or change the data, you supply the handle and Windows does the rest. This is one way that Windows protects data in its multitasking environment.