From 64ca22a4f2534c4cbc8563a7121bbc9453f6c0ad Mon Sep 17 00:00:00 2001 From: Antonio Linares Date: Sat, 22 Dec 2001 10:21:37 +0000 Subject: [PATCH] New hb_StartApp() added --- harbour/source/vm/dynlibhb.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/harbour/source/vm/dynlibhb.c b/harbour/source/vm/dynlibhb.c index 1f91ab19d7..dfb3206e23 100644 --- a/harbour/source/vm/dynlibhb.c +++ b/harbour/source/vm/dynlibhb.c @@ -61,6 +61,10 @@ #include "hbstack.h" #include "hbvm.h" +#if defined(HB_OS_WIN_32) + extern HMODULE _hInstance; +#endif + HB_FUNC( LIBLOAD ) { #if defined(HB_OS_WIN_32) @@ -113,3 +117,21 @@ HB_FUNC( HB_LIBDO ) } } + +/* It returns TRUE if this function is called from the main app (EXE) + * and FALSE if it is called from a dynamic library (DLL) + * -please update the mentioned extensions for other OS- + */ + +BOOL hb_StartApp( void ) +{ +#if defined(HB_OS_WIN_32) + { + return ( BOOL ) ( _hInstance == GetModuleHandle( NULL ) ); + } +#else + { + return TRUE; /* Warning: this must be changed for other OS */ + } +#endif +} \ No newline at end of file