/* Master include file for Windows applications. */
#ifndef _WINDOWS_
#define _WINDOWS_
#pragma _fpath <Windows>

#ifndef WINVER
#define WINVER 0x0400
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
#ifndef _WIN32_IE
#define _WIN32_IE 0x0400
#endif
#define STRICT
#define _WIN32

//#include <excpt.h>
#include <stdarg.h>
#include <wctype.h> /* for wchar_t used in winnt.h inside windef.h */
#define _huge
#define _X86_ 
#define _M_IX86 500
#define OEMRESOURCE //can use OBM_ constants
#define NONAMELESSUNION
#define NOMINMAX

#include <windef.h>
#include <winsock2.h>

#if defined(_CHDLL_) && !access(stradd(getenv("CHHOME"), "/toolkit/dl/libwindows.dl"), 0)
#include <dlfcn.h>
void *_ChWindows_handle = dlopen("libwindows.dl", RTLD_LAZY);
if(_ChWindows_handle == NULL) {
   fprintf(_stderr, "Error: dlopen(): %s\n", dlerror());
   fprintf(_stderr, "       cannot get _ChWindows_handle in winuser.h\n");
   exit(-1);
} 
ChWindowsInitialize();
void _dlclose_windows(void) {
   dlclose(_ChWindows_handle);
}
atexit(_dlclose_windows);
#endif
#pragma importf <ChWinProcDefault.chf>

#endif /* _WINDOWS_ */
