Determine the current HINSTANCE?

Solution 1:

If memory serves, GetModuleHandle(NULL); returns the instance handle.

Solution 2:

__ImageBase is your friend, especially in the case of libraries.

Note that the linked blog post (by R. Chen, although not the same post as the one linked by Brian Bondy) is worth reading (including the comments!)

Solution 3:

If you are using MFC, you can use AfxGetInstanceHandle.

If you are not using MFC you can use: GetWindowLong(hWnd, GWL_HINSTANCE)